From cd135b39ad059e6155f73559f4b4bbe0ffc30142 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Thu, 27 Nov 2014 13:59:32 +0100 Subject: [PATCH] Improved player spawn item in hand sending --- src/pocketmine/entity/Human.php | 7 +++---- src/pocketmine/network/protocol/AddPlayerPacket.php | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/pocketmine/entity/Human.php b/src/pocketmine/entity/Human.php index 60d79ddbd..eab288609 100644 --- a/src/pocketmine/entity/Human.php +++ b/src/pocketmine/entity/Human.php @@ -169,8 +169,9 @@ public function spawnTo(Player $player){ $pk->z = $this->z; $pk->yaw = $this->yaw; $pk->pitch = $this->pitch; - $pk->unknown1 = 0; - $pk->unknown2 = 0; + $item = $this->getInventory()->getItemInHand(); + $pk->item = $item->getID(); + $pk->meta = $item->getDamage(); $pk->metadata = $this->getData(); $player->dataPacket($pk); @@ -180,8 +181,6 @@ public function spawnTo(Player $player){ ]; $player->dataPacket($pk); - $this->inventory->sendHeldItem($player); - $this->inventory->sendArmorContents($player); } } diff --git a/src/pocketmine/network/protocol/AddPlayerPacket.php b/src/pocketmine/network/protocol/AddPlayerPacket.php index 17c0f252e..04825b66d 100644 --- a/src/pocketmine/network/protocol/AddPlayerPacket.php +++ b/src/pocketmine/network/protocol/AddPlayerPacket.php @@ -39,8 +39,8 @@ class AddPlayerPacket extends DataPacket{ public $z; public $pitch; public $yaw; - public $unknown1; - public $unknown2; + public $item; + public $meta; public $metadata; public function pid(){ @@ -61,8 +61,8 @@ public function encode(){ $this->putFloat($this->z); $this->putByte((int) ($this->yaw * (256 / 360))); $this->putByte((int) ($this->pitch * (256 / 360))); - $this->putShort($this->unknown1); - $this->putShort($this->unknown2); + $this->putShort($this->item); + $this->putShort($this->meta); $this->put(Binary::writeMetadata($this->metadata)); }