From 6d6283b7f3d010c94285c02f32ce7920f0c2647e Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 28 Aug 2017 20:07:04 +0100 Subject: [PATCH] Fixed Player->sendPosition() not working correctly --- src/pocketmine/Player.php | 4 ++-- src/pocketmine/entity/Entity.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index de60b0efc..449e4ecfd 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -1896,7 +1896,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk->entityRuntimeId = $this->id; $pk->playerGamemode = Player::getClientFriendlyGamemode($this->gamemode); - $pk->playerPosition = $this->getOffsetPosition(); + $pk->playerPosition = $this->getOffsetPosition($this); $pk->pitch = $this->pitch; $pk->yaw = $this->yaw; @@ -3693,7 +3693,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk = new MovePlayerPacket(); $pk->entityRuntimeId = $this->getId(); - $pk->position = $this->getOffsetPosition(); + $pk->position = $this->getOffsetPosition($pos); $pk->bodyYaw = $yaw; $pk->pitch = $pitch; $pk->yaw = $yaw; diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 3f50ad84c..b8a86f3b5 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -1202,14 +1202,14 @@ abstract class Entity extends Location implements Metadatable{ } } - public function getOffsetPosition() : Vector3{ - return new Vector3($this->x, $this->y + $this->baseOffset, $this->z); + public function getOffsetPosition(Vector3 $vector3) : Vector3{ + return new Vector3($vector3->x, $vector3->y + $this->baseOffset, $vector3->z); } protected function broadcastMovement(){ $pk = new MoveEntityPacket(); $pk->entityRuntimeId = $this->id; - $pk->position = $this->getOffsetPosition(); + $pk->position = $this->getOffsetPosition($this); $pk->yaw = $this->yaw; $pk->pitch = $this->pitch; $pk->headYaw = $this->yaw; //TODO