Make mouse button keybinds more reliable (#205)

This commit is contained in:
Wilhelm Schuster authored and GitHub committed 2025-08-29 06:00:43 +02:00
1 parent 36cbc6a8b2
commit a0ed2d9b1e
2 files changed
+16 -3

No files matched your search

@@ -15,6 +15,7 @@ import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
import cpw.mods.fml.common.gameevent.InputEvent.MouseInputEvent;
import mantle.common.network.AbstractPacket;
import modwarriors.notenoughkeys.api.Api;
import modwarriors.notenoughkeys.api.KeyBindingPressedEvent;
@@ -90,6 +91,13 @@ public class ArmorControls {
}
}
/**
* handles keybinds on mouse buttons
*/
public void mouseEvent(MouseInputEvent event) {
checkAndPerformKeyActions(null, false);
}
@Optional.Method(modid = "notenoughkeys")
public void keyEventSpecial(KeyBindingPressedEvent event) {
if (event.keyBinding != null && event.isKeyBindingPressed) {
@@ -219,6 +227,11 @@ public class ArmorControls {
ArmorControls.this.keyEvent(event);
}
@SubscribeEvent
public void mouseEventWrapper(MouseInputEvent event) {
ArmorControls.this.mouseEvent(event);
}
@Optional.Method(modid = "notenoughkeys")
@SubscribeEvent
public void keyEventSpecialWrapper(KeyBindingPressedEvent event) {