From 1a7e9169285b386bd59f141295df8d8462c21005 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Fri, 13 Dec 2013 01:17:55 +0100 Subject: [PATCH] Fixed player heads not being rotated --- src/network/CustomPacketHandler.php | 8 ++++---- src/world/Entity.php | 26 ++++++++++++++++++-------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/network/CustomPacketHandler.php b/src/network/CustomPacketHandler.php index f79c959f..c23bc7e4 100644 --- a/src/network/CustomPacketHandler.php +++ b/src/network/CustomPacketHandler.php @@ -388,17 +388,17 @@ class CustomPacketHandler{ $this->data["x"] = Utils::readFloat($this->get(4)); $this->data["y"] = Utils::readFloat($this->get(4)); $this->data["z"] = Utils::readFloat($this->get(4)); - $this->data["bodyYaw"] = Utils::readFloat($this->get(4)); - $this->data["pitch"] = Utils::readFloat($this->get(4)); $this->data["yaw"] = Utils::readFloat($this->get(4)); + $this->data["pitch"] = Utils::readFloat($this->get(4)); + $this->data["bodyYaw"] = Utils::readFloat($this->get(4)); }else{ $this->raw .= Utils::writeInt($this->data["eid"]); $this->raw .= Utils::writeFloat($this->data["x"]); $this->raw .= Utils::writeFloat($this->data["y"]); $this->raw .= Utils::writeFloat($this->data["z"]); - $this->raw .= Utils::writeFloat($this->data["bodyYaw"]); - $this->raw .= Utils::writeFloat($this->data["pitch"]); $this->raw .= Utils::writeFloat($this->data["yaw"]); + $this->raw .= Utils::writeFloat($this->data["pitch"]); + $this->raw .= Utils::writeFloat($this->data["bodyYaw"]); } break; case MC_PLACE_BLOCK: diff --git a/src/world/Entity.php b/src/world/Entity.php index f1fd98ba..cade713d 100644 --- a/src/world/Entity.php +++ b/src/world/Entity.php @@ -565,15 +565,25 @@ class Entity extends Position{ $players = $this->server->api->player->getAll($this->level); if($this->player instanceof Player){ unset($players[$this->player->CID]); + $this->server->api->player->broadcastPacket($players, MC_MOVE_PLAYER, array( + "eid" => $this->eid, + "x" => $this->x, + "y" => $this->y, + "z" => $this->z, + "yaw" => $this->yaw, + "pitch" => $this->pitch, + "bodyYaw" => $this->yaw, + )); + }else{ + $this->server->api->player->broadcastPacket($players, MC_MOVE_ENTITY_POSROT, array( + "eid" => $this->eid, + "x" => $this->x, + "y" => $this->y, + "z" => $this->z, + "yaw" => $this->yaw, + "pitch" => $this->pitch, + )); } - $this->server->api->player->broadcastPacket($players, MC_MOVE_ENTITY_POSROT, array( - "eid" => $this->eid, - "x" => $this->x, - "y" => $this->y, - "z" => $this->z, - "yaw" => $this->yaw, - "pitch" => $this->pitch, - )); } }else{ $this->updatePosition($this->x, $this->y, $this->z, $this->yaw, $this->pitch);