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