Fix various NPE while in replay on 1.8.9 or below

Nulling the world and calling runTick proved to be too volatile, so
instead let's try performing an early return from runTick via mixin.
This commit is contained in:
Jonas Herzig
2019-06-14 14:49:54 +02:00
parent 560982a14a
commit c72392fb62
3 changed files with 35 additions and 22 deletions

View File

@@ -67,7 +67,6 @@ public class InputReplayTimer extends WrappedTimer {
}
mc.keyboard.pollDebugCrash();
//#else
//#if MC>=10904
//$$ if (mc.currentScreen != null) {
//#if MC>=10800
//$$ try {
@@ -80,26 +79,24 @@ public class InputReplayTimer extends WrappedTimer {
//#endif
//$$ }
//$$ if (mc.currentScreen == null || mc.currentScreen.allowUserInput) {
//$$ ((MCVer.MinecraftMethodAccessor) mc).replayModRunTickMouse();
//$$ ((MCVer.MinecraftMethodAccessor) mc).replayModRunTickKeyboard();
//#if MC>=10904
//$$ ((MCVer.MinecraftMethodAccessor) mc).replayModRunTickMouse();
//$$ ((MCVer.MinecraftMethodAccessor) mc).replayModRunTickKeyboard();
//#else
//$$ // 1.8.9 and below has one giant tick function, so we try to only do keyboard & mouse as far as possible
//$$ ((MCVer.MinecraftMethodAccessor) mc).replayModSetEarlyReturnFromRunTick(true);
//#if MC>=10800
//$$ try {
//$$ mc.runTick();
//$$ } catch (IOException e) { // *SIGH*
//$$ e.printStackTrace();
//$$ }
//#else
//$$ mc.runTick();
//#endif
//$$ ((MCVer.MinecraftMethodAccessor) mc).replayModSetEarlyReturnFromRunTick(false);
//#endif
//$$ }
//#else
//$$ // 1.8.9 and below has one giant tick function, so we try to only do keyboard & mouse as far as possible
//$$ WorldClient world = mc.theWorld;
//$$ mc.theWorld = null;
//#if MC>=10800
//$$ try {
//$$ mc.runTick();
//$$ } catch (IOException e) { // *SIGH*
//$$ e.printStackTrace();
//$$ }
//#else
//$$ mc.runTick();
//#endif
//$$ if (mc.theWorld == null) {
//$$ mc.theWorld = world;
//$$ }
//#endif
//#endif
}
}