fix: some modifier keybinds not working
fixes https://github.com/nea89o/Firmament/issues/107
This commit is contained in:
@@ -48,7 +48,7 @@ object PriceData : FirmamentFeature {
|
||||
}
|
||||
val sbId = it.stack.skyBlockId
|
||||
val stackSize = it.stack.count
|
||||
val isShowingStack = TConfig.stackSizeKey.isPressed(atLeast = true)
|
||||
val isShowingStack = TConfig.stackSizeKey.isPressed()
|
||||
val multiplier = if (isShowingStack) stackSize else 1
|
||||
val multiplierText =
|
||||
if (isShowingStack)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
package moe.nea.firmament.keybindings
|
||||
|
||||
import org.lwjgl.glfw.GLFW
|
||||
@@ -54,11 +52,19 @@ data class SavedKeyBinding(
|
||||
}
|
||||
|
||||
private val h get() = MC.window.handle
|
||||
fun isShiftDown() = InputUtil.isKeyPressed(h, GLFW.GLFW_KEY_LEFT_SHIFT)
|
||||
|| InputUtil.isKeyPressed(h, GLFW.GLFW_KEY_RIGHT_SHIFT)
|
||||
fun isShiftDown() = shiftKeys.any { InputUtil.isKeyPressed(h, it) }
|
||||
|
||||
fun unbound(): SavedKeyBinding =
|
||||
SavedKeyBinding(GLFW.GLFW_KEY_UNKNOWN)
|
||||
|
||||
val controlKeys = if (MinecraftClient.IS_SYSTEM_MAC) {
|
||||
listOf(GLFW.GLFW_KEY_LEFT_SUPER, GLFW.GLFW_KEY_RIGHT_SUPER)
|
||||
} else {
|
||||
listOf(GLFW.GLFW_KEY_LEFT_CONTROL, GLFW.GLFW_KEY_RIGHT_CONTROL)
|
||||
}
|
||||
val shiftKeys = listOf(GLFW.GLFW_KEY_LEFT_SHIFT, GLFW.GLFW_KEY_RIGHT_SHIFT)
|
||||
|
||||
val altKeys = listOf(GLFW.GLFW_KEY_LEFT_ALT, GLFW.GLFW_KEY_RIGHT_ALT)
|
||||
}
|
||||
|
||||
fun isPressed(atLeast: Boolean = false): Boolean {
|
||||
@@ -66,14 +72,10 @@ data class SavedKeyBinding(
|
||||
val h = MC.window.handle
|
||||
if (!InputUtil.isKeyPressed(h, keyCode)) return false
|
||||
|
||||
val ctrl = if (MinecraftClient.IS_SYSTEM_MAC) {
|
||||
InputUtil.isKeyPressed(h, GLFW.GLFW_KEY_LEFT_SUPER)
|
||||
|| InputUtil.isKeyPressed(h, GLFW.GLFW_KEY_RIGHT_SUPER)
|
||||
} else InputUtil.isKeyPressed(h, GLFW.GLFW_KEY_LEFT_CONTROL)
|
||||
|| InputUtil.isKeyPressed(h, GLFW.GLFW_KEY_RIGHT_CONTROL)
|
||||
val shift = isShiftDown()
|
||||
val alt = InputUtil.isKeyPressed(h, GLFW.GLFW_KEY_LEFT_ALT)
|
||||
|| InputUtil.isKeyPressed(h, GLFW.GLFW_KEY_RIGHT_ALT)
|
||||
// These are modifiers, so if the searched keyCode is a modifier key, then that key does not count as the modifier
|
||||
val ctrl = keyCode !in controlKeys && controlKeys.any { InputUtil.isKeyPressed(h, it) }
|
||||
val shift = keyCode !in shiftKeys && isShiftDown()
|
||||
val alt = keyCode !in altKeys && altKeys.any { InputUtil.isKeyPressed(h, it) }
|
||||
if (atLeast)
|
||||
return (ctrl >= this.ctrl) &&
|
||||
(alt >= this.alt) &&
|
||||
|
||||
Reference in New Issue
Block a user