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

Why name tag don't work

Discussion in 'Development' started by SergeyIvanov, Nov 18, 2016.

  1. SergeyIvanov

    SergeyIvanov Witch

    Messages:
    59
    GitHub:
    sergeyivanov14
    I create entity and add name tag, but name tag don't work:( 0.16
     
  2. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    Please look at the README before posting. With your one sentence we can't just magically poof a message out of nowhere :p Provide as much information as you can. What is your code? Is there any errors showing?
     
  3. Harviy11

    Harviy11 Baby Zombie

    Messages:
    100
    code please. i help you
     
  4. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    ...
     
  5. Harviy11

    Harviy11 Baby Zombie

    Messages:
    100
    ok sorry
     
  6. SergeyIvanov

    SergeyIvanov Witch

    Messages:
    59
    GitHub:
    sergeyivanov14
    public function onAdd(PlayerInteractEvent $e){
    $p = $e->getPlayer();
    if($e->getItem()->getId() == 388){
    $nbt = new Human($p->chunk,
    new CompoundTag ("", [
    "Pos" => new ListTag( "Pos", [
    new DoubleTag("", $p->x),
    new DoubleTag("", $p->y + $p->getEyeHeight() - 2),
    new DoubleTag("", $p->z)
    ]),
    "Motion" => new ListTag ( "Motion", [
    new DoubleTag("", 0),
    new DoubleTag("", 0),
    new DoubleTag("", 0)
    ]),
    "Rotation" => new ListTag("Rotation", [
    new FloatTag("", $p->getYaw()),
    new FloatTag("", $p->getPitch())
    ]),
    "Skin" => new CompoundTag("Skin", [
    "Data" => new StringTag("Data", $p->getSkinData())
    ])
    ]
    ));
    $nbt->setNameTag("§f§lElf Robert");
    $nbt->spawnToAll();
    }
    }
     
  7. Harviy11

    Harviy11 Baby Zombie

    Messages:
    100
    use
    PHP:
    $nbt->setDataProperty(Entity::DATA_NAMETAGEntity::DATA_TYPE_STRING"YOUR ENTITY NAME");
    $nbt->setDataProperty(Entity::DATA_SHOW_NAMETAGEntity::DATA_TYPE_BYTE1);
     
    Last edited: Nov 18, 2016
  8. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    i think you just confused OP trying to bump it with another dev who is trying to help
    he is essentially asking for code so he can help
     
    Harviy11 likes this.
  9. imYannic

    imYannic Baby Zombie

    Messages:
    113
    If you are using some forks or maybe PMMP (I don't know if the functions exist there), use the following code:
    PHP:
    $entity->setNameTagVisible();
    $entity->setNameTagAlwaysVisible();
    This will show the nametag permanently.
     
    gistrec likes this.
  10. BalAnce

    BalAnce Silverfish

    Messages:
    22
    GitHub:
    YaBoiBalAnce
    Genisys and PM-MP support this :)
     
  11. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    Please do not bring up the word spoon unnecessarily.
     
    SOFe likes this.
  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.