Revert "Fix spectator hand jumping when rotating across 0 yaw boundary" (fixes #601)

This reverts commit 411eaa4ca8.

The given solution does not work in old versions because those did not use
`getYaw` for hand rendering. Even worse, their headYaw does wrap around and it
does it in a different way than their yaw value, giving a worse result than
without this commit.
This commit is contained in:
Jonas Herzig
2021-12-07 15:06:58 +01:00
parent 29ef38213f
commit 51aa07e01e

View File

@@ -22,7 +22,6 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.mob.MobEntity; import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.decoration.ItemFrameEntity; import net.minecraft.entity.decoration.ItemFrameEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@@ -249,14 +248,6 @@ public class CameraEntity
this.lastRenderX = to.lastRenderX; this.lastRenderX = to.lastRenderX;
this.lastRenderY = to.lastRenderY + yOffset; this.lastRenderY = to.lastRenderY + yOffset;
this.lastRenderZ = to.lastRenderZ; this.lastRenderZ = to.lastRenderZ;
if (to instanceof LivingEntity) {
LivingEntity toLiving = (LivingEntity) to;
this.headYaw = toLiving.headYaw;
this.prevHeadYaw = toLiving.prevHeadYaw;
} else {
this.headYaw = to.yaw;
this.prevHeadYaw = to.prevYaw;
}
updateBoundingBox(); updateBoundingBox();
} }
@@ -265,7 +256,7 @@ public class CameraEntity
public float getYaw(float tickDelta) { public float getYaw(float tickDelta) {
Entity view = this.client.getCameraEntity(); Entity view = this.client.getCameraEntity();
if (view != null && view != this) { if (view != null && view != this) {
return this.prevHeadYaw + (this.headYaw - this.prevHeadYaw) * tickDelta; return this.prevYaw + (this.yaw - this.prevYaw) * tickDelta;
} }
return super.getYaw(tickDelta); return super.getYaw(tickDelta);
} }
@@ -712,7 +703,7 @@ public class CameraEntity
this.lastRenderYaw = this.renderYaw; this.lastRenderYaw = this.renderYaw;
this.lastRenderPitch = this.renderPitch; this.lastRenderPitch = this.renderPitch;
this.renderPitch = this.renderPitch + (this.pitch - this.renderPitch) * 0.5f; this.renderPitch = this.renderPitch + (this.pitch - this.renderPitch) * 0.5f;
this.renderYaw = this.renderYaw + (this.headYaw - this.renderYaw) * 0.5f; this.renderYaw = this.renderYaw + (this.yaw - this.renderYaw) * 0.5f;
} }
public boolean canSpectate(Entity e) { public boolean canSpectate(Entity e) {