From 6428416bc49229e80f2701288032203a41f27d8a Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Tue, 17 Aug 2021 19:07:55 +0200 Subject: [PATCH] Fix between-ticks position of hand when spectating (fixes #563) --- .../replaymod/replay/camera/CameraEntity.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/com/replaymod/replay/camera/CameraEntity.java b/src/main/java/com/replaymod/replay/camera/CameraEntity.java index 8cf54d2d..bb00ae1e 100644 --- a/src/main/java/com/replaymod/replay/camera/CameraEntity.java +++ b/src/main/java/com/replaymod/replay/camera/CameraEntity.java @@ -251,6 +251,26 @@ public class CameraEntity updateBoundingBox(); } + //#if MC>=11400 + @Override + public float getYaw(float tickDelta) { + Entity view = this.client.getCameraEntity(); + if (view != null && view != this) { + return this.prevYaw + (this.yaw - this.prevYaw) * tickDelta; + } + return super.getYaw(tickDelta); + } + + @Override + public float getPitch(float tickDelta) { + Entity view = this.client.getCameraEntity(); + if (view != null && view != this) { + return this.prevPitch + (this.pitch - this.prevPitch) * tickDelta; + } + return super.getPitch(tickDelta); + } + //#endif + private void updateBoundingBox() { //#if MC>=11400 float width = getWidth();