From 33ff72b87893d53826c43384a1c65b8d66be2164 Mon Sep 17 00:00:00 2001 From: CrushedPixel Date: Fri, 17 Jul 2015 14:35:58 +0200 Subject: [PATCH] Wait until world has loaded when previewing a Camera Path Clean up unused fields and thus unnecessary methods in ReplayProcess --- .../events/handlers/TickAndRenderListener.java | 4 ++-- .../replaymod/replay/ReplayProcess.java | 18 ++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/main/java/eu/crushedpixel/replaymod/events/handlers/TickAndRenderListener.java b/src/main/java/eu/crushedpixel/replaymod/events/handlers/TickAndRenderListener.java index 4da31f27..c6265fb0 100644 --- a/src/main/java/eu/crushedpixel/replaymod/events/handlers/TickAndRenderListener.java +++ b/src/main/java/eu/crushedpixel/replaymod/events/handlers/TickAndRenderListener.java @@ -52,7 +52,7 @@ public class TickAndRenderListener { }); } - if(ReplayHandler.isInPath()) ReplayProcess.unblockAndTick(false); + if(ReplayHandler.isInPath()) ReplayProcess.tickReplay(false); if(ReplayHandler.isCamera()) mc.setRenderViewEntity(ReplayHandler.getCameraEntity()); if(mc.getRenderViewEntity() != null && (mc.getRenderViewEntity() == mc.thePlayer || !mc.getRenderViewEntity().isEntityAlive()) && ReplayHandler.getCameraEntity() != null && !ReplayHandler.isInPath()) { @@ -71,7 +71,7 @@ public class TickAndRenderListener { if(ReplayHandler.getCameraEntity() != null) ReplayHandler.getCameraEntity().updateMovement(); if(ReplayHandler.isInPath()) { - ReplayProcess.unblockAndTick(true); + ReplayProcess.tickReplay(true); } else onMouseMove(new MouseEvent()); FMLCommonHandler.instance().bus().post(new InputEvent.KeyInputEvent()); diff --git a/src/main/java/eu/crushedpixel/replaymod/replay/ReplayProcess.java b/src/main/java/eu/crushedpixel/replaymod/replay/ReplayProcess.java index 4ad57c85..be9ff86d 100755 --- a/src/main/java/eu/crushedpixel/replaymod/replay/ReplayProcess.java +++ b/src/main/java/eu/crushedpixel/replaymod/replay/ReplayProcess.java @@ -15,6 +15,7 @@ import eu.crushedpixel.replaymod.video.VideoRenderer; import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiErrorScreen; +import net.minecraft.client.renderer.chunk.RenderChunk; import net.minecraft.client.resources.I18n; import net.minecraft.crash.CrashReport; import net.minecraft.util.ReportedException; @@ -42,8 +43,6 @@ public class ReplayProcess { private static VideoRenderer videoRenderer = null; private static boolean isVideoRecording = false; - private static boolean blocked = false; - private static boolean deepBlock = false; private static boolean requestFinish = false; private static boolean firstTime = false; @@ -60,8 +59,6 @@ public class ReplayProcess { calculated = false; requestFinish = false; - blocked = deepBlock = false; - lastRealTime = System.currentTimeMillis(); lastRealReplayTime = 0; linear = ReplayMod.replaySettings.isLinearMovement(); @@ -145,12 +142,6 @@ public class ReplayProcess { ReplayMod.replaySender.setReplaySpeed(0); } - public static void unblockAndTick(boolean justCheck) { - if(!deepBlock) blocked = false; - if(!blocked || !isVideoRecording()) - ReplayProcess.tickReplay(justCheck); - } - //if justCheck is true, no Screenshot will be taken, it will only be checked //whether all chunks have been rendered. This is necessary because no Render ticks //are called if the Timer speed is set to 0, leading to this method never being @@ -165,6 +156,13 @@ public class ReplayProcess { } if(firstTime) { + if(RenderChunk.renderChunksUpdated != 0 || mc.currentScreen != null) { + return; + } + + lastRealTime = System.currentTimeMillis(); + lastRealReplayTime = 0; + firstTime = false; mc.timer.renderPartialTicks = 100; mc.timer.elapsedPartialTicks = 100;