[1.7.10] Fix dead lock and NPE when jumping backwards in replays

The deadlock is a regression due to login phase inclusion.
Not sure about the NPE, it might have always existed.
This commit is contained in:
Jonas Herzig
2019-06-14 14:53:23 +02:00
parent c72392fb62
commit 2a08c11598
3 changed files with 37 additions and 0 deletions

View File

@@ -642,6 +642,12 @@ public class ReplayHandler {
replaySender.setAsyncMode(true); replaySender.setAsyncMode(true);
replaySender.setReplaySpeed(0); replaySender.setReplaySpeed(0);
//#if MC<10800
//$$ while (mc.currentScreen instanceof GuiOpeningReplay) {
//$$ mc.currentScreen.handleInput();
//$$ }
//#endif
mc.getNetworkHandler().getClientConnection() mc.getNetworkHandler().getClientConnection()
//#if MC>=11300 //#if MC>=11300
.tick(); .tick();

View File

@@ -0,0 +1,29 @@
//#if MC<10800
//$$ package com.replaymod.replay.mixin;
//$$
//$$ import com.replaymod.replay.gui.screen.GuiOpeningReplay;
//$$ import cpw.mods.fml.client.FMLClientHandler;
//$$ import net.minecraft.client.Minecraft;
//$$ import net.minecraft.client.gui.GuiScreen;
//$$ 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;
//$$
//$$ @Mixin(value = FMLClientHandler.class, remap = false)
//$$ public class MixinFMLClientHandler {
//$$ // Usually this method is called async and can just block and wait for MC to tick the network manager
//$$ // Since we sometimes call it sync though, we need to take care of ticking ourselves.
//$$ @Inject(method = "waitForPlayClient", at = @At("HEAD"), remap = false)
//$$ private void tickNetworkManager(CallbackInfo ci) {
//$$ Minecraft mc = Minecraft.getMinecraft();
//$$ if (!mc.isCallingFromMinecraftThread()) {
//$$ return;
//$$ }
//$$ GuiScreen gui = mc.currentScreen;
//$$ if (gui instanceof GuiOpeningReplay) {
//$$ gui.handleInput();
//$$ }
//$$ }
//$$ }
//#endif

View File

@@ -26,6 +26,8 @@
//$$ "MixinRenderManager", //$$ "MixinRenderManager",
//#endif //#endif
"MixinViewFrustum", "MixinViewFrustum",
//#else
//$$ "MixinFMLClientHandler",
//#endif //#endif
"MixinKeyboardListener", "MixinKeyboardListener",
"MixinPlayerControllerMP", "MixinPlayerControllerMP",