Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for >0 instead of !=0 #283

Merged
merged 1 commit into from
Nov 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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