Fix REntity relative move rotation in 1.21

Pass yaw before pitch to ClientboundMoveEntityPacket.Rot/PosRot and stop
converting the already byte-encoded rotation a second time.
This commit is contained in:
2026-10-19 09:27:27 +02:00
parent d14ddc4fab
commit 8318d408b6
@@ -340,7 +340,7 @@ public class REntity {
} }
private Object getTeleportPacket() { private Object getTeleportPacket() {
PositionMoveRotation rot = new PositionMoveRotation(new Vec3(x, y, z), Vec3.ZERO, pitch * 360F / 256F, yaw * 360F / 256F); PositionMoveRotation rot = new PositionMoveRotation(new Vec3(x, y, z), Vec3.ZERO, yaw * 360F / 256F, pitch * 360F / 256F);
return new ClientboundEntityPositionSyncPacket(entityId, rot, false); return new ClientboundEntityPositionSyncPacket(entityId, rot, false);
} }
@@ -348,16 +348,14 @@ public class REntity {
short x = (short) (diffX * 4096); short x = (short) (diffX * 4096);
short y = (short) (diffY * 4096); short y = (short) (diffY * 4096);
short z = (short) (diffZ * 4096); short z = (short) (diffZ * 4096);
byte yaw = (byte) (this.yaw * 256 / 360);
byte pitch = (byte) (this.pitch * 256 / 360);
if (diffX == 0 && diffY == 0 && diffZ == 0) { if (diffX == 0 && diffY == 0 && diffZ == 0) {
if (rotEq) return null; if (rotEq) return null;
return new ClientboundMoveEntityPacket.Rot(entityId, pitch, yaw, false); return new ClientboundMoveEntityPacket.Rot(entityId, yaw, pitch, false);
} else if (rotEq) { } else if (rotEq) {
return new ClientboundMoveEntityPacket.Pos(entityId, x, y, z, false); return new ClientboundMoveEntityPacket.Pos(entityId, x, y, z, false);
} else { } else {
return new ClientboundMoveEntityPacket.PosRot(entityId, x, y, z, pitch, yaw, false); return new ClientboundMoveEntityPacket.PosRot(entityId, x, y, z, yaw, pitch, false);
} }
} }