mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-22 19:06:35 +00:00
Fix high load when teleporting and some teleportation weirdness
This commit is contained in:
parent
d3c62988b0
commit
cf222324d6
@ -1852,6 +1852,9 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
|
||||
break;
|
||||
case ProtocolInfo::MOVE_PLAYER_PACKET:
|
||||
if($this->teleportPosition !== null){
|
||||
break;
|
||||
}
|
||||
|
||||
$newPos = new Vector3($packet->x, $packet->y - $this->getEyeHeight(), $packet->z);
|
||||
|
||||
@ -1861,8 +1864,8 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
$this->forceMovement = new Vector3($this->x, $this->y, $this->z);
|
||||
}
|
||||
|
||||
if($this->teleportPosition !== null or ($this->forceMovement instanceof Vector3 and (($dist = $newPos->distanceSquared($this->forceMovement)) > 0.1 or $revert))){
|
||||
$this->sendPosition($this->teleportPosition === null ? $this->forceMovement : $this->teleportPosition, $packet->yaw, $packet->pitch);
|
||||
if($this->forceMovement instanceof Vector3 and (($dist = $newPos->distanceSquared($this->forceMovement)) > 0.1 or $revert)){
|
||||
$this->sendPosition($this->forceMovement, $packet->yaw, $packet->pitch);
|
||||
}else{
|
||||
$packet->yaw %= 360;
|
||||
$packet->pitch %= 360;
|
||||
|
Loading…
x
Reference in New Issue
Block a user