diff options
author | nea <romangraef@gmail.com> | 2022-09-10 03:48:03 +0200 |
---|---|---|
committer | nea <romangraef@gmail.com> | 2022-09-10 03:48:03 +0200 |
commit | ec66c82198fe2d61d699d553c1254f08b43fcc65 (patch) | |
tree | b5d4efaf5d6d6699357c3afb1d6920d89d51b3b8 /src/main/kotlin/moe/nea/notenoughupdates/mixins | |
parent | d9353ff54c20a08e4e078e0190fc1f364b08a2d1 (diff) | |
download | firmament-ec66c82198fe2d61d699d553c1254f08b43fcc65.tar.gz firmament-ec66c82198fe2d61d699d553c1254f08b43fcc65.tar.bz2 firmament-ec66c82198fe2d61d699d553c1254f08b43fcc65.zip |
Move Eventhandling around.
I still want to use fabric still "array backed" events, but these here are just a bit easier to use from kotlin.
Diffstat (limited to 'src/main/kotlin/moe/nea/notenoughupdates/mixins')
-rw-r--r-- | src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinMinecraft.kt | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinMinecraft.kt b/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinMinecraft.kt index 21834e9..3bc1a5f 100644 --- a/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinMinecraft.kt +++ b/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinMinecraft.kt @@ -1,19 +1,20 @@ package moe.nea.notenoughupdates.mixins -import moe.nea.notenoughupdates.events.NEUScreenEvents -import net.minecraft.client.MinecraftClient -import net.minecraft.client.gui.screen.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 +import net.minecraft.client.MinecraftClient +import net.minecraft.client.gui.screen.Screen +import moe.nea.notenoughupdates.events.ScreenOpenEvent @Suppress("CAST_NEVER_SUCCEEDS") @Mixin(MinecraftClient::class) class MixinMinecraft { @Inject(method = ["setScreen"], at = [At("HEAD")], cancellable = true) fun onScreenChange(screen: Screen?, ci: CallbackInfo) { - if (NEUScreenEvents.SCREEN_OPEN.invoker().onScreenOpen((this as MinecraftClient).currentScreen, screen)) + val event = ScreenOpenEvent((this as MinecraftClient).currentScreen, screen) + if (ScreenOpenEvent.publish(event).cancelled) ci.cancel() } } |