From ad4cffb0c66cf2279e81301a68022bd32a45e6a1 Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 18 Aug 2012 10:24:29 -0400 Subject: [PATCH] Add in support for "dummy" keybindings- ones that are added to the list but never do anything so the mod can handle it all themselves. --- .../client/registry/KeyBindingRegistry.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/client/cpw/mods/fml/client/registry/KeyBindingRegistry.java b/client/cpw/mods/fml/client/registry/KeyBindingRegistry.java index 7019de56ba..328b9b64b0 100644 --- a/client/cpw/mods/fml/client/registry/KeyBindingRegistry.java +++ b/client/cpw/mods/fml/client/registry/KeyBindingRegistry.java @@ -27,7 +27,10 @@ public class KeyBindingRegistry */ public static void registerKeyBinding(KeyHandler handler) { instance().keyHandlers.add(handler); - TickRegistry.registerTickHandler(handler, Side.CLIENT); + if (!handler.isDummy) + { + TickRegistry.registerTickHandler(handler, Side.CLIENT); + } } @@ -43,6 +46,7 @@ public class KeyBindingRegistry protected KeyBinding[] keyBindings; protected boolean[] keyDown; protected boolean[] repeatings; + private boolean isDummy; /** * Pass an array of keybindings and a repeat flag for each one @@ -58,6 +62,19 @@ public class KeyBindingRegistry this.keyDown = new boolean[keyBindings.length]; } + + /** + * Register the keys into the system. You will do your own keyboard management elsewhere. No events will fire + * if you use this method + * + * @param keyBindings + */ + public KeyHandler(KeyBinding[] keyBindings) + { + this.keyBindings = keyBindings; + this.isDummy = true; + } + public KeyBinding[] getKeyBindings() { return this.keyBindings;