From 2625eeb7dedb05b524b08721e1267acdcd93e5c1 Mon Sep 17 00:00:00 2001 From: nea Date: Wed, 3 Aug 2022 02:31:05 +0200 Subject: scuffed config screen --- .../moe/nea/notenoughupdates/mixins/MixinMinecraft.kt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinMinecraft.kt (limited to 'src/main/kotlin/moe/nea/notenoughupdates/mixins') 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 -- cgit