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){ $p = []; if($this->entityId === null){ $this->entityId = EntityFactory::nextRuntimeId(); }else{ $p[] = RemoveActorPacket::create($this->entityId); } if(!$this->invisible){ $uuid = UUID::fromRandom(); $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))))]); $pk = new AddPlayerPacket(); $pk->uuid = $uuid; $pk->username = $name; $pk->entityRuntimeId = $this->entityId; $pk->position = $pos; //TODO: check offset $pk->item = ItemStack::null(); $flags = ( 1 << EntityMetadataFlags::IMMOBILE ); $pk->metadata = [ EntityMetadataProperties::FLAGS => new LongMetadataProperty($flags), EntityMetadataProperties::SCALE => new FloatMetadataProperty(0.01) //zero causes problems on debug builds ]; $p[] = $pk; $p[] = PlayerListPacket::remove([PlayerListEntry::createRemovalEntry($uuid)]); } return $p; } }