From 8318d408b63e9d3f033127443ca5cdae7bfa19b8 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Mon, 19 Oct 2026 09:27:27 +0200 Subject: [PATCH] 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. --- .../SpigotCore_Main/src/de/steamwar/entity/REntity.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/REntity.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/REntity.java index ba849b29..bbab5bbf 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/REntity.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/REntity.java @@ -340,7 +340,7 @@ public class REntity { } 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); } @@ -348,16 +348,14 @@ public class REntity { short x = (short) (diffX * 4096); short y = (short) (diffY * 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 (rotEq) return null; - return new ClientboundMoveEntityPacket.Rot(entityId, pitch, yaw, false); + return new ClientboundMoveEntityPacket.Rot(entityId, yaw, pitch, false); } else if (rotEq) { return new ClientboundMoveEntityPacket.Pos(entityId, x, y, z, false); } else { - return new ClientboundMoveEntityPacket.PosRot(entityId, x, y, z, pitch, yaw, false); + return new ClientboundMoveEntityPacket.PosRot(entityId, x, y, z, yaw, pitch, false); } }