aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinMinecraft.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinMinecraft.kt')
-rw-r--r--src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinMinecraft.kt19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinMinecraft.kt b/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinMinecraft.kt
new file mode 100644
index 0000000..f017604
--- /dev/null
+++ b/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinMinecraft.kt
@@ -0,0 +1,19 @@
+package moe.nea.notenoughupdates.mixins
+
+import moe.nea.notenoughupdates.events.NEUScreenEvents
+import net.minecraft.client.Minecraft
+import net.minecraft.client.gui.screens.Screen
+import org.spongepowered.asm.mixin.Mixin
+import org.spongepowered.asm.mixin.injection.At
+import org.spongepowered.asm.mixin.injection.Inject
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo
+
+@Suppress("CAST_NEVER_SUCCEEDS")
+@Mixin(Minecraft::class)
+class MixinMinecraft {
+ @Inject(method = ["setScreen"], at = [At("HEAD")], cancellable = true)
+ fun momo(screen: Screen?, ci: CallbackInfo) {
+ if (NEUScreenEvents.SCREEN_OPEN.invoker().onScreenOpen((this as Minecraft).screen, screen))
+ ci.cancel()
+ }
+} \ No newline at end of file