diff --git a/src/api/java/modwarriors/notenoughkeys/api/Api.java b/src/api/java/modwarriors/notenoughkeys/api/Api.java index 390d28a3727..25b6366a96d 100644 --- a/src/api/java/modwarriors/notenoughkeys/api/Api.java +++ b/src/api/java/modwarriors/notenoughkeys/api/Api.java @@ -25,13 +25,14 @@ public static boolean isLoaded() { * Registers a mod's keys with NEK * * @param modname The NAME of the mod registering the key - * @param keyDecriptions A String[] (Array[String]) of the key descriptions. i.e. new String[]{"key.hotbar1"} + * @param keyDescriptions A String[] (Array[String]) of the key descriptions + * as an inherit array. i.e. ("modName", "key.hotbar1", "key.hotbar2") */ - public static void registerMod(String modname, String[] keyDecriptions) { + public static void registerMod(String modname, String... keyDescriptions) { try { Class.forName("modwarriors.notenoughkeys.keys.KeyHelper").getMethod( "registerMod", String.class, String[].class - ).invoke(null, modname, keyDecriptions); + ).invoke(null, modname, keyDescriptions); } catch (Exception e) { e.printStackTrace(); } diff --git a/src/api/java/modwarriors/notenoughkeys/api/KeyBindingPressedEvent.java b/src/api/java/modwarriors/notenoughkeys/api/KeyBindingPressedEvent.java index d17b8089606..a0023a24556 100644 --- a/src/api/java/modwarriors/notenoughkeys/api/KeyBindingPressedEvent.java +++ b/src/api/java/modwarriors/notenoughkeys/api/KeyBindingPressedEvent.java @@ -23,6 +23,12 @@ public class KeyBindingPressedEvent extends Event { * Tells whether a modifier was required AND was down when triggered */ public boolean shiftRequired = false, ctrlRequired = false, altRequired = false; + /** + * Use this variable to check if your key is pressed. DO NOT check KeyBinding.getIsKeyPressed(). + * That value will return only if the main key is pressed or not. + * @see modwarriors.notenoughkeys.keys.KeyEvents refreshBindings + */ + public boolean isKeyBindingPressed; /** * Called with the passed keyBinding and modifiers. @@ -31,13 +37,13 @@ public class KeyBindingPressedEvent extends Event { * @param keyBinding The KeyBinding being triggered. Stores the key's description and keycode * @param modifiers The modifiers (SHIFT, CTRL, ALT) that determine when a compatible key is pressed */ - public KeyBindingPressedEvent(KeyBinding keyBinding, boolean[] modifiers) { + public KeyBindingPressedEvent(KeyBinding keyBinding, boolean[] modifiers, boolean isPressed) { super(); this.keyBinding = keyBinding; this.shiftRequired = modifiers[0]; this.ctrlRequired = modifiers[1]; this.altRequired = modifiers[2]; - + this.isKeyBindingPressed = isPressed; } } diff --git a/src/api/java/modwarriors/notenoughkeys/api/package-info.java b/src/api/java/modwarriors/notenoughkeys/api/package-info.java index d53b000808e..63991a42cfc 100644 --- a/src/api/java/modwarriors/notenoughkeys/api/package-info.java +++ b/src/api/java/modwarriors/notenoughkeys/api/package-info.java @@ -1,5 +1,5 @@ @API(owner = "Not Enough Keys", provides = "API_NEK", - apiVersion = "1.0.0") package modwarriors.notenoughkeys.api; + apiVersion = "1.1.0") package modwarriors.notenoughkeys.api; import cpw.mods.fml.common.API; diff --git a/src/main/java/tconstruct/client/ArmorControls.java b/src/main/java/tconstruct/client/ArmorControls.java index a554c979e6f..9f6deb3c249 100644 --- a/src/main/java/tconstruct/client/ArmorControls.java +++ b/src/main/java/tconstruct/client/ArmorControls.java @@ -98,7 +98,7 @@ public void keyEvent(KeyInputEvent event) { @Optional.Method(modid = "notenoughkeys") @SubscribeEvent public void keyEventSpecial(KeyBindingPressedEvent event) { - this.sendPress(event.keyBinding, event.keyBinding.isPressed()); + this.sendPress(event.keyBinding, event.isKeyBindingPressed); } private void checkKeys(int keycode) {