diff options
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/events')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/events/HandledScreenKeyPressedEvent.kt | 8 | ||||
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/events/TooltipEvent.kt | 15 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/events/HandledScreenKeyPressedEvent.kt b/src/main/kotlin/moe/nea/firmament/events/HandledScreenKeyPressedEvent.kt index 8d19f7e..3c19aa7 100644 --- a/src/main/kotlin/moe/nea/firmament/events/HandledScreenKeyPressedEvent.kt +++ b/src/main/kotlin/moe/nea/firmament/events/HandledScreenKeyPressedEvent.kt @@ -19,10 +19,16 @@ package moe.nea.firmament.events import net.minecraft.client.option.KeyBinding +import moe.nea.firmament.keybindings.IKeyBinding data class HandledScreenKeyPressedEvent(val keyCode: Int, val scanCode: Int, val modifiers: Int) : FirmamentEvent.Cancellable() { companion object : FirmamentEventBus<HandledScreenKeyPressedEvent>() + fun matches(keyBinding: KeyBinding): Boolean { - return keyBinding.matchesKey(keyCode, scanCode) + return matches(IKeyBinding.minecraft(keyBinding)) + } + + fun matches(keyBinding: IKeyBinding): Boolean { + return keyBinding.matches(keyCode, scanCode, modifiers) } } diff --git a/src/main/kotlin/moe/nea/firmament/events/TooltipEvent.kt b/src/main/kotlin/moe/nea/firmament/events/TooltipEvent.kt new file mode 100644 index 0000000..3341534 --- /dev/null +++ b/src/main/kotlin/moe/nea/firmament/events/TooltipEvent.kt @@ -0,0 +1,15 @@ +package moe.nea.firmament.events + +import net.minecraft.client.gui.tooltip.Tooltip +import net.minecraft.client.item.TooltipContext +import net.minecraft.entity.player.PlayerEntity +import net.minecraft.item.ItemStack + +data class TooltipEvent( + val itemStack: ItemStack, + val tooltip: Tooltip, + val tooltipContext: TooltipContext, + val player: PlayerEntity? +) : FirmamentEvent() { + companion object : FirmamentEventBus<TooltipEvent>() +} |