aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/caelo/Caelo.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-03-30 19:44:32 +0100
committerLinnea Gräf <nea@nea.moe>2024-03-30 19:44:32 +0100
commit0414b87e02e51b51cf9ef0c165e5ed61e5193160 (patch)
tree0d1a0144c44b252dcabc2c1d685a7d2b27e6adee /src/main/java/moe/nea/caelo/Caelo.kt
downloadveloxcaelo-0414b87e02e51b51cf9ef0c165e5ed61e5193160.tar.gz
veloxcaelo-0414b87e02e51b51cf9ef0c165e5ed61e5193160.tar.bz2
veloxcaelo-0414b87e02e51b51cf9ef0c165e5ed61e5193160.zip
Initial commit
Diffstat (limited to 'src/main/java/moe/nea/caelo/Caelo.kt')
-rw-r--r--src/main/java/moe/nea/caelo/Caelo.kt44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/caelo/Caelo.kt b/src/main/java/moe/nea/caelo/Caelo.kt
new file mode 100644
index 0000000..76e56bf
--- /dev/null
+++ b/src/main/java/moe/nea/caelo/Caelo.kt
@@ -0,0 +1,44 @@
+package moe.nea.caelo
+
+import moe.nea.caelo.event.NeaTickEvent
+import moe.nea.caelo.init.MixinPlugin
+import moe.nea.caelo.optifine.OptifineCustomItemCache
+import moe.nea.caelo.util.InterModUtil
+import moe.nea.caelo.util.MC
+import net.minecraft.client.Minecraft
+import net.minecraftforge.client.ClientCommandHandler
+import net.minecraftforge.common.MinecraftForge
+import net.minecraftforge.fml.common.Mod
+import net.minecraftforge.fml.common.event.FMLInitializationEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent
+
+@Mod(modid = "veloxcaelo", useMetadata = true)
+class Caelo {
+ @SubscribeEvent
+ fun onTick(tick: ClientTickEvent) {
+ if (tick.phase != TickEvent.Phase.END)
+ return
+ if (Minecraft.getMinecraft().thePlayer == null)
+ return
+ MinecraftForge.EVENT_BUS.post(NeaTickEvent(tickCount++))
+ }
+
+ var tickCount = 0
+
+ @Mod.EventHandler
+ fun onInit(event: FMLInitializationEvent) {
+ if (InterModUtil.isOptifineLoaded) {
+ MinecraftForge.EVENT_BUS.register(OptifineCustomItemCache)
+ }
+ MinecraftForge.EVENT_BUS.register(this)
+ ClientCommandHandler.instance.registerCommand(CaeloCommand)
+ CaeloCommand.subcommand("mixins") { args ->
+ MC.display("Injected mixins:")
+ MixinPlugin.loadedMixinClasses.forEach {
+ MC.display(" - $it")
+ }
+ }
+ }
+} \ No newline at end of file