Skip to content

Commit

Permalink
Disable loading screen
Browse files Browse the repository at this point in the history
This will let users load worlds slightly faster.
  • Loading branch information
Spottedleaf committed Jul 29, 2024
1 parent 3351f9d commit 8faded3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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();
}

}
1 change: 1 addition & 0 deletions src/main/resources/moonrise.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
"chunk_system.OptionsMixin",
"collisions.LiquidBlockRendererMixin",
"collisions.ParticleMixin",
"loading_screen.ReceivingLevelScreenMixin",
"render.SectionRenderDispatcherMixin",
"serverlist.ClientConnectionMixin",
"serverlist.ServerAddressResolverMixin",
Expand Down

0 comments on commit 8faded3

Please sign in to comment.