I'm in Java in 1.14.3 and I'm trying to create a custom mining tool using the stone hoe. Whenever the player mines with it, I want it to take durability/damage. I created a scoreboard scoreboard objectives add usedTool minecraft.mined:minecraft.stripped_spruce_log. Now, whenever the player mines, I check if they have the stone hoe in their hand: execute as @a[nbt={SelectedItem:{id:"minecraft:stone_hoe"}}] if entity @s[scores={usedTool=..1}] run [...] Is there a way I can subtract durability from the stone hoe after the player has mined with it?

  • Are you in the latest version (1.14.3) on Java edition? – Nik3141 Jul 11 at 21:40
  • @Nik3141Yes sorry, I forgot to mention that. – Hydra Jul 12 at 0:46
  • No problem I just like to title minecraft questions a particular way to make them easier to understand at first glance. – Nik3141 Jul 12 at 0:56

You should use execute store result entity @s SelectedItem.tag.Damage int 1 run <some command that returns a value>. This will set the Damage of the tool (how much it has been used) to the value of whatever command you put after the run. The 1 after the int is a scale factor of 1.

You can make a system where after the item is used, you store the durability somewhere with execute store result score <entity> <objective> run data get entity @s SelectedItem.tag.Damage 1,then use scoreboard players add <entity> <objective> 1 to add one to the value (because you are adding damage, effectively removing durability), and then use the above execute store result entity @s SelectedItem.tag.Damage int 1 run scoreboard players get <entity> <objective> to store that modified value back into the Damage tag.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.