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

Tools no breaking.

Discussion in 'Facepalm' started by jerryzooyoyo, Aug 7, 2017.

  1. jerryzooyoyo

    jerryzooyoyo Silverfish

    Messages:
    19
    GitHub:
    jerryzooyoyo
    I want to let a tool ( maybe a iron sword ) unbreakable.
    If I use the item to attack on a zombie, just as normal, but the item is unbreakable ( no damage ).
    How to add this feature?
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Use the "Unbreakable" nbt tag.
    PHP:
    /** @var Item $item */
    $nbt $item->getNamedTag();
    $nbt->Unbreakable = new ByteTag("Unbreakable"1);
    $item->setNamedTag($nbt);
     
  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.