I added Player using AddPlayer packet and tried to set nametag, but dont working PHP: public function createNPC(Player $p){$pk = new AddPlayerPacket();$title = "Playing $this->song";$pk->uuid = UUID::FromRandom(); $pk->eid = 9273; $pk->x = 128; $pk->y = 65; $pk->z = 134; $pk->speedY = 0; $pk->speedX = 0; $pk->speedZ = 0; $pk->yaw = 0; $pk->item = Item::get(0); $pk->headYaw = 0; $pk->pitch = 0; $pk->metadata = [Entity::DATA_NAMETAG => [Entity::DATA_TYPE_STRING, $title]]; $p->dataPacket($pk);}
'But dont working' What is not working? What do you expect it to do, and what does(n't) it do? Does it give any errors?
Player is Entity (FYI) Spoiler: defining $entity Code: $entity = null; $entity = ""; $entity = PHP_INT_MAX; $entity = []; $entity = M_PI; $entity = true; $entity = [Foo::class, "bar"]; $entity = new Bar(); Please learn the language before attempting.