use pocketmine\network\mcpe\serializer\NetworkBinaryStream; use function file_get_contents; class AvailableActorIdentifiersPacket extends DataPacket implements ClientboundPacket{ public const NETWORK_ID = ProtocolInfo::AVAILABLE_ACTOR_IDENTIFIERS_PACKET; /** @var string|null */ private static $DEFAULT_NBT_CACHE = null; /** @var string */ public $namedtag; protected function decodePayload(NetworkBinaryStream $in) : void{ $this->namedtag = $in->getRemaining(); } protected function encodePayload(NetworkBinaryStream $out) : void{ $out->put( $this->namedtag ?? self::$DEFAULT_NBT_CACHE ?? (self::$DEFAULT_NBT_CACHE = file_get_contents(\pocketmine\RESOURCE_PATH . '/vanilla/entity_identifiers.nbt')) ); } public function handle(PacketHandlerInterface $handler) : bool{ return $handler->handleAvailableActorIdentifiers($this); } }