Skip to content

Commit

Permalink
Check for >0 instead of !=0
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchej123 committed Nov 24, 2023
1 parent 2ac2d54 commit eb08425
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class MixinKeyBinding implements KeyBindingExt {
*/
@Overwrite
public static void onTick(int keyCode) {
if (keyCode != 0) {
if (keyCode > 0) {
for (KeyBinding bind : hodgepodge$keybindMultiMap.get(keyCode)) {
if (bind != null) {
++((MixinKeyBinding) (Object) bind).pressTime;
Expand All @@ -52,7 +52,7 @@ public static void onTick(int keyCode) {
*/
@Overwrite
public static void setKeyBindState(int keyCode, boolean pressed) {
if (keyCode != 0) {
if (keyCode > 0) {
for (KeyBinding bind : hodgepodge$keybindMultiMap.get(keyCode)) {
if (bind != null) {
((MixinKeyBinding) (Object) bind).pressed = pressed;
Expand All @@ -68,7 +68,7 @@ public static void setKeyBindState(int keyCode, boolean pressed) {
private static void hodgepodge$populateKeybindMatcherArray(CallbackInfo ci) {
hodgepodge$keybindMultiMap.clear();
for (KeyBinding binding : (List<KeyBinding>) keybindArray) {
if (binding != null && binding.getKeyCode() != 0) {
if (binding != null && binding.getKeyCode() > 0) {
hodgepodge$keybindMultiMap.put(binding.getKeyCode(), binding);
}
}
Expand All @@ -87,7 +87,7 @@ public static void setKeyBindState(int keyCode, boolean pressed) {
for (KeyBinding keyBinding : hodgepodge$keybindMultiMap.values()) {
try {
final int keyCode = keyBinding.getKeyCode();
KeyBinding.setKeyBindState(keyCode, keyCode < 256 && Keyboard.isKeyDown(keyCode));
KeyBinding.setKeyBindState(keyCode, keyCode > 0 && keyCode < 256 && Keyboard.isKeyDown(keyCode));
} catch (IndexOutOfBoundsException ignored) {}
}
}
Expand Down

0 comments on commit eb08425

Please sign in to comment.