I already know how to make items in Minecraft unbreakable (using the give command), but how would you make it so that when a player crafts or picks up a tool, the command blocks would make it unbreakable?

When I use this command:

"/entitydata @a diamond_sword {Unbreakable:1}",

The output is:

awesomeianman is a player and cannot be changed.

Could someone tell me if I suck at commands and got it all wrong, or if I just got some of it wrong?

  • so would i need to delete the diamond_sword then change @a to diamond_sword? May 7, 2017 at 22:44
  • Sorry about what i said earlier after looking at it there is a completely different problem you have yes you can't make a player unbreakable but also you can't use entity data at all for diamond sword because it isn't an entity. Here is a list of all entitys: digminecraft.com/lists/entity_list_pc.php
    – Emptyisme
    May 8, 2017 at 3:03
  • are you trying to see if a player crafts a certain item then replace it with an unbreakable version?
    – Jake
    May 8, 2017 at 20:50
  • @BACONISDABEST2COOL4U just to clarify, are you trying to do this for a specific tool or all tools?
    – Jake
    May 9, 2017 at 17:03
  • yes, I do want to make when a player crafts a diamond_sword then gets replaced with an unbreakable version and I need it to make it happen with all tools. May 31, 2017 at 1:16

1 Answer 1


To do this you would need a few command blocks for each item you want to make unbreakable. To identify the player who has the item in their inventory we are going to use scoreboards. In this example we will use a diamond sword but you can change wherever it syas diamond sword to whatever item you would like.


run this once:

/scoreboard objectives add hasItem stat.craftItem.minecraft.diamond_sword


put this in a repeating command block:

/testfor @a[score_hasItem_min=1]


Using a comparator, run these commands when a player is found:

/clear @a[score_hasItem_min=1] minecraft:diamond_sword 0
/give @a[score_hasItem_min=1] minecraft:diamond_sword 1 1 {Unbreakable:1b}
/scoreboard players reset @a hasItem


Here is my layout: layout Where the commands are from 1 - 4:

/testfor @a[score_hasItem_min=1]
/clear @a[score_hasItem_min=1] minecraft:diamond_sword 0
/give @a[score_hasItem_min=1] minecraft:diamond_sword 1 1 {Unbreakable:1b}
/scoreboard players reset @a hasItem
  • he is trying to add unbreakable to every tool the person crafts not specific tools he gives, what he wants is when somebody makes a wooden hoe he want it to be unbreakable. He wants every tool crafted to be unbreakable. Although your fix would work it would take a lot of scoreboard stats and a lot of command blocks and basically isn't worth the time.
    – Emptyisme
    May 8, 2017 at 23:24
  • @Empytyisme I see, this would definitely not be effective for replacing every tool. I misunderstood what the OP was asking.
    – Jake
    May 9, 2017 at 6:35
  • actually I just needed example with a diamond_sword so I could do it with all other tools May 31, 2017 at 1:17
  • but i'm fine doing this strategy over and over again May 31, 2017 at 1:18
  • @BACONISDABEST2COOL4U that's great, so is this an acceptable answer?
    – Jake
    May 31, 2017 at 1:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .