- 388
- 1
Зарегистрировал KeyBinding. Как поймать событие отпускания клавиши?
Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
isPressed() это нажатие. А отпускание как поймать?Agravaine написал(а):KeyInputEvent.
boolean lc, lc_last = false;
@SubscribeEvent
public void actionBindAttack(TickEvent.PlayerTickEvent event) {
if (event.phase == TickEvent.Phase.START && event.side == Side.CLIENT) {
if (RegKey.button_left.getIsKeyPressed()) {
lc = true;
if (!lc_last && lc) ActionMouseKey.actionLeftClickClient(event.player, true);//press down
lc_last = lc;
} else {
lc = false;
if (lc_last && !lc) ActionMouseKey.actionLeftClickClient(event.player, false);//unpress down
lc_last = lc;
}
}
}
if (!lc_last && lc) ... //press down
if (lc_last && !lc) ... //unpress down
ActionMouseKey.actionLeftClickClient