Hello I adding entity on position 155, 65, 96 it is on stone slab (in my screen), but it spawn entity near stone slabs:/ I think you do not want code i basically spawning entity with createEntity function. I dont know why I can not upload screen here :/ If you understand my problem please help me. EDIT: I adding it in PlayerJoinEvent and spawning only for my current player.
PHP: public function addAllNPC(Player $p){ $nbt = $this->makeNBT($p, 131, 63, 127, 0, 180); $entity = Entity::createEntity("Human", $p->getLevel(), $nbt); $entity->setNameTag("text"); $entity->setNameTagVisible(true); $entity->setNameTagAlwaysVisible(true); $entity->spawnTo($p); $nbt = $this->addNBT($p, 155, 65, 96, 360, 0); $entity = Entity::createEntity("Human", $p->getLevel(), $nbt); $entity->setNameTag("ss"); $entity->setNameTagVisible(true); $entity->setNameTagAlwaysVisible(true); $entity->spawnTo($p);public function makeNBT(Player $player, $x, $y, $z, $yaw, $pitch){ $nbt = new CompoundTag; $nbt->Pos = new ListTag("Pos", [ new DoubleTag(0, $x), new DoubleTag(1, $y), new DoubleTag(2, $z) ]); $nbt->Motion = new ListTag("Motion", [ new DoubleTag(0, 0), new DoubleTag(1, 0), new DoubleTag(2, 0) ]); $nbt->Rotation = new ListTag("Rotation", [ new FloatTag(0, $yaw), new FloatTag(1, $pitch) ]); $nbt->Health = new ShortTag("Health", 10); $player->saveNBT(); $nbt->Skin = new CompoundTag("Skin", ["Data" => new StringTag("Data", $player->getSkinData()), "Name" => new StringTag("Name", $player->getSkinId())]); return $nbt;}}
Ah, I solved i have PHP: $nbt = $this->makeNBT($p, 131.5, 63, 127.5, 0, 180); instead of PHP: $nbt = $this->makeNBT($p, 131, 63, 127, 0, 180); And working now!