Minecraft – CanPlace tag doesn’t work

minecraft-commandsminecraft-java-edition

I am building an Adventure map in gamemode 2, so you can't place Blocks and I want to set a Item / Block in a slot and get a Block which is placeable in gamemode 2:

/replaceitem entity @p slot.inventory.0 quartz_block 1 0 {CanPlace:true} 

It doesn't work with this command, please help.

Best Answer

CanPlace is not a data tag that exists, nor is it a boolean. You are probably looking for the CanPlaceOn tag, which does exist, but is still not a boolean.

Here's a helpful wiki page on data tags: http://minecraft.gamepedia.com/Player.dat_format

CanPlaceOn is a list of strings, each string containing the name of a block that it can be placed on. For example, to get a quartz block that can be placed on stone and dirt:

/replaceitem entity @p slot.hotbar.0 quartz_block 1 0 {CanPlaceOn:["minecraft:stone","minecraft:dirt"]}