diff --git a/src/pocketmine/network/Network.php b/src/pocketmine/network/Network.php index 9418159db..88960e56c 100644 --- a/src/pocketmine/network/Network.php +++ b/src/pocketmine/network/Network.php @@ -92,6 +92,7 @@ use pocketmine\network\protocol\TakeItemEntityPacket; use pocketmine\network\protocol\TextPacket; use pocketmine\network\protocol\TransferPacket; use pocketmine\network\protocol\UpdateBlockPacket; +use pocketmine\network\protocol\UpdateTradePacket; use pocketmine\network\protocol\UseItemPacket; use pocketmine\Player; use pocketmine\Server; @@ -368,6 +369,7 @@ class Network{ $this->registerPacket(ProtocolInfo::TEXT_PACKET, TextPacket::class); $this->registerPacket(ProtocolInfo::TRANSFER_PACKET, TransferPacket::class); $this->registerPacket(ProtocolInfo::UPDATE_BLOCK_PACKET, UpdateBlockPacket::class); + $this->registerPacket(ProtocolInfo::UPDATE_TRADE_PACKET, UpdateTradePacket::class); $this->registerPacket(ProtocolInfo::USE_ITEM_PACKET, UseItemPacket::class); } } diff --git a/src/pocketmine/network/protocol/UpdateTradePacket.php b/src/pocketmine/network/protocol/UpdateTradePacket.php new file mode 100644 index 000000000..111e7e405 --- /dev/null +++ b/src/pocketmine/network/protocol/UpdateTradePacket.php @@ -0,0 +1,64 @@ +byte1 = $this->getByte(); + $this->byte2 = $this->getByte(); + $this->varint1 = $this->getVarInt(); + $this->varint2 = $this->getVarInt(); + $this->bool1 = $this->getBool(); + $this->eid1 = $this->getEntityId(); + $this->eid2 = $this->getEntityId(); + $this->string = $this->getString(); + $this->nbt = $this->get(true); + } + + public function encode(){ + $this->reset(); + $this->putByte($this->byte1); + $this->putByte($this->byte2); + $this->putVarInt($this->varint1); + $this->putVarInt($this->varint2); + $this->putBool($this->bool1); + $this->putEntityId($this->eid1); //UniqueID + $this->putEntityId($this->eid2); //UniqueID + $this->putString($this->string); + $this->put($this->nbt); + } +} \ No newline at end of file