aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin')
-rw-r--r--src/main/kotlin/com/dulkirfabric/DulkirModFabric.kt1
-rw-r--r--src/main/kotlin/com/dulkirfabric/Registrations.kt18
-rw-r--r--src/main/kotlin/com/dulkirfabric/events/ClientTickEvent.kt8
-rw-r--r--src/main/kotlin/com/dulkirfabric/events/ServerTickEvent.kt8
4 files changed, 35 insertions, 0 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/DulkirModFabric.kt b/src/main/kotlin/com/dulkirfabric/DulkirModFabric.kt
index 15b449d..95e3eb2 100644
--- a/src/main/kotlin/com/dulkirfabric/DulkirModFabric.kt
+++ b/src/main/kotlin/com/dulkirfabric/DulkirModFabric.kt
@@ -42,6 +42,7 @@ object DulkirModFabric : ModInitializer {
Registrations.registerEventListeners()
Registrations.registerCommands()
+ Registrations.registerEvents()
DulkirConfig.loadConfig()
}
diff --git a/src/main/kotlin/com/dulkirfabric/Registrations.kt b/src/main/kotlin/com/dulkirfabric/Registrations.kt
index 3068b86..b221971 100644
--- a/src/main/kotlin/com/dulkirfabric/Registrations.kt
+++ b/src/main/kotlin/com/dulkirfabric/Registrations.kt
@@ -3,7 +3,14 @@ package com.dulkirfabric
import com.dulkirfabric.DulkirModFabric.EVENT_BUS
import com.dulkirfabric.commands.ConfigCommand
import com.dulkirfabric.commands.JoinDungeonCommands
+import com.dulkirfabric.events.ClientTickEvent
+import com.dulkirfabric.events.ServerTickEvent
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback
+import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
+import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents
+import net.minecraft.server.MinecraftServer
+import net.minecraft.util.profiling.jfr.event.WorldLoadFinishedEvent
+
/**
* Collection of different mod registration stuff ran on initializing the mod. It is separated for readability
@@ -33,4 +40,15 @@ object Registrations {
fun registerEventListeners() {
EVENT_BUS.subscribe(DulkirModFabric)
}
+
+ fun registerEvents() {
+ // Register Custom Tick events so we can use them like 1.8.9 forge
+ ServerTickEvents.START_SERVER_TICK.register(
+ ServerTickEvents.StartTick { _ -> EVENT_BUS.post(ServerTickEvent.get()) }
+ )
+ ClientTickEvents.START_CLIENT_TICK.register(
+ ClientTickEvents.StartTick { _ -> EVENT_BUS.post(ClientTickEvent.get()) }
+ )
+ // WorldLoadFinishedEvent
+ }
} \ No newline at end of file
diff --git a/src/main/kotlin/com/dulkirfabric/events/ClientTickEvent.kt b/src/main/kotlin/com/dulkirfabric/events/ClientTickEvent.kt
new file mode 100644
index 0000000..f24fdf7
--- /dev/null
+++ b/src/main/kotlin/com/dulkirfabric/events/ClientTickEvent.kt
@@ -0,0 +1,8 @@
+package com.dulkirfabric.events
+
+object ClientTickEvent {
+ @JvmStatic
+ fun get(): ClientTickEvent {
+ return this
+ }
+} \ No newline at end of file
diff --git a/src/main/kotlin/com/dulkirfabric/events/ServerTickEvent.kt b/src/main/kotlin/com/dulkirfabric/events/ServerTickEvent.kt
new file mode 100644
index 0000000..e1f4d21
--- /dev/null
+++ b/src/main/kotlin/com/dulkirfabric/events/ServerTickEvent.kt
@@ -0,0 +1,8 @@
+package com.dulkirfabric.events
+
+object ServerTickEvent {
+ @JvmStatic
+ fun get(): ServerTickEvent {
+ return this
+ }
+} \ No newline at end of file