mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-26 14:30:17 +01:00
Use new ClientboundPlayerRotationPacket for setting player rotation
This commit is contained in:
parent
5364f9e7a0
commit
303d82e48c
1 changed files with 3 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue