How can I change the durability of items using commands?
Solution 1:
You can use the /give command to create an item with a certain amount of durability by entering a damage value after the quantity. For example, to give a diamond pickaxe that has been used 50 times (1511 durability remaining), use this command:
/give @p diamond_pickaxe 1 50
The /give command also allows you to give items with NBT data, including the Unbreaking
tag. To give a diamond pickaxe that will never break, use this command:
/give @p diamond_pickaxe 1 0 {Unbreakable:1}