From 0cf3914f5d068ccab3a040ff230b649f0e87b30b Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 17 Jun 2017 12:59:29 +0100 Subject: [PATCH] Player base offset doesn't change with scale, close #943, close #945 --- src/pocketmine/Player.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index cdad023249..8bde1fb120 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -290,6 +290,8 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade protected $stepHeight = 0.6; + protected $baseOffset = 1.62; + public $usedChunks = []; protected $chunkLoadCount = 0; protected $loadQueue = []; @@ -1580,7 +1582,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade if($to->distanceSquared($ev->getTo()) > 0.01){ //If plugins modify the destination $this->teleport($ev->getTo()); }else{ - $this->level->addEntityMovement($this->x >> 4, $this->z >> 4, $this->getId(), $this->x, $this->y + $this->getEyeHeight(), $this->z, $this->yaw, $this->pitch, $this->yaw); + $this->level->addEntityMovement($this->x >> 4, $this->z >> 4, $this->getId(), $this->x, $this->y + $this->baseOffset, $this->z, $this->yaw, $this->pitch, $this->yaw); $distance = $from->distance($to); //TODO: check swimming (adds 0.015 exhaustion in MCPE) @@ -2135,7 +2137,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade } public function handleMovePlayer(MovePlayerPacket $packet) : bool{ - $newPos = new Vector3($packet->x, $packet->y - $this->getEyeHeight(), $packet->z); + $newPos = new Vector3($packet->x, $packet->y - $this->baseOffset, $packet->z); $revert = false; if(!$this->isAlive() or $this->spawned !== true){ @@ -3962,7 +3964,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade $pk = new MovePlayerPacket(); $pk->entityRuntimeId = $this->getId(); $pk->x = $pos->x; - $pk->y = $pos->y + $this->getEyeHeight(); + $pk->y = $pos->y + $this->baseOffset; $pk->z = $pos->z; $pk->bodyYaw = $yaw; $pk->pitch = $pitch;