mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +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) {
|
public void setRotation(float yaw, float pitch) {
|
||||||
- throw new UnsupportedOperationException("Cannot set rotation of players. Consider teleporting instead.");
|
- throw new UnsupportedOperationException("Cannot set rotation of players. Consider teleporting instead.");
|
||||||
+ // Paper start - Teleport API
|
+ // Paper start - Teleport API
|
||||||
+ Location targetLocation = this.getEyeLocation();
|
+ if (this.getHandle().connection == null) return;
|
||||||
+ targetLocation.setYaw(yaw);
|
+ this.getHandle().forceSetRotation(yaw, pitch);
|
||||||
+ targetLocation.setPitch(pitch);
|
+ // Paper end - Teleportation API
|
||||||
+
|
|
||||||
+ 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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue