diff --git a/src/pocketmine/network/mcpe/protocol/UpdateTradePacket.php b/src/pocketmine/network/mcpe/protocol/UpdateTradePacket.php index 8b13bb4c1..319a34e76 100644 --- a/src/pocketmine/network/mcpe/protocol/UpdateTradePacket.php +++ b/src/pocketmine/network/mcpe/protocol/UpdateTradePacket.php @@ -26,13 +26,14 @@ namespace pocketmine\network\mcpe\protocol; use pocketmine\network\mcpe\NetworkSession; +use pocketmine\network\mcpe\protocol\types\InventoryNetworkIds; class UpdateTradePacket extends DataPacket{ const NETWORK_ID = ProtocolInfo::UPDATE_TRADE_PACKET; //TODO: find fields - public $byte1; - public $byte2; + public $windowId; + public $windowType = InventoryNetworkIds::TRADING; //Mojang hardcoded this -_- public $varint1; public $varint2; public $isWilling; @@ -42,8 +43,8 @@ class UpdateTradePacket extends DataPacket{ public $offers; public function decode(){ - $this->byte1 = $this->getByte(); - $this->byte2 = $this->getByte(); + $this->windowId = $this->getByte(); + $this->windowType = $this->getByte(); $this->varint1 = $this->getVarInt(); $this->varint2 = $this->getVarInt(); $this->isWilling = $this->getBool(); @@ -55,8 +56,8 @@ class UpdateTradePacket extends DataPacket{ public function encode(){ $this->reset(); - $this->putByte($this->byte1); - $this->putByte($this->byte2); + $this->putByte($this->windowId); + $this->putByte($this->windowType); $this->putVarInt($this->varint1); $this->putVarInt($this->varint2); $this->putBool($this->isWilling); diff --git a/src/pocketmine/network/mcpe/protocol/types/InventoryNetworkIds.php b/src/pocketmine/network/mcpe/protocol/types/InventoryNetworkIds.php index 671010b02..be64b880c 100644 --- a/src/pocketmine/network/mcpe/protocol/types/InventoryNetworkIds.php +++ b/src/pocketmine/network/mcpe/protocol/types/InventoryNetworkIds.php @@ -39,4 +39,9 @@ interface InventoryNetworkIds{ const MINECART_CHEST = 10; const MINECART_HOPPER = 11; const HORSE = 12; + const BEACON = 13; + const STRUCTURE_EDITOR = 14; + const TRADING = 15; + const COMMAND_BLOCK = 16; + } \ No newline at end of file