petroleum/src/main/java/pm/j4/petroleum/modules/base/option/KeybindValue.java

40 lines
886 B
Java

package pm.j4.petroleum.modules.base.option;
import net.minecraft.client.options.KeyBinding;
import pm.j4.petroleum.modules.base.StringWritable;
/**
* The type Keybind value.
*/
public class KeybindValue extends StringWritable<KeyBinding> {
/**
* Instantiates a new Keybind value.
*
* @param translationKey the translation key
* @param code the code
* @param category the category
*/
public KeybindValue(String translationKey, int code, String category) {
this.value = new KeyBinding(translationKey, code, category);
}
/**
* Instantiates a new Keybind value.
*
* @param binding the binding
*/
public KeybindValue(KeyBinding binding) {
this.value = binding;
}
@Override
public String getType() {
return "KB";
}
@Override
public String getStringValue() {
return this.value.getDefaultKey().getLocalizedText().getString();
}
}