KeyBinding handler change: a handler now takes an array of keys and calls back with the

activated key. Sorry for the inconvenience but this improves the usability of this
API a lot
This commit is contained in:
Christian committed 2012-08-14 22:06:49 -04:00
1 parent 7c01b64aed
commit 0f988d087c
2 files changed
+40 -26

No files matched your search

@@ -43,17 +43,17 @@ public class ModLoaderKeyBindingHandler extends KeyBindingRegistry.KeyHandler
*/
public ModLoaderKeyBindingHandler(KeyBinding keyBinding, boolean allowRepeat, ModLoaderModContainer modContainer)
{
super(keyBinding, allowRepeat);
super(new KeyBinding[] { keyBinding }, new boolean[] { allowRepeat });
this.modContainer=modContainer;
}
public void onRenderEndTick()
{
((net.minecraft.src.BaseMod)modContainer.getMod()).keyboardEvent(keyBinding);
((net.minecraft.src.BaseMod)modContainer.getMod()).keyboardEvent(keyBindings[0]);
}
@Override
public void keyDown(EnumSet<TickType> type, boolean end, boolean repeats)
public void keyDown(EnumSet<TickType> type, KeyBinding kb, boolean end, boolean repeats)
{
if (!end)
{
@@ -72,7 +72,7 @@ public class ModLoaderKeyBindingHandler extends KeyBindingRegistry.KeyHandler
}
@Override
public void keyUp(EnumSet<TickType> type, boolean end)
public void keyUp(EnumSet<TickType> type, KeyBinding kb, boolean end)
{
if (!end)
{
@@ -99,6 +99,6 @@ public class ModLoaderKeyBindingHandler extends KeyBindingRegistry.KeyHandler
@Override
public String getLabel()
{
return modContainer.getModId() +" KB "+keyBinding.field_74512_d;
return modContainer.getModId() +" KB "+keyBindings[0].field_74512_d;
}
}