From 00942d3a2b014f288845368b0c29ba460bc07d0d Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Thu, 12 Mar 2015 11:43:24 +0100 Subject: [PATCH] Fixed picking up items, entity IDs on packets --- src/pocketmine/Player.php | 10 +--------- src/pocketmine/network/protocol/DropItemPacket.php | 4 ++-- src/pocketmine/network/protocol/InteractPacket.php | 4 ++-- .../network/protocol/PlayerEquipmentPacket.php | 3 +++ src/pocketmine/network/protocol/RemoveBlockPacket.php | 4 ++-- .../network/protocol/TakeItemEntityPacket.php | 2 +- 6 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 052103ee2..889f17cc2 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -645,7 +645,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ } } - if($spawned < 16){ + if($spawned < 8){ return; } @@ -1308,10 +1308,6 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ continue; } - $pk = new TakeItemEntityPacket(); - $pk->eid = $this->getId(); - $pk->target = $entity->getId(); - $this->dataPacket($pk); $pk = new TakeItemEntityPacket(); $pk->eid = $this->getId(); $pk->target = $entity->getId(); @@ -1342,10 +1338,6 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ break; } - $pk = new TakeItemEntityPacket(); - $pk->eid = $this->getId(); - $pk->target = $entity->getId(); - $this->dataPacket($pk); $pk = new TakeItemEntityPacket(); $pk->eid = $this->getId(); $pk->target = $entity->getId(); diff --git a/src/pocketmine/network/protocol/DropItemPacket.php b/src/pocketmine/network/protocol/DropItemPacket.php index 908b0094b..2e7d12b0a 100644 --- a/src/pocketmine/network/protocol/DropItemPacket.php +++ b/src/pocketmine/network/protocol/DropItemPacket.php @@ -37,7 +37,7 @@ class DropItemPacket extends DataPacket{ } public function decode(){ - $this->eid = $this->getInt(); + $this->eid = $this->getLong(); $this->unknown = $this->getByte(); $this->item = $this->getSlot(); } @@ -46,4 +46,4 @@ class DropItemPacket extends DataPacket{ } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/InteractPacket.php b/src/pocketmine/network/protocol/InteractPacket.php index 06d52d6a9..9ee88cf7c 100644 --- a/src/pocketmine/network/protocol/InteractPacket.php +++ b/src/pocketmine/network/protocol/InteractPacket.php @@ -38,8 +38,8 @@ class InteractPacket extends DataPacket{ public function decode(){ $this->action = $this->getByte(); - $this->eid = $this->getInt(); - $this->target = $this->getInt(); + $this->eid = $this->getLong(); + $this->target = $this->getLong(); } public function encode(){ diff --git a/src/pocketmine/network/protocol/PlayerEquipmentPacket.php b/src/pocketmine/network/protocol/PlayerEquipmentPacket.php index b5d79ef6a..98619f059 100644 --- a/src/pocketmine/network/protocol/PlayerEquipmentPacket.php +++ b/src/pocketmine/network/protocol/PlayerEquipmentPacket.php @@ -32,6 +32,7 @@ class PlayerEquipmentPacket extends DataPacket{ public $item; public $meta; public $slot; + public $selectedSlot; public function pid(){ return Info::PLAYER_EQUIPMENT_PACKET; @@ -42,6 +43,7 @@ class PlayerEquipmentPacket extends DataPacket{ $this->item = $this->getShort(); $this->meta = $this->getShort(); $this->slot = $this->getByte(); + $this->selectedSlot = $this->getByte(); } public function encode(){ @@ -50,6 +52,7 @@ class PlayerEquipmentPacket extends DataPacket{ $this->putShort($this->item); $this->putShort($this->meta); $this->putByte($this->slot); + $this->putByte($this->selectedSlot); } } diff --git a/src/pocketmine/network/protocol/RemoveBlockPacket.php b/src/pocketmine/network/protocol/RemoveBlockPacket.php index 4b9348958..c0c9b4992 100644 --- a/src/pocketmine/network/protocol/RemoveBlockPacket.php +++ b/src/pocketmine/network/protocol/RemoveBlockPacket.php @@ -38,7 +38,7 @@ class RemoveBlockPacket extends DataPacket{ } public function decode(){ - $this->eid = $this->getInt(); + $this->eid = $this->getLong(); $this->x = $this->getInt(); $this->z = $this->getInt(); $this->y = $this->getByte(); @@ -48,4 +48,4 @@ class RemoveBlockPacket extends DataPacket{ } -} \ No newline at end of file +} diff --git a/src/pocketmine/network/protocol/TakeItemEntityPacket.php b/src/pocketmine/network/protocol/TakeItemEntityPacket.php index 5fef8888c..cdc8fe648 100644 --- a/src/pocketmine/network/protocol/TakeItemEntityPacket.php +++ b/src/pocketmine/network/protocol/TakeItemEntityPacket.php @@ -41,7 +41,7 @@ class TakeItemEntityPacket extends DataPacket{ public function encode(){ $this->reset(); - $this->putInt($this->target); + $this->putLong($this->target); $this->putLong($this->eid); }