Minecraft 1.13 /give command syntax

minecraft-commandsminecraft-java-edition

I know that typing /give @p minecraft:redsstone_torch 1 0 {CanPlaceOn:["minecraft:grass"]} in the past used to give a player a redstone torch that can be placed on grass for adventure mode, but when I try doing that in the new 1.13 snapshot, it highlights the canPlaceOn section in red (meaning it won't work). Does anybody know how it is supposed to be typed in the new syntax?

Best Answer

The syntax has changed to:

/give <players> <item> <count>

where <item> is a combination of ID and NBT (for blocks it's similar, but with state in [] between ID and NBT). So your command is then:

/give @p minecraft:redstone_torch{CanPlaceOn:["minecraft:grass"]} 1

or alternatively with @s, no minecraft: in the IDs (since it's default anyway) and without count (since 1 is default):

/give @s redstone_torch{CanPlaceOn:["grass"]}

Bonus: Maybe you'll be interested in block tags (archive).