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.
This commit is contained in:
Christian committed 2012-08-18 10:24:29 -04:00
1 parent cf77ffb89d
commit ad4cffb0c6
1 file changed
+18 -1
@@ -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;