M HYPE SPLASH
// general

CanDestroy tag doesn't work in 1.18

By John Peck

People say "can destroy" lets you break some things in adventure mode, but every time I try it, it does not work in 1.18.
Is there a way to make it work?
Here's my command:

/give @p minecraft:stick 1 0 {candestroy["iron_bar"]}
1

2 Answers

Seems like you're using syntax from before 1.13, as in update 1.13 Mojang removed numeric block data values and shifted the data tag to become part of the item specification. The following should do what you want:

/give @p minecraft:stick{CanDestroy:["minecraft:iron_bars"]} 1 

I think you forgot the colon in the data tag and the new command syntax does not require a “data” variable. So your command would be:

/give @p stick{CanDestroy:[“minecraft:iron_bar”]}