1
0
forked from Clones/Controlify

🐛 Fix vanilla overrides triggering more than once

This commit is contained in:
isXander
2023-07-11 08:11:28 +01:00
parent 1ab42afdbb
commit f9c93c8ab1
4 changed files with 9 additions and 43 deletions

View File

@ -410,10 +410,11 @@ public class ControllerBindings<T extends ControllerState> {
registerModdedKeybinds();
// key events are executed in Minecraft#execute, which run at runTick.runAllTasks()
// which this event runs directly after. A normal tick could run multiple
// times per frame, so you could get double clicks if lagging.
InputHandledEvent.EVENT.register(this::imitateVanillaClick);
ControlifyEvents.CONTROLLER_STATE_UPDATE.register(ctrl -> {
if (ctrl == this.controller) {
this.imitateVanillaClick();
}
});
ControlifyEvents.INPUT_MODE_CHANGED.register(mode -> KeyMapping.releaseAll());
}
@ -540,8 +541,9 @@ public class ControllerBindings<T extends ControllerState> {
accessor.setIsDown(!accessor.getIsDown());
}
}
if (binding.justPressed())
if (binding.justPressed()) {
KeyMapping.click(vanillaKeyCode);
}
}
}