use pocketmine\network\mcpe\handler\SessionHandler; class SetEntityDataPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{ //TODO: check why this is serverbound public const NETWORK_ID = ProtocolInfo::SET_ENTITY_DATA_PACKET; /** @var int */ public $entityRuntimeId; /** @var array */ public $metadata; public static function create(int $entityRuntimeId, array $metadata) : self{ $result = new self; $result->entityRuntimeId = $entityRuntimeId; $result->metadata = $metadata; return $result; } protected function decodePayload() : void{ $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->metadata = $this->getEntityMetadata(); } protected function encodePayload() : void{ $this->putEntityRuntimeId($this->entityRuntimeId); $this->putEntityMetadata($this->metadata); } public function handle(SessionHandler $handler) : bool{ return $handler->handleSetEntityData($this); } }