summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/api
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-06-05 22:32:03 +1000
committerGitHub <noreply@github.com>2024-06-05 14:32:03 +0200
commit406eaec8bd9e7ca630d1f79ffe2ddda8493778eb (patch)
tree1a3688b0629a924908476dc4787221596e92a0a4 /src/main/java/at/hannibal2/skyhanni/api
parente61f260fa2a094a43ebe1ab3d3305874dee6b716 (diff)
downloadskyhanni-406eaec8bd9e7ca630d1f79ffe2ddda8493778eb.tar.gz
skyhanni-406eaec8bd9e7ca630d1f79ffe2ddda8493778eb.tar.bz2
skyhanni-406eaec8bd9e7ca630d1f79ffe2ddda8493778eb.zip
Fix: Crash and use less forge events (#1986)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/api')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/api/FmlEventApi.kt23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/api/FmlEventApi.kt b/src/main/java/at/hannibal2/skyhanni/api/FmlEventApi.kt
new file mode 100644
index 000000000..7af401401
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/api/FmlEventApi.kt
@@ -0,0 +1,23 @@
+package at.hannibal2.skyhanni.api
+
+import at.hannibal2.skyhanni.events.entity.EntityEnterWorldEvent
+import at.hannibal2.skyhanni.events.minecraft.ClientDisconnectEvent
+import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
+import net.minecraftforge.event.entity.EntityJoinWorldEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.network.FMLNetworkEvent
+
+@SkyHanniModule
+object FmlEventApi {
+
+ @SubscribeEvent
+ fun onDisconnect(event: FMLNetworkEvent.ClientDisconnectionFromServerEvent) {
+ ClientDisconnectEvent().postAndCatch()
+ }
+
+ // TODO when we have generic events, make this support generics
+ @SubscribeEvent
+ fun onEntityJoinWorld(event: EntityJoinWorldEvent) {
+ EntityEnterWorldEvent(event.entity).postAndCatch()
+ }
+}