Fix high load when teleporting and some teleportation weirdness

This commit is contained in:
Dylan K. Taylor 2016-11-01 14:52:59 +00:00
parent d3c62988b0
commit cf222324d6

View File

@ -1852,6 +1852,9 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
break; break;
case ProtocolInfo::MOVE_PLAYER_PACKET: case ProtocolInfo::MOVE_PLAYER_PACKET:
if($this->teleportPosition !== null){
break;
}
$newPos = new Vector3($packet->x, $packet->y - $this->getEyeHeight(), $packet->z); $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); $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))){ if($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); $this->sendPosition($this->forceMovement, $packet->yaw, $packet->pitch);
}else{ }else{
$packet->yaw %= 360; $packet->yaw %= 360;
$packet->pitch %= 360; $packet->pitch %= 360;