subframe tick interpollation fix

This commit is contained in:
2026-07-09 06:20:51 +04:00
parent 088fb3bb30
commit 4fce67a560

View File

@@ -16,6 +16,9 @@ import com.replaymod.replay.ReplayModReplay;
import com.replaymod.replaystudio.pathing.path.Timeline;
import com.replaymod.simplepathing.SPTimeline;
import com.replaymod.core.mixin.MinecraftAccessor;
import com.replaymod.pathing.player.ReplayTimer;
import org.apache.commons.lang3.tuple.Triple;
import java.util.Collections;
@@ -111,6 +114,7 @@ public class RealLensOpenGlFrameCapturer
private final Timeline timeline;
private final ReplayHandler replayHandler;
private final AccumulationBuffer accum = new AccumulationBuffer();
private long lastConsumedTime = -1;
public RealLensOpenGlFrameCapturer(
WorldRenderer worldRenderer,
@@ -160,6 +164,16 @@ public class RealLensOpenGlFrameCapturer
tSub = (long) (frameId * dt);
}
long replayTime = replayHandler.getReplaySender().currentTimeStamp();
if (lastConsumedTime < 0) lastConsumedTime = replayTime;
int pendingTicks = (int) (replayTime / 50L - lastConsumedTime / 50L);
if (pendingTicks > 0) {
ReplayTimer timer = (ReplayTimer) ((MinecraftAccessor) mc).getTimer();
while (pendingTicks-- > 0) {
mc.tick(); // двигает prev/cur частиц через границу тика
timer.tickDelta -= 1f; // компенсация: VideoRenderer не должен тикнуть повторно
}
}
if (replayTime > lastConsumedTime) lastConsumedTime = replayTime;
float subPartialTicks = (float) ((replayTime % 50L) / 50.0);
float focal = positionPath.getValue(LensProperties.FOCAL_DISTANCE, tSub).map(Triple::getLeft).orElse(5.0f);