package com.irtimaled.bbor.client.keyboard;
import net.minecraft.client.settings.KeyBinding;
-import net.minecraft.client.util.InputMappings;
public class Key extends KeyBinding {
- private InputMappings.Input input;
private KeyHandler onKeyPress;
private KeyHandler onLongKeyPress;
private int longPressDuration;
return this;
}
- InputMappings.Input getInput() {
- if (input == null)
- return getDefault();
- return input;
- }
-
- @Override
- public void bind(InputMappings.Input input) {
- this.input = input;
- super.bind(input);
- }
-
private int pressDuration = 0;
@Override
public boolean isPressed() {
- return pressDuration == 1;
+ return pressDuration >= 1;
}
void release() {
if (pressDuration == longPressDuration) {
onLongKeyPress.handle();
+ pressDuration = 0;
}
}