text = $text; $this->title = $title; } public function getText() : string{ return $this->text; } public function setText(string $text) : void{ $this->text = $text; } public function getTitle() : string{ return $this->title; } public function setTitle(string $title) : void{ $this->title = $title; } public function isInvisible() : bool{ return $this->invisible; } public function setInvisible(bool $value = true) : void{ $this->invisible = $value; } public function encode(Vector3 $pos) : array{ $p = []; if($this->entityId === null){ $this->entityId = Entity::nextRuntimeId(); }else{ $p[] = RemoveActorPacket::create($this->entityId); } if(!$this->invisible){ $uuid = Uuid::uuid4(); $name = $this->title . ($this->text !== "" ? "\n" . $this->text : ""); $p[] = PlayerListPacket::add([PlayerListEntry::createAdditionEntry($uuid, $this->entityId, $name, SkinAdapterSingleton::get()->toSkinData(new Skin("Standard_Custom", str_repeat("\x00", 8192))))]); $actorFlags = ( 1 << EntityMetadataFlags::IMMOBILE ); $actorMetadata = [ EntityMetadataProperties::FLAGS => new LongMetadataProperty($actorFlags), EntityMetadataProperties::SCALE => new FloatMetadataProperty(0.01) //zero causes problems on debug builds ]; $p[] = AddPlayerPacket::create( $uuid, $name, $this->entityId, //TODO: actor unique ID "", $pos, //TODO: check offset null, 0, 0, 0, ItemStackWrapper::legacy(ItemStack::null()), GameMode::SURVIVAL, $actorMetadata, UpdateAbilitiesPacket::create(0, 0, $this->entityId, []), [], "", DeviceOS::UNKNOWN ); $p[] = PlayerListPacket::remove([PlayerListEntry::createRemovalEntry($uuid)]); } return $p; } }