use pocketmine\network\mcpe\NetworkSession; class SetEntityDataPacket extends DataPacket{ public const NETWORK_ID = ProtocolInfo::SET_ENTITY_DATA_PACKET; /** @var int */ public $entityRuntimeId; /** @var array */ public $metadata; protected function decodePayload(){ $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->metadata = $this->getEntityMetadata(); } protected function encodePayload(){ $this->putEntityRuntimeId($this->entityRuntimeId); $this->putEntityMetadata($this->metadata); } public function handle(NetworkSession $session) : bool{ return $session->handleSetEntityData($this); } }