Hi, so I want to make a server core for my own server. I have set up the core and everything, but I want to make my own NPC's. I don't want to use the slapper plugin, because I want it to be a complete core (I guess). Can anyone help me? (BTW, I tried searching this up, but when I attempted the method, it was no longer supported. The last post about this was a year ago so yeah...) Thanks in advance! ~Ethaniccc
When I was making the variable $nbt, it gave me this error: Code: [Server thread/CRITICAL]: RuntimeException: "Cannot access dynamic field "Pos": Dynamic field access on pocketmine\nbt\tag\CompoundTag is no longer supported" (EXCEPTION) in "vendor/pocketmine/nbt/src/tag/NoDynamicFieldsTrait" at line 31 My code: PHP: $nbt = new CompoundTag; $nbt->Pos = new ListTag("Pos", [ new DoubleTag("", $player->getX()), new DoubleTag("", $player->getY()), new DoubleTag("", $player->getZ()) ]); $nbt->Motion = new ListTag("Motion", [ new DoubleTag("", 0), new DoubleTag("", 0), new DoubleTag("", 0) ]); $nbt->Rotation = new ListTag("Rotation", [ new FloatTag("", $player->getYaw()), new FloatTag("", $player->getPitch()) ]); $nbt->Health = new ShortTag("Health", 20); $nbt->Skin = new CompoundTag("Skin", [ "Data" => new StringTag("Data", $player->getSkin()->getSkinData()), "Name" => new StringTag("Name", $player->getSkin()->getSkinId())]); $human = new Human($player->getLevel(), $nbt); $human->setNameTag($player->getName()); $human->setNameTagVisible(true); $human->spawnTo($player);
I did everything, but I don't know how to set the Skin for the NPC Error: Code: [Server thread/CRITICAL]: InvalidStateException: "Human must have a valid skin set" (EXCEPTION) in "src/pocketmine/entity/Human" at line 110
If i didn't remember wrong, Entity class has a PHP: $entity->lookAt($position); function. Can you try?