mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 16:27:47 +00:00
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:
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;
|
||||
|
||||
Reference in new issue
Block a user