From bcb401c0c352e9993a6b4ae646dd950e78b296f7 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Mon, 23 Jun 2014 16:07:59 +0200 Subject: [PATCH] Added yaw/pitch on spawn --- src/pocketmine/entity/Human.php | 6 ++++-- src/pocketmine/network/protocol/AddMobPacket.php | 4 ++-- src/pocketmine/network/protocol/AddPlayerPacket.php | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/pocketmine/entity/Human.php b/src/pocketmine/entity/Human.php index 5d9f2781c..f0ca19542 100644 --- a/src/pocketmine/entity/Human.php +++ b/src/pocketmine/entity/Human.php @@ -30,6 +30,8 @@ use pocketmine\nbt\tag\Compound; use pocketmine\nbt\tag\Enum; use pocketmine\nbt\tag\Short; use pocketmine\network\protocol\AddPlayerPacket; +use pocketmine\network\protocol\MoveEntityPacket_PosRot; +use pocketmine\network\protocol\MovePlayerPacket; use pocketmine\network\protocol\RemovePlayerPacket; use pocketmine\network\protocol\SetEntityMotionPacket; use pocketmine\Network; @@ -145,8 +147,8 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{ $pk->x = $this->x; $pk->y = $this->y; $pk->z = $this->z; - $pk->yaw = 0; - $pk->pitch = 0; + $pk->yaw = $this->yaw; + $pk->pitch = $this->pitch; $pk->unknown1 = 0; $pk->unknown2 = 0; $pk->metadata = $this->getData(); diff --git a/src/pocketmine/network/protocol/AddMobPacket.php b/src/pocketmine/network/protocol/AddMobPacket.php index a430cda05..448935830 100644 --- a/src/pocketmine/network/protocol/AddMobPacket.php +++ b/src/pocketmine/network/protocol/AddMobPacket.php @@ -48,8 +48,8 @@ class AddMobPacket extends DataPacket{ $this->putFloat($this->x); $this->putFloat($this->y); $this->putFloat($this->z); - $this->putByte($this->yaw); - $this->putByte($this->pitch); + $this->putByte(floor($this->yaw * (256 / 360))); + $this->putByte(floor($this->pitch * (256 / 360))); $this->put(Binary::writeMetadata($this->metadata)); } diff --git a/src/pocketmine/network/protocol/AddPlayerPacket.php b/src/pocketmine/network/protocol/AddPlayerPacket.php index f615e05ef..681e0c9d0 100644 --- a/src/pocketmine/network/protocol/AddPlayerPacket.php +++ b/src/pocketmine/network/protocol/AddPlayerPacket.php @@ -52,8 +52,8 @@ class AddPlayerPacket extends DataPacket{ $this->putFloat($this->x); $this->putFloat($this->y); $this->putFloat($this->z); - $this->putByte($this->yaw); - $this->putByte($this->pitch); + $this->putByte((int) ($this->yaw * (256 / 360))); + $this->putByte((int) ($this->pitch * (256 / 360))); $this->putShort($this->unknown1); $this->putShort($this->unknown2); $this->put(Binary::writeMetadata($this->metadata));