From 639c71d5b8807c68a7ee5204b478a17e122db19d Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Fri, 3 Nov 2023 19:29:32 +0600 Subject: [PATCH] FIxed Mouse Buttons issue --- .../client/mods/hud/KeystrokesMod.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/silentclient/client/mods/hud/KeystrokesMod.java b/src/main/java/net/silentclient/client/mods/hud/KeystrokesMod.java index 1dc6dd6..c1500a0 100644 --- a/src/main/java/net/silentclient/client/mods/hud/KeystrokesMod.java +++ b/src/main/java/net/silentclient/client/mods/hud/KeystrokesMod.java @@ -48,7 +48,7 @@ public class KeystrokesMod extends ModDraggable { this.addBooleanSetting("Replace Names With Arrow", this, false); } - public static enum KeystrokesMode { + public enum KeystrokesMode { WASD(Key.W, Key.A, Key.S, Key.D), WASD_MOUSE(Key.W, Key.A, Key.S, Key.D, Key.LMB, Key.RMB); @@ -57,7 +57,7 @@ public class KeystrokesMod extends ModDraggable { private int width; private int height; - private KeystrokesMode(Key... keysIn) { + KeystrokesMode(Key... keysIn) { this.keys = keysIn; for(Key key : keys) { @@ -111,14 +111,18 @@ public class KeystrokesMod extends ModDraggable { } public boolean isDown() { - if(Minecraft.getMinecraft().currentScreen != null) { - return false; + try { + if(Minecraft.getMinecraft().currentScreen != null) { + return false; + } + + if(this == Key.LMB || this == Key.RMB) { + return Mouse.isButtonDown(this == Key.LMB ? 0 : 1); + } + return Keyboard.isKeyDown(keyBind.getKeyCode()); + } catch (Exception err) { + return keyBind.isKeyDown(); } - - if(this == Key.LMB || this == Key.RMB) { - return Mouse.isButtonDown(this == Key.LMB ? 0 : 1); - } - return Keyboard.isKeyDown(keyBind.getKeyCode()); } public int getHeight() {