diff options
Diffstat (limited to 'src/main/kotlin/events/WorldKeyboardEvent.kt')
| -rw-r--r-- | src/main/kotlin/events/WorldKeyboardEvent.kt | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/main/kotlin/events/WorldKeyboardEvent.kt b/src/main/kotlin/events/WorldKeyboardEvent.kt index e8566fd..860db5c 100644 --- a/src/main/kotlin/events/WorldKeyboardEvent.kt +++ b/src/main/kotlin/events/WorldKeyboardEvent.kt @@ -1,18 +1,13 @@ - - package moe.nea.firmament.events -import net.minecraft.client.option.KeyBinding -import moe.nea.firmament.keybindings.IKeyBinding - -data class WorldKeyboardEvent(val keyCode: Int, val scanCode: Int, val modifiers: Int) : FirmamentEvent.Cancellable() { - companion object : FirmamentEventBus<WorldKeyboardEvent>() +import moe.nea.firmament.keybindings.GenericInputAction +import moe.nea.firmament.keybindings.InputModifiers +import moe.nea.firmament.keybindings.SavedKeyBinding - fun matches(keyBinding: KeyBinding): Boolean { - return matches(IKeyBinding.minecraft(keyBinding)) - } +data class WorldKeyboardEvent(val action: GenericInputAction, val modifiers: InputModifiers) : FirmamentEvent.Cancellable() { + fun matches(keyBinding: SavedKeyBinding, atLeast: Boolean = false): Boolean { + return keyBinding.matches(action, modifiers, atLeast) + } - fun matches(keyBinding: IKeyBinding): Boolean { - return keyBinding.matches(keyCode, scanCode, modifiers) - } + companion object : FirmamentEventBus<WorldKeyboardEvent>() } |
