diff --git a/src/main/java/ca/spottedleaf/moonrise/mixin/loading_screen/ReceivingLevelScreenMixin.java b/src/main/java/ca/spottedleaf/moonrise/mixin/loading_screen/ReceivingLevelScreenMixin.java new file mode 100644 index 00000000..829a9241 --- /dev/null +++ b/src/main/java/ca/spottedleaf/moonrise/mixin/loading_screen/ReceivingLevelScreenMixin.java @@ -0,0 +1,38 @@ +package ca.spottedleaf.moonrise.mixin.loading_screen; + +import net.minecraft.client.gui.screens.ReceivingLevelScreen; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.network.chat.Component; +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(ReceivingLevelScreen.class) +public abstract class ReceivingLevelScreenMixin extends Screen { + + @Shadow + public abstract void onClose(); + + protected ReceivingLevelScreenMixin(Component component) { + super(component); + } + + /** + * @reason Close the loading screen immediately + * @author Spottedleaf + */ + @Inject( + method = "tick", + cancellable = true, + at = @At( + value = "HEAD" + ) + ) + private void immediatelyClose(final CallbackInfo ci) { + this.onClose(); + ci.cancel(); + } + +} diff --git a/src/main/resources/moonrise.mixins.json b/src/main/resources/moonrise.mixins.json index d34979be..eb4848e8 100644 --- a/src/main/resources/moonrise.mixins.json +++ b/src/main/resources/moonrise.mixins.json @@ -114,6 +114,7 @@ "chunk_system.OptionsMixin", "collisions.LiquidBlockRendererMixin", "collisions.ParticleMixin", + "loading_screen.ReceivingLevelScreenMixin", "render.SectionRenderDispatcherMixin", "serverlist.ClientConnectionMixin", "serverlist.ServerAddressResolverMixin",