From b9a87ed147e91a0d875cfe2da5b024908d5cf41c Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 5 Jun 2017 20:03:19 +0100 Subject: [PATCH] New fields for InventoryActionPacket TODO: use this packet --- .../mcpe/protocol/InventoryActionPacket.php | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/pocketmine/network/mcpe/protocol/InventoryActionPacket.php b/src/pocketmine/network/mcpe/protocol/InventoryActionPacket.php index 1208952f8..366385722 100644 --- a/src/pocketmine/network/mcpe/protocol/InventoryActionPacket.php +++ b/src/pocketmine/network/mcpe/protocol/InventoryActionPacket.php @@ -28,24 +28,27 @@ use pocketmine\network\mcpe\NetworkSession; class InventoryActionPacket extends DataPacket{ const NETWORK_ID = ProtocolInfo::INVENTORY_ACTION_PACKET; - public $uvarint0; + const ACTION_GIVE_ITEM = 0; + const ACTION_ENCHANT_ITEM = 2; + + public $actionId; public $item; - public $varint1; - public $varint2; + public $enchantmentId = 0; + public $enchantmentLevel = 0; public function decode(){ - $this->uvarint0 = $this->getUnsignedVarInt(); + $this->actionId = $this->getUnsignedVarInt(); $this->item = $this->getSlot(); - $this->varint1 = $this->getVarInt(); - $this->varint2 = $this->getVarInt(); + $this->enchantmentId = $this->getVarInt(); + $this->enchantmentLevel = $this->getVarInt(); } public function encode(){ $this->reset(); - $this->putUnsignedVarInt($this->uvarint0); + $this->putUnsignedVarInt($this->actionId); $this->putSlot($this->item); - $this->putVarInt($this->varint1); - $this->putVarInt($this->varint2); + $this->putVarInt($this->enchantmentId); + $this->putVarInt($this->enchantmentLevel); } public function handle(NetworkSession $session) : bool{