I'm trying to make an adventure map in Minecraft Java with blanket permission to place anything on certain block types, and break certain others, by appropriate tool. I'm currently trying to clock command blocks to run a /tag command on everything in a hotbar, but i can't figure out the syntax, and the wiki page for /tag has all of 23 lines of text, assuming a user can figure out the name field with no examples or reference links. My test command block, reading, as of now, "tag @e[nbt={Item:{slot:0}}] add {CanDestroy:["stone"]}", is flagging "{CanDestroy:["stone"]}" as red(error), because "Expected whitespace to end one argument, but found trailing data at position32: ...:0}" How do i format this for the tag command? Or am i going about this all wrong? I want to allow players to place/break with crafted items, so i can't very well just regulate inventoty with /give, which seems to be the standard approach for these NBT tags.

PS: The name field, for what it's worth, was angle bracketed, but that wouldn't display here.

  • This would technically be a duplicate of this question, but the only answer there is pretty hard to understand, needlessly complicated and only works under certain conditions, for example enchantments, custom names and more are cleared. So I won't mark it as duplicate. Feb 10, 2019 at 11:14
  • Your main problem: Minecraft doesn't allow changing player NBT with commands. Due to a bug, you can edit numbers in the tags of an item (for example the strength of an attribute modifier), but that's it, no access to things like CanDestroy. I do not think what you want is possible, without requiring the player to drop the item. But who knows, maybe I've overlooked something. Feb 10, 2019 at 11:17
  • 1
    Thank you, Mr. Röling. I guess it should be fairly simple to tag all dropped items. That said, how is the name field formatted for something like this, if you don't mind me asking? I figure it would then look something like /tag @e[type=item(,score_tool=3)] add somethingorother, where tool is added with /scoreboard to differentiate item categories for breaking blocks, yes? I'm still getting the same error.
    – Ben
    Feb 10, 2019 at 19:23
  • 1
    The wiki is your friend. The "Commands" page tells you about target selectors, including by NBT, the "Commands/tag" page about that command the page "Chunk format" about item data (or something linked there). Feb 10, 2019 at 21:35
  • 1
    Thank you. At this point, i'd consider the question answered. I just don't know how to indicate such.
    – Ben
    Feb 11, 2019 at 23:37

1 Answer 1


Apparently, i was trying to use the wrong command, to do something the game doesn't allow. For what it's worth, i ended up using the /execute command to run data on dropped items. My thanks to Mr. Röling for his help.

Ex: execute as @e[type=item,scores={tool=3}] run data merge entity @s {Item:{tag:{CanDestroy:["coarse_dirt","gravel","sand","snow","snow_block"]}}}

You must log in to answer this question.

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