aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/events
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-06-14 18:34:40 +0200
committerLinnea Gräf <nea@nea.moe>2024-06-14 18:34:40 +0200
commite4bd69a0569b4ccc49b9e4b89998220bf4bfe25a (patch)
tree2cb89c55c9c63cbb115cfeaff1848f301c9a461c /src/main/kotlin/moe/nea/firmament/events
parentcd1826a49822e7be0fb583e7b540270560fb657d (diff)
downloadfirmament-e4bd69a0569b4ccc49b9e4b89998220bf4bfe25a.tar.gz
firmament-e4bd69a0569b4ccc49b9e4b89998220bf4bfe25a.tar.bz2
firmament-e4bd69a0569b4ccc49b9e4b89998220bf4bfe25a.zip
Add shiny pig tracker
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/events')
-rw-r--r--src/main/kotlin/moe/nea/firmament/events/EntityDespawnEvent.kt16
-rw-r--r--src/main/kotlin/moe/nea/firmament/events/EntityInteractionEvent.kt34
2 files changed, 50 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/events/EntityDespawnEvent.kt b/src/main/kotlin/moe/nea/firmament/events/EntityDespawnEvent.kt
new file mode 100644
index 0000000..c744729
--- /dev/null
+++ b/src/main/kotlin/moe/nea/firmament/events/EntityDespawnEvent.kt
@@ -0,0 +1,16 @@
+/*
+ * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+package moe.nea.firmament.events
+
+import net.minecraft.entity.Entity
+
+data class EntityDespawnEvent(
+ val entity: Entity?, val entityId: Int,
+ val reason: Entity.RemovalReason,
+) : FirmamentEvent() {
+ companion object: FirmamentEventBus<EntityDespawnEvent>()
+}
diff --git a/src/main/kotlin/moe/nea/firmament/events/EntityInteractionEvent.kt b/src/main/kotlin/moe/nea/firmament/events/EntityInteractionEvent.kt
new file mode 100644
index 0000000..fe16868
--- /dev/null
+++ b/src/main/kotlin/moe/nea/firmament/events/EntityInteractionEvent.kt
@@ -0,0 +1,34 @@
+/*
+ * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+package moe.nea.firmament.events
+
+import net.minecraft.entity.Entity
+import net.minecraft.util.Hand
+
+data class EntityInteractionEvent(
+ val kind: InteractionKind,
+ val entity: Entity,
+ val hand: Hand,
+) : FirmamentEvent() {
+ companion object : FirmamentEventBus<EntityInteractionEvent>()
+ enum class InteractionKind {
+ /**
+ * Is sent when left-clicking an entity
+ */
+ ATTACK,
+
+ /**
+ * Is a fallback when [INTERACT_AT_LOCATION] fails
+ */
+ INTERACT,
+
+ /**
+ * Is tried first on right click
+ */
+ INTERACT_AT_LOCATION,
+ }
+}