aboutsummaryrefslogtreecommitdiff
path: root/mod/src/main/kotlin/moe/nea/ledger/events
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-01-08 19:25:29 +0100
committerLinnea Gräf <nea@nea.moe>2025-01-08 19:25:29 +0100
commitd1e16a47819509ed645bb93e1a173e0a97025cef (patch)
treeefbe886d9ac1ab4ea01788cb4842812fd0af9079 /mod/src/main/kotlin/moe/nea/ledger/events
parentf694daf322bbb4ff530a9332547c5c8337c3e0c0 (diff)
downloadLocalTransactionLedger-d1e16a47819509ed645bb93e1a173e0a97025cef.tar.gz
LocalTransactionLedger-d1e16a47819509ed645bb93e1a173e0a97025cef.tar.bz2
LocalTransactionLedger-d1e16a47819509ed645bb93e1a173e0a97025cef.zip
build: Move mod to subproject
Diffstat (limited to 'mod/src/main/kotlin/moe/nea/ledger/events')
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/events/BeforeGuiAction.kt11
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/events/ChatReceived.kt15
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/events/ExtraSupplyIdEvent.kt12
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/events/GuiClickEvent.kt9
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/events/InitializationComplete.kt6
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/events/RegistrationFinishedEvent.kt7
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/events/SupplyDebugInfo.kt10
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/events/TriggerEvent.kt7
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/events/WorldLoadEvent.kt5
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/events/WorldSwitchEvent.kt6
10 files changed, 88 insertions, 0 deletions
diff --git a/mod/src/main/kotlin/moe/nea/ledger/events/BeforeGuiAction.kt b/mod/src/main/kotlin/moe/nea/ledger/events/BeforeGuiAction.kt
new file mode 100644
index 0000000..098912a
--- /dev/null
+++ b/mod/src/main/kotlin/moe/nea/ledger/events/BeforeGuiAction.kt
@@ -0,0 +1,11 @@
+package moe.nea.ledger.events
+
+import net.minecraft.client.gui.GuiScreen
+import net.minecraft.client.gui.inventory.GuiChest
+import net.minecraft.inventory.ContainerChest
+import net.minecraftforge.fml.common.eventhandler.Event
+
+data class BeforeGuiAction(val gui: GuiScreen) : Event() {
+ val chest = gui as? GuiChest
+ val chestSlots = chest?.inventorySlots as ContainerChest?
+}
diff --git a/mod/src/main/kotlin/moe/nea/ledger/events/ChatReceived.kt b/mod/src/main/kotlin/moe/nea/ledger/events/ChatReceived.kt
new file mode 100644
index 0000000..a352c27
--- /dev/null
+++ b/mod/src/main/kotlin/moe/nea/ledger/events/ChatReceived.kt
@@ -0,0 +1,15 @@
+package moe.nea.ledger.events
+
+import moe.nea.ledger.unformattedString
+import net.minecraftforge.client.event.ClientChatReceivedEvent
+import net.minecraftforge.fml.common.eventhandler.Event
+import java.time.Instant
+
+data class ChatReceived(
+ val message: String,
+ val timestamp: Instant = Instant.now()
+) : Event() {
+ constructor(event: ClientChatReceivedEvent) : this(
+ event.message.unformattedText.unformattedString().trimEnd()
+ )
+} \ No newline at end of file
diff --git a/mod/src/main/kotlin/moe/nea/ledger/events/ExtraSupplyIdEvent.kt b/mod/src/main/kotlin/moe/nea/ledger/events/ExtraSupplyIdEvent.kt
new file mode 100644
index 0000000..d040961
--- /dev/null
+++ b/mod/src/main/kotlin/moe/nea/ledger/events/ExtraSupplyIdEvent.kt
@@ -0,0 +1,12 @@
+package moe.nea.ledger.events
+
+import moe.nea.ledger.ItemId
+import net.minecraftforge.fml.common.eventhandler.Event
+
+class ExtraSupplyIdEvent(
+ private val store: (String, ItemId) -> Unit
+) : Event() {
+ fun store(name: String, id: ItemId) {
+ store.invoke(name, id)
+ }
+}
diff --git a/mod/src/main/kotlin/moe/nea/ledger/events/GuiClickEvent.kt b/mod/src/main/kotlin/moe/nea/ledger/events/GuiClickEvent.kt
new file mode 100644
index 0000000..9e057dd
--- /dev/null
+++ b/mod/src/main/kotlin/moe/nea/ledger/events/GuiClickEvent.kt
@@ -0,0 +1,9 @@
+package moe.nea.ledger.events
+
+import net.minecraft.inventory.Slot
+import net.minecraftforge.fml.common.eventhandler.Event
+
+data class GuiClickEvent(
+ val slotIn: Slot?, val slotId: Int, val clickedButton: Int, val clickType: Int
+) : Event() {
+} \ No newline at end of file
diff --git a/mod/src/main/kotlin/moe/nea/ledger/events/InitializationComplete.kt b/mod/src/main/kotlin/moe/nea/ledger/events/InitializationComplete.kt
new file mode 100644
index 0000000..d917039
--- /dev/null
+++ b/mod/src/main/kotlin/moe/nea/ledger/events/InitializationComplete.kt
@@ -0,0 +1,6 @@
+package moe.nea.ledger.events
+
+import net.minecraftforge.fml.common.eventhandler.Event
+
+class InitializationComplete : Event() {
+} \ No newline at end of file
diff --git a/mod/src/main/kotlin/moe/nea/ledger/events/RegistrationFinishedEvent.kt b/mod/src/main/kotlin/moe/nea/ledger/events/RegistrationFinishedEvent.kt
new file mode 100644
index 0000000..d36e0c7
--- /dev/null
+++ b/mod/src/main/kotlin/moe/nea/ledger/events/RegistrationFinishedEvent.kt
@@ -0,0 +1,7 @@
+package moe.nea.ledger.events
+
+import net.minecraftforge.fml.common.eventhandler.Event
+
+class RegistrationFinishedEvent : Event() {
+
+}
diff --git a/mod/src/main/kotlin/moe/nea/ledger/events/SupplyDebugInfo.kt b/mod/src/main/kotlin/moe/nea/ledger/events/SupplyDebugInfo.kt
new file mode 100644
index 0000000..cab0a20
--- /dev/null
+++ b/mod/src/main/kotlin/moe/nea/ledger/events/SupplyDebugInfo.kt
@@ -0,0 +1,10 @@
+package moe.nea.ledger.events
+
+import net.minecraftforge.fml.common.eventhandler.Event
+
+class SupplyDebugInfo : Event() { // TODO: collect this in the event recorder
+ val data = mutableListOf<Pair<String, Any>>()
+ fun record(key: String, value: Any) {
+ data.add(key to value)
+ }
+} \ No newline at end of file
diff --git a/mod/src/main/kotlin/moe/nea/ledger/events/TriggerEvent.kt b/mod/src/main/kotlin/moe/nea/ledger/events/TriggerEvent.kt
new file mode 100644
index 0000000..3751f43
--- /dev/null
+++ b/mod/src/main/kotlin/moe/nea/ledger/events/TriggerEvent.kt
@@ -0,0 +1,7 @@
+package moe.nea.ledger.events
+
+import net.minecraftforge.fml.common.eventhandler.Cancelable
+import net.minecraftforge.fml.common.eventhandler.Event
+
+@Cancelable
+data class TriggerEvent(val action: String) : Event()
diff --git a/mod/src/main/kotlin/moe/nea/ledger/events/WorldLoadEvent.kt b/mod/src/main/kotlin/moe/nea/ledger/events/WorldLoadEvent.kt
new file mode 100644
index 0000000..d60f3a4
--- /dev/null
+++ b/mod/src/main/kotlin/moe/nea/ledger/events/WorldLoadEvent.kt
@@ -0,0 +1,5 @@
+package moe.nea.ledger.events
+
+import net.minecraftforge.fml.common.eventhandler.Event
+
+class LateWorldLoadEvent : Event()
diff --git a/mod/src/main/kotlin/moe/nea/ledger/events/WorldSwitchEvent.kt b/mod/src/main/kotlin/moe/nea/ledger/events/WorldSwitchEvent.kt
new file mode 100644
index 0000000..22a97f7
--- /dev/null
+++ b/mod/src/main/kotlin/moe/nea/ledger/events/WorldSwitchEvent.kt
@@ -0,0 +1,6 @@
+package moe.nea.ledger.events
+
+import net.minecraftforge.fml.common.eventhandler.Event
+
+class WorldSwitchEvent : Event() {
+} \ No newline at end of file