diff options
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/keybindings')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/keybindings/SavedKeyBinding.kt | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/keybindings/SavedKeyBinding.kt b/src/main/kotlin/moe/nea/firmament/keybindings/SavedKeyBinding.kt index 606485b..e538ff0 100644 --- a/src/main/kotlin/moe/nea/firmament/keybindings/SavedKeyBinding.kt +++ b/src/main/kotlin/moe/nea/firmament/keybindings/SavedKeyBinding.kt @@ -38,25 +38,8 @@ data class SavedKeyBinding( } } - fun hasShiftDown(): Boolean { - return InputUtil.isKeyPressed( - MinecraftClient.getInstance().window.handle, - GLFW.GLFW_KEY_LEFT_SHIFT - ) || InputUtil.isKeyPressed( - MinecraftClient.getInstance().window.handle, GLFW.GLFW_KEY_RIGHT_SHIFT - ) - } - - fun hasAltDown(): Boolean { - return InputUtil.isKeyPressed( - MinecraftClient.getInstance().window.handle, - GLFW.GLFW_KEY_LEFT_ALT - ) || InputUtil.isKeyPressed( - MinecraftClient.getInstance().window.handle, GLFW.GLFW_KEY_RIGHT_ALT - ) - } - fun isPressed(): Boolean { + if (this.keyCode == GLFW.GLFW_KEY_UNKNOWN) return false val h = MC.window.handle if (!InputUtil.isKeyPressed(h, keyCode)) return false @@ -76,6 +59,7 @@ data class SavedKeyBinding( } override fun matches(keyCode: Int, scanCode: Int, modifiers: Int): Boolean { + if (this.keyCode == GLFW.GLFW_KEY_UNKNOWN) return false return keyCode == this.keyCode && getMods(modifiers) == Triple(shift, ctrl, alt) } |