Fixed Player->sendPosition() not working correctly

This commit is contained in:
Dylan K. Taylor 2017-08-28 20:07:04 +01:00
parent a3d21de559
commit 6d6283b7f3
2 changed files with 5 additions and 5 deletions

View File

@ -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;

View File

@ -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