Skip to content

Commit

Permalink
Fix Keybindings can't be rebound to mouse 4/5 key (side key)
Browse files Browse the repository at this point in the history
  • Loading branch information
boholder committed Nov 11, 2023
1 parent 2ce825b commit dfc4855
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public static boolean isAnyPressed(int... keyCodes) {
return IntStream.of(keyCodes).anyMatch(c -> InputUtil.isKeyPressed(handle, c));
}

@SuppressWarnings("unused")
public static boolean isAllPressed(int... keyCodes) {
MinecraftClient minecraftClient = MinecraftClient.getInstance();
if (minecraftClient == null) return false;
Expand All @@ -36,18 +37,12 @@ public static boolean isAllPressed(int... keyCodes) {
* Get these instances via InputUtil.fromTranslationKey({key})
*/
public static boolean isAnyPressed(KeyBinding... keyBindings) {
int[] array = Arrays.stream(keyBindings)
.mapToInt(b -> InputUtil.fromTranslationKey(b.getBoundKeyTranslationKey()).getCode())
.toArray();
return isAnyPressed(array);
return Arrays.stream(keyBindings).anyMatch(KeyBinding::isPressed);
}

@SuppressWarnings("unused")
public static boolean isAllPressed(KeyBinding... keyBindings) {
int[] array = Arrays.stream(keyBindings)
.mapToInt(b -> InputUtil.fromTranslationKey(b.getBoundKeyTranslationKey()).getCode())
.toArray();
return isAllPressed(array);
return Arrays.stream(keyBindings).allMatch(KeyBinding::isPressed);
}

public static boolean isF3Pressed() {
Expand Down

0 comments on commit dfc4855

Please sign in to comment.