FIxed Mouse Buttons issue

This commit is contained in:
kirillsaint 2023-11-03 19:29:32 +06:00
parent cdf1e9bcf7
commit 639c71d5b8

View File

@ -48,7 +48,7 @@ public class KeystrokesMod extends ModDraggable {
this.addBooleanSetting("Replace Names With Arrow", this, false); 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(Key.W, Key.A, Key.S, Key.D),
WASD_MOUSE(Key.W, Key.A, Key.S, Key.D, Key.LMB, Key.RMB); 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 width;
private int height; private int height;
private KeystrokesMode(Key... keysIn) { KeystrokesMode(Key... keysIn) {
this.keys = keysIn; this.keys = keysIn;
for(Key key : keys) { for(Key key : keys) {
@ -111,14 +111,18 @@ public class KeystrokesMod extends ModDraggable {
} }
public boolean isDown() { public boolean isDown() {
if(Minecraft.getMinecraft().currentScreen != null) { try {
return false; 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() { public int getHeight() {