diff options
author | nea <nea@nea.moe> | 2023-05-16 01:23:43 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-05-16 01:23:43 +0200 |
commit | ead6762eb1c005914b05f9d3c29f334989c67513 (patch) | |
tree | cd1409756be2bc4a93195c31d432fef053afe002 /src/main/java/moe/nea/firmament/mixins/MixinMinecraft.java | |
parent | 96c546cc73880a7c502c17aadda6ca84c847692d (diff) | |
download | Firmament-ead6762eb1c005914b05f9d3c29f334989c67513.tar.gz Firmament-ead6762eb1c005914b05f9d3c29f334989c67513.tar.bz2 Firmament-ead6762eb1c005914b05f9d3c29f334989c67513.zip |
Replace references to NEU with Firmament
Diffstat (limited to 'src/main/java/moe/nea/firmament/mixins/MixinMinecraft.java')
-rw-r--r-- | src/main/java/moe/nea/firmament/mixins/MixinMinecraft.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/MixinMinecraft.java b/src/main/java/moe/nea/firmament/mixins/MixinMinecraft.java new file mode 100644 index 0000000..f2313d7 --- /dev/null +++ b/src/main/java/moe/nea/firmament/mixins/MixinMinecraft.java @@ -0,0 +1,26 @@ +package moe.nea.firmament.mixins; + +import moe.nea.firmament.events.ScreenOpenEvent; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.Screen; +import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(MinecraftClient.class) +public abstract class MixinMinecraft { + @Shadow + @Nullable + public Screen currentScreen; + + @Inject(method = "setScreen", at = @At("HEAD"), cancellable = true) + public void onScreenChange(Screen screen, CallbackInfo ci) { + var event = new ScreenOpenEvent(currentScreen, screen); + if (ScreenOpenEvent.Companion.publish(event).getCancelled()) { + ci.cancel(); + } + } +} |