Skip to content

Commit fcc45f7

Browse files
author
Kenzo101 Studios
committed
Use GLFW direct key/mouse state checks and log discrepancies vs InputConstants
1 parent f9e15e1 commit fcc45f7

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

neoforge/src/main/java/com/wurstclient_v7/input/KeybindManager.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,18 @@ public static boolean isPressed(long window, String action) {
165165
boolean alt = InputConstants.isKeyDown(window, GLFW.GLFW_KEY_LEFT_ALT) || InputConstants.isKeyDown(window, GLFW.GLFW_KEY_RIGHT_ALT);
166166
if (!alt) return false;
167167
}
168-
// check primary input
169-
return InputConstants.isKeyDown(window, kb.key);
168+
// check primary input - prefer GLFW direct checks; compare with InputConstants for debugging
169+
boolean glfwDown;
170+
if (kb.isMouse) {
171+
glfwDown = GLFW.glfwGetMouseButton(window, kb.key) == GLFW.GLFW_PRESS;
172+
} else {
173+
glfwDown = GLFW.glfwGetKey(window, kb.key) == GLFW.GLFW_PRESS;
174+
}
175+
boolean icDown = InputConstants.isKeyDown(window, kb.key);
176+
if (glfwDown != icDown) {
177+
System.out.println("[KEYDEBUG] discrepancy for " + keybindLabel(kb) + ": InputConstants=" + icDown + " GLFW=" + glfwDown + " key=" + kb.key);
178+
}
179+
return glfwDown;
170180
}
171181

172182
private static void load() {

0 commit comments

Comments
 (0)