From 303d82e48cca60df255c3c0468bd261f7f4a171a Mon Sep 17 00:00:00 2001 From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Date: Mon, 28 Oct 2024 12:14:00 -0400 Subject: [PATCH] Use new ClientboundPlayerRotationPacket for setting player rotation --- patches/server/More-Teleport-API.patch | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/patches/server/More-Teleport-API.patch b/patches/server/More-Teleport-API.patch index bb2235faa3..88bcf406f6 100644 --- a/patches/server/More-Teleport-API.patch +++ b/patches/server/More-Teleport-API.patch @@ -121,15 +121,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void setRotation(float yaw, float pitch) { - throw new UnsupportedOperationException("Cannot set rotation of players. Consider teleporting instead."); + // Paper start - Teleport API -+ Location targetLocation = this.getEyeLocation(); -+ targetLocation.setYaw(yaw); -+ targetLocation.setPitch(pitch); -+ -+ org.bukkit.util.Vector direction = targetLocation.getDirection(); -+ direction.multiply(9999999); // We need to move the target block.. FAR out -+ targetLocation.add(direction); -+ this.lookAt(targetLocation, io.papermc.paper.entity.LookAnchor.EYES); -+ // Paper end ++ if (this.getHandle().connection == null) return; ++ this.getHandle().forceSetRotation(yaw, pitch); ++ // Paper end - Teleportation API } @Override