1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Nbt update

Discussion in 'Development' started by JakubkoCZE1, Mar 9, 2018.

  1. JakubkoCZE1

    JakubkoCZE1 Creeper

    Messages:
    1
    Hi i have problem with new nbt i have this code but not work
    Code:
    $nbt = new CompoundTag();
            $nbt->Pos = new ListTag("Pos", [new DoubleTag("", $player->getX()), new DoubleTag("", $player->getY()+5), 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("", 0.0), new FloatTag("", 0.0)]);
            $entity = Entity::createEntity("entita2", $player->getLevel(), $nbt);
            $entity->setDataFlag(Entity::DATA_FLAGS, Entity::DATA_FLAG_LEASHED, true);
            $entity->setDataProperty(Entity::DATA_LEAD_HOLDER_EID, Entity::DATA_TYPE_LONG, $player->getId());
            $entity->spawnToAll();
            $nbt->TileID = new IntTag("TileID", 35);
            $nbt->Data = new ByteTag("Data", mt_rand(1, 15));
            $gadget = Entity::createEntity("entita", $player->getLevel(), $nbt);
            $gadget->spawnToAll();

    Please help me
     
  2. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
    Use $entity = new pocketmine\entity\Human(Level $level, CompoundTag $nbt); instead of Entity::createEntity
     
  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.