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

How to spawn entity whit NBT in Task just updating whitout spawning other entity?

Discussion in 'Development' started by LewBr, Oct 15, 2017.

  1. LewBr

    LewBr Zombie

    Messages:
    385
    GitHub:
    lewbr
    I have tryed to update entity's using NBT tags but when i try to do that i have a problem, every update that task do i have a new entity on that world, anyone know how to spawn only 1 entity and then every task update, updates his(entity) nametag and skin?

    can enyone give me an example? i think this bug are because i use Entity::createEntity on task, but i don't know how to fix the NPC whitout using this.
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Is the entity a Human/does the entity extend pocketmine/entity/Human?
     
  3. LewBr

    LewBr Zombie

    Messages:
    385
    GitHub:
    lewbr
    Yes i want to spawn a Human entity, did you know how to spawn when Enable server and then update every second in task that Human but whitout every second spawn another one..?
     
  4. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Create a task and use entity->setNameTag("New name tag") to set/change the name tag.

    To update the skin, use entity->setSkin() and then call entity->sendSkin(entity->getViewers())
     
  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.