aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compat/yacl/java/KeybindingController.kt4
-rw-r--r--src/main/java/moe/nea/firmament/mixins/KeyPressInWorldEventPatch.java8
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MixinHandledScreen.java19
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MousePressInWorldEventPatch.java19
-rw-r--r--src/main/kotlin/events/HandledScreenKeyPressedEvent.kt2
-rw-r--r--src/main/kotlin/events/WorldKeyboardEvent.kt7
-rw-r--r--src/main/kotlin/features/items/EtherwarpOverlay.kt1
-rw-r--r--src/main/kotlin/features/macros/KeyComboTrie.kt4
-rw-r--r--src/main/kotlin/features/macros/MacroUI.kt2
-rw-r--r--src/main/kotlin/features/macros/RadialMenu.kt4
-rw-r--r--src/main/kotlin/gui/FirmButtonComponent.kt134
-rw-r--r--src/main/kotlin/gui/config/KeyBindingStateManager.kt22
-rw-r--r--src/main/kotlin/keybindings/GenericInputButton.kt6
-rw-r--r--src/main/kotlin/keybindings/SavedKeyBinding.kt4
14 files changed, 138 insertions, 98 deletions
diff --git a/src/compat/yacl/java/KeybindingController.kt b/src/compat/yacl/java/KeybindingController.kt
index e9bd500..c303da2 100644
--- a/src/compat/yacl/java/KeybindingController.kt
+++ b/src/compat/yacl/java/KeybindingController.kt
@@ -75,8 +75,8 @@ class KeybindingWidget(
}
override fun mouseClicked(mouseX: Double, mouseY: Double, button: Int): Boolean {
- if (button == 0 && isHovered) {
- sm.onClick()
+ if (isHovered) {
+ sm.onClick(button)
return true
}
return super.mouseClicked(mouseX, mouseY, button)
diff --git a/src/main/java/moe/nea/firmament/mixins/KeyPressInWorldEventPatch.java b/src/main/java/moe/nea/firmament/mixins/KeyPressInWorldEventPatch.java
index d2b3f91..afd3104 100644
--- a/src/main/java/moe/nea/firmament/mixins/KeyPressInWorldEventPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/KeyPressInWorldEventPatch.java
@@ -4,6 +4,8 @@ package moe.nea.firmament.mixins;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import moe.nea.firmament.events.WorldKeyboardEvent;
+import moe.nea.firmament.keybindings.GenericInputAction;
+import moe.nea.firmament.keybindings.InputModifiers;
import net.minecraft.client.Keyboard;
import net.minecraft.client.util.InputUtil;
import org.spongepowered.asm.mixin.Mixin;
@@ -12,9 +14,9 @@ import org.spongepowered.asm.mixin.injection.At;
@Mixin(Keyboard.class)
public class KeyPressInWorldEventPatch {
- @WrapWithCondition(method = "onKey", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;onKeyPressed(Lnet/minecraft/client/util/InputUtil$Key;)V"))
- public boolean onKeyBoardInWorld(InputUtil.Key key, long window, int _key, int scancode, int action, int modifiers) {
- var event = WorldKeyboardEvent.Companion.publish(new WorldKeyboardEvent(_key, scancode, modifiers));
+ @WrapWithCondition(method = "onKey", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;onKeyPressed(Lnet/minecraft/client/util/InputUtil$Key;)V"))
+ public boolean onKeyBoardInWorld(InputUtil.Key key, long window, int _key, int scancode, int action, int modifiers) {
+ var event = WorldKeyboardEvent.Companion.publish(new WorldKeyboardEvent(GenericInputAction.key(_key, scancode), InputModifiers.of(modifiers)));
return !event.getCancelled();
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/MixinHandledScreen.java b/src/main/java/moe/nea/firmament/mixins/MixinHandledScreen.java
index 38db0ba..13f20ce 100644
--- a/src/main/java/moe/nea/firmament/mixins/MixinHandledScreen.java
+++ b/src/main/java/moe/nea/firmament/mixins/MixinHandledScreen.java
@@ -4,11 +4,8 @@ package moe.nea.firmament.mixins;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
+import moe.nea.firmament.events.*;
import moe.nea.firmament.events.HandledScreenClickEvent;
-import moe.nea.firmament.events.HandledScreenForegroundEvent;
-import moe.nea.firmament.events.HandledScreenKeyPressedEvent;
-import moe.nea.firmament.events.IsSlotProtectedEvent;
-import moe.nea.firmament.events.SlotRenderEvents;
import moe.nea.firmament.keybindings.GenericInputAction;
import moe.nea.firmament.keybindings.InputModifiers;
import net.minecraft.client.gui.DrawContext;
@@ -62,7 +59,19 @@ public abstract class MixinHandledScreen<T extends ScreenHandler> {
@Inject(method = "mouseClicked", at = @At("HEAD"), cancellable = true)
public void onMouseClicked(double mouseX, double mouseY, int button, CallbackInfoReturnable<Boolean> cir) {
- if (HandledScreenClickEvent.Companion.publish(new HandledScreenClickEvent((HandledScreen<?>) (Object) this, mouseX, mouseY, button)).getCancelled()) {
+ if (HandledScreenKeyPressedEvent.Companion.publish(new HandledScreenKeyPressedEvent((HandledScreen<?>) (Object) this,
+ GenericInputAction.mouse(button), InputModifiers.current())).getCancelled()) {
+ cir.setReturnValue(true);
+ }
+ }
+
+ @Inject(method = "mouseReleased", at = @At("HEAD"), cancellable = true)
+ private void onMouseReleased(double mouseX, double mouseY, int button, CallbackInfoReturnable<Boolean> cir) {
+ var self = (HandledScreen<?>) (Object) this;
+ var clickEvent = new HandledScreenClickEvent(self, mouseX, mouseY, button);
+ var keyEvent = new HandledScreenKeyReleasedEvent(self, GenericInputAction.mouse(button), InputModifiers.current());
+ if (HandledScreenClickEvent.Companion.publish(clickEvent).getCancelled()
+ || HandledScreenKeyReleasedEvent.Companion.publish(keyEvent).getCancelled()) {
cir.setReturnValue(true);
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/MousePressInWorldEventPatch.java b/src/main/java/moe/nea/firmament/mixins/MousePressInWorldEventPatch.java
new file mode 100644
index 0000000..8bd489c
--- /dev/null
+++ b/src/main/java/moe/nea/firmament/mixins/MousePressInWorldEventPatch.java
@@ -0,0 +1,19 @@
+package moe.nea.firmament.mixins;
+
+import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
+import moe.nea.firmament.events.WorldKeyboardEvent;
+import moe.nea.firmament.keybindings.GenericInputAction;
+import moe.nea.firmament.keybindings.InputModifiers;
+import net.minecraft.client.Mouse;
+import net.minecraft.client.util.InputUtil;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+
+@Mixin(Mouse.class)
+public class MousePressInWorldEventPatch {
+ @WrapWithCondition(method = "onMouseButton", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;onKeyPressed(Lnet/minecraft/client/util/InputUtil$Key;)V"))
+ public boolean onKeyBoardInWorld(InputUtil.Key key, long window, int button, int action, int mods) {
+ var event = WorldKeyboardEvent.Companion.publish(new WorldKeyboardEvent(GenericInputAction.mouse(button), InputModifiers.of(mods)));
+ return !event.getCancelled();
+ }
+}
diff --git a/src/main/kotlin/events/HandledScreenKeyPressedEvent.kt b/src/main/kotlin/events/HandledScreenKeyPressedEvent.kt
index de5dccf..34aebe6 100644
--- a/src/main/kotlin/events/HandledScreenKeyPressedEvent.kt
+++ b/src/main/kotlin/events/HandledScreenKeyPressedEvent.kt
@@ -1,5 +1,6 @@
package moe.nea.firmament.events
+import org.lwjgl.glfw.GLFW
import net.minecraft.client.gui.screen.ingame.HandledScreen
import moe.nea.firmament.keybindings.GenericInputAction
import moe.nea.firmament.keybindings.InputModifiers
@@ -21,6 +22,7 @@ data class HandledScreenKeyPressedEvent(
return keyBinding.matches(input, modifiers, atLeast)
}
+ fun isLeftClick() = input == GenericInputAction.mouse(GLFW.GLFW_MOUSE_BUTTON_LEFT)
companion object : FirmamentEventBus<HandledScreenKeyPressedEvent>()
}
diff --git a/src/main/kotlin/events/WorldKeyboardEvent.kt b/src/main/kotlin/events/WorldKeyboardEvent.kt
index eed892d..860db5c 100644
--- a/src/main/kotlin/events/WorldKeyboardEvent.kt
+++ b/src/main/kotlin/events/WorldKeyboardEvent.kt
@@ -4,13 +4,10 @@ import moe.nea.firmament.keybindings.GenericInputAction
import moe.nea.firmament.keybindings.InputModifiers
import moe.nea.firmament.keybindings.SavedKeyBinding
-data class WorldKeyboardEvent(val keyCode: Int, val scanCode: Int, val modifiers: Int) : FirmamentEvent.Cancellable() {
+data class WorldKeyboardEvent(val action: GenericInputAction, val modifiers: InputModifiers) : FirmamentEvent.Cancellable() {
fun matches(keyBinding: SavedKeyBinding, atLeast: Boolean = false): Boolean {
- return keyBinding.matches(intoAction(), InputModifiers(modifiers), atLeast)
+ return keyBinding.matches(action, modifiers, atLeast)
}
- fun intoAction() = GenericInputAction.key(keyCode, scanCode)
-
-
companion object : FirmamentEventBus<WorldKeyboardEvent>()
}
diff --git a/src/main/kotlin/features/items/EtherwarpOverlay.kt b/src/main/kotlin/features/items/EtherwarpOverlay.kt
index 622ab4a..8893339 100644
--- a/src/main/kotlin/features/items/EtherwarpOverlay.kt
+++ b/src/main/kotlin/features/items/EtherwarpOverlay.kt
@@ -71,6 +71,7 @@ object EtherwarpOverlay : FirmamentFeature {
BlockTags.DOORS,
BlockTags.TRAPDOORS,
BlockTags.ANVIL,
+ BlockTags.FENCE_GATES,
)
)
diff --git a/src/main/kotlin/features/macros/KeyComboTrie.kt b/src/main/kotlin/features/macros/KeyComboTrie.kt
index 452bc56..48ec57c 100644
--- a/src/main/kotlin/features/macros/KeyComboTrie.kt
+++ b/src/main/kotlin/features/macros/KeyComboTrie.kt
@@ -46,14 +46,14 @@ sealed interface KeyComboTrie {
@Serializable
data class MacroWheel(
- val key: SavedKeyBinding,
+ val keyBinding: SavedKeyBinding = SavedKeyBinding.unbound(),
val options: List<HotkeyAction>
)
@Serializable
data class ComboKeyAction(
val action: HotkeyAction,
- val keys: List<SavedKeyBinding>,
+ val keySequence: List<SavedKeyBinding> = listOf(),
)
data class Leaf(val action: HotkeyAction) : KeyComboTrie {
diff --git a/src/main/kotlin/features/macros/MacroUI.kt b/src/main/kotlin/features/macros/MacroUI.kt
index 5a7d406..09390fe 100644
--- a/src/main/kotlin/features/macros/MacroUI.kt
+++ b/src/main/kotlin/features/macros/MacroUI.kt
@@ -143,7 +143,7 @@ class MacroUI {
inner class Wheels {
@field:Bind("wheels")
val wheels: ObservableList<Wheel> = MacroData.DConfig.data.wheels.mapTo(ObservableList(mutableListOf())) {
- Wheel(this, it.key, it.options.map { CommandAction((it as CommandAction).command) })
+ Wheel(this, it.keyBinding, it.options.map { CommandAction((it as CommandAction).command) })
}
@Bind
diff --git a/src/main/kotlin/features/macros/RadialMenu.kt b/src/main/kotlin/features/macros/RadialMenu.kt
index 5134994..3496d43 100644
--- a/src/main/kotlin/features/macros/RadialMenu.kt
+++ b/src/main/kotlin/features/macros/RadialMenu.kt
@@ -127,7 +127,7 @@ object RadialMacros {
fun onOpen(event: WorldKeyboardEvent) {
if (RadialMenuViewer.activeMenu != null) return
wheels.forEach { wheel ->
- if (event.matches(wheel.key, atLeast = true)) {
+ if (event.matches(wheel.keyBinding, atLeast = true)) {
class R(val action: HotkeyAction) : RadialMenuOption {
override val isEnabled: Boolean
get() = true
@@ -142,7 +142,7 @@ object RadialMacros {
}
RadialMenuViewer.activeMenu = object : RadialMenu {
override val key: SavedKeyBinding
- get() = wheel.key
+ get() = wheel.keyBinding
override val options: List<RadialMenuOption> =
wheel.options.map { R(it) }
}
diff --git a/src/main/kotlin/gui/FirmButtonComponent.kt b/src/main/kotlin/gui/FirmButtonComponent.kt
index fe9b476..1469c09 100644
--- a/src/main/kotlin/gui/FirmButtonComponent.kt
+++ b/src/main/kotlin/gui/FirmButtonComponent.kt
@@ -1,4 +1,3 @@
-
package moe.nea.firmament.gui
import io.github.notenoughupdates.moulconfig.common.MyResourceLocation
@@ -11,71 +10,78 @@ import io.github.notenoughupdates.moulconfig.observer.GetSetter
open class FirmButtonComponent(
- child: GuiComponent,
- val isEnabled: GetSetter<Boolean> = GetSetter.constant(true),
- val noBackground: Boolean = false,
- val action: Runnable,
+ child: GuiComponent,
+ val isEnabled: GetSetter<Boolean> = GetSetter.constant(true),
+ val noBackground: Boolean = false,
+ val action: (mouseButton: Int) -> Unit,
) : PanelComponent(child, if (noBackground) 0 else 2, DefaultBackgroundRenderer.TRANSPARENT) {
- /* TODO: make use of vanillas built in nine slicer */
- val hoveredBg =
- NinePatch.builder(MyResourceLocation("minecraft", "textures/gui/sprites/widget/button_highlighted.png"))
- .cornerSize(5)
- .cornerUv(5 / 200F, 5 / 20F)
- .mode(NinePatch.Mode.STRETCHING)
- .build()
- val unhoveredBg = NinePatch.builder(MyResourceLocation("minecraft", "textures/gui/sprites/widget/button.png"))
- .cornerSize(5)
- .cornerUv(5 / 200F, 5 / 20F)
- .mode(NinePatch.Mode.STRETCHING)
- .build()
- val disabledBg =
- NinePatch.builder(MyResourceLocation("minecraft", "textures/gui/sprites/widget/button_disabled.png"))
- .cornerSize(5)
- .cornerUv(5 / 200F, 5 / 20F)
- .mode(NinePatch.Mode.STRETCHING)
- .build()
- val activeBg = NinePatch.builder(MyResourceLocation("firmament", "textures/gui/sprites/widget/button_active.png"))
- .cornerSize(5)
- .cornerUv(5 / 200F, 5 / 20F)
- .mode(NinePatch.Mode.STRETCHING)
- .build()
- var isClicking = false
- override fun mouseEvent(mouseEvent: MouseEvent, context: GuiImmediateContext): Boolean {
- if (!isEnabled.get()) return false
- if (isClicking) {
- if (mouseEvent is MouseEvent.Click && !mouseEvent.mouseState && mouseEvent.mouseButton == 0) {
- isClicking = false
- if (context.isHovered) {
- action.run()
- }
- return true
- }
- }
- if (!context.isHovered) return false
- if (mouseEvent !is MouseEvent.Click) return false
- if (mouseEvent.mouseState && mouseEvent.mouseButton == 0) {
- requestFocus()
- isClicking = true
- return true
- }
- return false
- }
+ constructor(
+ child: GuiComponent,
+ isEnabled: GetSetter<Boolean> = GetSetter.constant(true),
+ noBackground: Boolean = false,
+ action: Runnable,
+ ) : this(child, isEnabled, noBackground, { action.run() })
+
+ /* TODO: make use of vanillas built in nine slicer */
+ val hoveredBg =
+ NinePatch.builder(MyResourceLocation("minecraft", "textures/gui/sprites/widget/button_highlighted.png"))
+ .cornerSize(5)
+ .cornerUv(5 / 200F, 5 / 20F)
+ .mode(NinePatch.Mode.STRETCHING)
+ .build()
+ val unhoveredBg = NinePatch.builder(MyResourceLocation("minecraft", "textures/gui/sprites/widget/button.png"))
+ .cornerSize(5)
+ .cornerUv(5 / 200F, 5 / 20F)
+ .mode(NinePatch.Mode.STRETCHING)
+ .build()
+ val disabledBg =
+ NinePatch.builder(MyResourceLocation("minecraft", "textures/gui/sprites/widget/button_disabled.png"))
+ .cornerSize(5)
+ .cornerUv(5 / 200F, 5 / 20F)
+ .mode(NinePatch.Mode.STRETCHING)
+ .build()
+ val activeBg = NinePatch.builder(MyResourceLocation("firmament", "textures/gui/sprites/widget/button_active.png"))
+ .cornerSize(5)
+ .cornerUv(5 / 200F, 5 / 20F)
+ .mode(NinePatch.Mode.STRETCHING)
+ .build()
+ var isClicking = false
+ override fun mouseEvent(mouseEvent: MouseEvent, context: GuiImmediateContext): Boolean {
+ if (!isEnabled.get()) return false
+ if (isClicking) {
+ if (mouseEvent is MouseEvent.Click && !mouseEvent.mouseState) {
+ isClicking = false
+ if (context.isHovered) {
+ action.invoke(mouseEvent.mouseButton)
+ }
+ return true
+ }
+ }
+ if (!context.isHovered) return false
+ if (mouseEvent !is MouseEvent.Click) return false
+ if (mouseEvent.mouseState) {
+ requestFocus()
+ isClicking = true
+ return true
+ }
+ return false
+ }
- open fun getBackground(context: GuiImmediateContext): NinePatch<MyResourceLocation> =
- if (!isEnabled.get()) disabledBg
- else if (context.isHovered || isClicking) hoveredBg
- else unhoveredBg
+ open fun getBackground(context: GuiImmediateContext): NinePatch<MyResourceLocation> =
+ if (!isEnabled.get()) disabledBg
+ else if (context.isHovered || isClicking) hoveredBg
+ else unhoveredBg
- override fun render(context: GuiImmediateContext) {
- context.renderContext.pushMatrix()
- if (!noBackground)
- context.renderContext.drawNinePatch(
- getBackground(context),
- 0f, 0f, context.width, context.height
- )
- context.renderContext.translate(insets.toFloat(), insets.toFloat())
- element.render(getChildContext(context))
- context.renderContext.popMatrix()
- }
+ override fun render(context: GuiImmediateContext) {
+ context.renderContext.pushMatrix()
+ if (!noBackground)
+ context.renderContext.drawNinePatch(
+ getBackground(context),
+ 0f, 0f, context.width, context.height
+ )
+ context.renderContext.translate(insets.toFloat(), insets.toFloat())
+ element.render(getChildContext(context))
+ context.renderContext.popMatrix()
+ }
}
diff --git a/src/main/kotlin/gui/config/KeyBindingStateManager.kt b/src/main/kotlin/gui/config/KeyBindingStateManager.kt
index 500f0fa..d8ec359 100644
--- a/src/main/kotlin/gui/config/KeyBindingStateManager.kt
+++ b/src/main/kotlin/gui/config/KeyBindingStateManager.kt
@@ -25,11 +25,10 @@ class KeyBindingStateManager(
var lastPressed: GenericInputButton? = null
var label: Text = Text.literal("")
- fun onClick() {
+ fun onClick(mouseButton: Int) {
if (editing) {
- editing = false
- blur()
- } else {
+ keyboardEvent(GenericInputButton.mouse(mouseButton), true)
+ } else if (mouseButton == GLFW.GLFW_MOUSE_BUTTON_LEFT) {
editing = true
requestFocus()
}
@@ -37,8 +36,8 @@ class KeyBindingStateManager(
}
fun keyboardEvent(keyCode: GenericInputButton, pressed: Boolean): Boolean {
- return if (pressed) onKeyPressed(keyCode, InputModifiers.getCurrentModifiers())
- else onKeyReleased(keyCode, InputModifiers.getCurrentModifiers())
+ return if (pressed) onKeyPressed(keyCode, InputModifiers.current())
+ else onKeyReleased(keyCode, InputModifiers.current())
}
fun onKeyPressed(
@@ -91,7 +90,7 @@ class KeyBindingStateManager(
var stroke = value().format()
if (editing) {
stroke = Text.empty()
- val modifiers = InputModifiers.getCurrentModifiers()
+ val modifiers = InputModifiers.current()
if (!modifiers.isEmpty()) {
stroke.append(modifiers.format())
stroke.append(" + ")
@@ -112,11 +111,16 @@ class KeyBindingStateManager(
false,
false
), action = {
- this@KeyBindingStateManager.onClick()
+ this@KeyBindingStateManager.onClick(it)
}) {
override fun keyboardEvent(event: KeyboardEvent, context: GuiImmediateContext): Boolean {
if (event is KeyboardEvent.KeyPressed) {
- return this@KeyBindingStateManager.keyboardEvent(GenericInputButton.ofKeyAndScan(event.keycode, event.scancode), event.pressed)
+ return this@KeyBindingStateManager.keyboardEvent(
+ GenericInputButton.ofKeyAndScan(
+ event.keycode,
+ event.scancode
+ ), event.pressed
+ )
}
return super.keyboardEvent(event, context)
}
diff --git a/src/main/kotlin/keybindings/GenericInputButton.kt b/src/main/kotlin/keybindings/GenericInputButton.kt
index 2d81bd8..53c0e56 100644
--- a/src/main/kotlin/keybindings/GenericInputButton.kt
+++ b/src/main/kotlin/keybindings/GenericInputButton.kt
@@ -1,9 +1,7 @@
package moe.nea.firmament.keybindings
-import com.mojang.serialization.Codec
import org.lwjgl.glfw.GLFW
import kotlinx.serialization.KSerializer
-import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
@@ -67,6 +65,7 @@ sealed interface GenericInputButton {
fun ofScanCode(scanCode: Int): GenericInputButton = ScanCodeButton(scanCode)
fun ofScanCodeFromKeyCode(keyCode: Int): GenericInputButton = ScanCodeButton(GLFW.glfwGetKeyScancode(keyCode))
fun unbound(): GenericInputButton = Unbound
+ fun mouse(mouseButton: Int): GenericInputButton = MouseButton(mouseButton)
fun ofKeyAndScan(keyCode: Int, scanCode: Int): GenericInputButton {
if (keyCode == GLFW.GLFW_KEY_UNKNOWN)
return ofScanCode(scanCode)
@@ -198,7 +197,8 @@ data class InputModifiers(
val modifiers: Int
) {
companion object {
- fun getCurrentModifiers(): InputModifiers {
+ @JvmStatic
+ fun current(): InputModifiers {
val h = MC.window.handle
val ctrl = if (MinecraftClient.IS_SYSTEM_MAC) {
InputUtil.isKeyPressed(h, GLFW.GLFW_KEY_LEFT_SUPER)
diff --git a/src/main/kotlin/keybindings/SavedKeyBinding.kt b/src/main/kotlin/keybindings/SavedKeyBinding.kt
index bc99e03..48716d3 100644
--- a/src/main/kotlin/keybindings/SavedKeyBinding.kt
+++ b/src/main/kotlin/keybindings/SavedKeyBinding.kt
@@ -9,7 +9,7 @@ data class SavedKeyBinding(
val modifiers: InputModifiers,
) {
companion object {
- fun isShiftDown() = InputModifiers.getCurrentModifiers().shift
+ fun isShiftDown() = InputModifiers.current().shift
fun unbound(): SavedKeyBinding = withoutMods(GenericInputButton.unbound())
fun withoutMods(input: GenericInputButton) = SavedKeyBinding(input, InputModifiers.none())
@@ -21,7 +21,7 @@ data class SavedKeyBinding(
fun isPressed(atLeast: Boolean = false): Boolean {
if (!button.isPressed())
return false
- val mods = InputModifiers.getCurrentModifiers()
+ val mods = InputModifiers.current()
return mods.matches(this.modifiers, atLeast)
}