How to create NPC to player?

Discussion in 'Requests' started by kelauzer, Aug 11, 2021.

  1. kelauzer

    kelauzer Creeper

    Messages:
    5
    After player join to server i make npc to him, and after server stop with this error. What is the problem?
    code:
    $p->getLevel()->loadChunk($x >> 4, $z >> 4);
    $nbt = \pocketmine\entity\Human::createBaseNBT(new Location($x,$y,$z,0,0,$p->getLevel()), null, $p->getYaw(), $p->getPitch());
    $nbt->setTag(new \pocketmine\nbt\tag\CompoundTag("Skin", [
    "Name" => new \pocketmine\nbt\tag\StringTag("Name", $p->getSkin()->getSkinId()),
    "Data" => new \pocketmine\nbt\tag\ByteArrayTag("Data", $p->getSkin()->getSkinData()),
    "CapeData" => new \pocketmine\nbt\tag\ByteArrayTag("CapeData", $p->getSkin()->getCapeData())
    ]));
    $entity = new \pocketmine\entity\Human($p->getLevel(), $nbt);
    $entity->setNameTag($message);
    $entity->setNameTagAlwaysVisible(true);
    $entity->setScale(0.1);
    $entity->spawnTo($p);
    Console error:
    UnexpectedValueException: "Duplicate key "BurnTime"" (EXCEPTION) in "pmsrc/vendor/pocketmine/nbt/src/tag/CompoundTag" at line 334
    2021-08-11 [07:24:06] [Server thread/CRITICAL]: #0 pmsrc/vendor/pocketmine/nbt/src/ReaderTracker(45): pocketmine\nbt\tag\CompoundTag->pocketmine\nbt\tag\{closure}()
    2021-08-11 [07:24:06] [Server thread/CRITICAL]: #1 pmsrc/vendor
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.