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

NBT Item Tags

Discussion in 'Development' started by Junkdude, Dec 20, 2016.

  1. Junkdude

    Junkdude Zombie

    Messages:
    346
    GitHub:
    JunkDaCoder
    How do we use nbt for item names/tags? @Muqsit told me about them but I don't know how to use them
     
  2. TheDragonRing

    TheDragonRing Witch

    Messages:
    64
    GitHub:
    dragonwocky
    Here you go (other developers, correct me if I'm wrong!):
    PHP:
    //This method may be outdated, but I think it should work
    $item->setCustomName($name);
     
  3. InspectorGadget

    InspectorGadget Zombie Pigman

    Messages:
    462
    GitHub:
    InspectorGadget
    It's not. NBT's are a accurate and better version of setCustomName().
     
    TheDragonRing likes this.
  4. Wii54

    Wii54 Silverfish

    Messages:
    16
    GitHub:
    wii54
    Yes, you can use setCustomName() to set the custom name of an item, or you can just directly edit the named tag of the item.
    PHP:
    $item = new Item(1,0,1);//A rock
    $nbt = new CompoundTag();
    $nbt->display = new CompoundTag("display");
    $nbt->display->Name = new StringTag("Name","WhatEverYouWantToNameThisItem");
    $item->setNamedTag($nbt);
    For the full minecraft tag references, visit here!
    Note: some of the tags you see in the link above might not work in MCPE, so the best way to see if it work is to test it out:p
     
  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.