use pocketmine\item\Item; use pocketmine\network\mcpe\NetworkSession; class MobEquipmentPacket extends DataPacket{ public const NETWORK_ID = ProtocolInfo::MOB_EQUIPMENT_PACKET; /** @var int */ public $entityRuntimeId; /** @var Item */ public $item; /** @var int */ public $inventorySlot; /** @var int */ public $hotbarSlot; /** @var int */ public $windowId = 0; protected function decodePayload(){ $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->item = $this->getSlot(); $this->inventorySlot = $this->getByte(); $this->hotbarSlot = $this->getByte(); $this->windowId = $this->getByte(); } protected function encodePayload(){ $this->putEntityRuntimeId($this->entityRuntimeId); $this->putSlot($this->item); $this->putByte($this->inventorySlot); $this->putByte($this->hotbarSlot); $this->putByte($this->windowId); } public function handle(NetworkSession $session) : bool{ return $session->handleMobEquipment($this); } }