-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make loading screen patch skip chunk waiting
We do actually need to wait for some other information from the server before closing the screen.
- Loading branch information
1 parent
c77e782
commit 63f4fea
Showing
3 changed files
with
15 additions
and
16 deletions.
There are no files selected for viewing
23 changes: 9 additions & 14 deletions
23
...ing_screen/ReceivingLevelScreenMixin.java → ...g_screen/LevelLoadStatusManagerMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,33 @@ | ||
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 net.minecraft.client.multiplayer.LevelLoadStatusManager; | ||
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 { | ||
@Mixin(LevelLoadStatusManager.class) | ||
public abstract class LevelLoadStatusManagerMixin { | ||
|
||
@Shadow | ||
public abstract void onClose(); | ||
|
||
protected ReceivingLevelScreenMixin(Component component) { | ||
super(component); | ||
} | ||
private LevelLoadStatusManager.Status status; | ||
|
||
/** | ||
* @reason Close the loading screen immediately | ||
* @author Spottedleaf | ||
*/ | ||
@Inject( | ||
method = "tick", | ||
method = "loadingPacketsReceived", | ||
cancellable = true, | ||
at = @At( | ||
value = "HEAD" | ||
) | ||
) | ||
private void immediatelyClose(final CallbackInfo ci) { | ||
this.onClose(); | ||
ci.cancel(); | ||
if (this.status == LevelLoadStatusManager.Status.WAITING_FOR_SERVER) { | ||
this.status = LevelLoadStatusManager.Status.LEVEL_READY; | ||
ci.cancel(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters