Use cloned EditorState when exporting

This commit is contained in:
Moulberry committed 2024-08-25 05:37:20 +08:00
1 parent 6579039ba8
commit 149b14e7d8
2 files changed
+6 -7

No files matched your search

@@ -185,8 +185,6 @@ public class ExportJob {
this.renderStartTime = System.currentTimeMillis();
EditorState editorState = EditorStateManager.get(replayServer.getMetadata().replayIdentifier);
double lastTickDouble = 0;
for (int tickIndex = 0; tickIndex < ticks.size(); tickIndex++) {
@@ -246,7 +244,7 @@ public class ExportJob {
this.tryUnfreezeClient();
KeyframeHandler keyframeHandler = new MinecraftKeyframeHandler(Minecraft.getInstance());
editorState.applyKeyframes(keyframeHandler, (float)(this.settings.startTick() + currentTickDouble));
this.settings.editorState().applyKeyframes(keyframeHandler, (float)(this.settings.startTick() + currentTickDouble));
boolean asyncFrameCapture = !IrisApiWrapper.isIrisAvailable() || !IrisApiWrapper.isShaderPackInUse();
@@ -391,8 +389,7 @@ public class ExportJob {
player.moveTo(position.x, position.y, position.z, this.settings.initialCameraYaw(), this.settings.initialCameraPitch());
player.setDeltaMovement(Vec3.ZERO);
}
EditorState editorState = EditorStateManager.get(replayServer.getMetadata().replayIdentifier);
editorState.applyKeyframes(new MinecraftKeyframeHandler(Minecraft.getInstance()), this.settings.startTick());
this.settings.editorState().applyKeyframes(new MinecraftKeyframeHandler(Minecraft.getInstance()), this.settings.startTick());
this.runClientTick();
// Ensured replay server is paused at startTick
@@ -582,6 +582,9 @@ public class ReplayServer extends IntegratedServer {
}
public EditorState getEditorState() {
if (Flashback.isExporting()) {
return Flashback.EXPORT_JOB.getSettings().editorState();
}
return EditorStateManager.get(this.metadata.replayIdentifier);
}
@@ -691,8 +694,7 @@ public class ReplayServer extends IntegratedServer {
boolean forceApplyKeyframes = this.forceApplyKeyframes.compareAndSet(true, false) && Flashback.EXPORT_JOB == null;
if (!this.replayPaused || forceApplyKeyframes) {
this.desiredTickRate = 20.0f;
EditorState editorState = EditorStateManager.get(this.metadata.replayIdentifier);
editorState.applyKeyframes(new ReplayServerKeyframeHandler(this), this.targetTick);
this.getEditorState().applyKeyframes(new ReplayServerKeyframeHandler(this), this.targetTick);
if (forceApplyKeyframes) {
((MinecraftExt)Minecraft.getInstance()).flashback$applyKeyframes();