I'm trying to spawn an item that can only be placed on specific blocks, and I know this can be achieved by using:

/give @s (item) 1 0 {CanPlaceOn:["block"]}

I've tried this several times, with several slight variations I've seen from videos and other questions about this command, but every time I do this, I receive this error message:

*Line 1, Column 2 Missing '}' or object member name

What am I doing wrong?

The command I enter is this:

/give @s cake 1 0 {CanPlaceOn:["red_nether_brick_stairs"]}

When I try the command with different items, it works without any error message:

/give @s stone 1 0 {CanPlaceOn:["netherrack"]}

Is there any way to do this with the items I want?

  • 4
    Possible duplicate of How can I use CanPlaceOn and CanDestroy in Bedrock Edition?
    – pppery
    Dec 20 '21 at 19:42
  • I looked at the suggested question "How can I use CanPlaceOn and CanDestroy in Bedrock Edition?" and tried the commands. I still got the same error message. However, when I tried it with stone instead of cake and netherrack instead of nether stairs, it works. Is there any way to do this with the items I want?
    – A Hardwick
    Dec 20 '21 at 21:37
  • @AHardwick Are you still seeking answers to this question? If not, we'll close it as it is currently duplicated the suggestion we have posed. If you are still seeking answers, please edit to state the commands you tried from the proposal and the exact error messages. Jan 4 at 5:57

so I believe the problem with your command is that CanPlaceOn (and CanDestroy) is for Minecraft Java Edition, and is not usable in Minecraft BE. However, as stated in "How can I use CanPlaceOn and CanDestroy in Bedrock Edition?", there is a Bedrock Edition equivalent, minecraft:can_place_on and minecraft:can_destroy.

The differences from CanPlaceOn and CanDestroy is that you can't go straight to [<blocks>], and instead you have to type {"blocks":[<blocks>]}. You also have to cover the minecraft:can_place_on in quotation marks.

So the final command is:

/give @s cake 1 0 {"minecraft:can_place_on":{"blocks":["red_nether_brick_stairs"]}}

Compared to your command:

/give @s cake 1 0 {CanPlaceOn:["red_nether_brick_stairs"]}

Also you can take away the minecraft: part and shorten it to just can_place_on if you want. I also can't explain why changing the items worked, because when I tried other items it didn't work, sorry!


I believe your problem is that there is newer syntax, and commands no longer require a "data" variable. So the command would be:

/give @s cake 1 {CanPlaceOn:["red_nether_brick_stairs"]}

compared to your command:

/give @s cake 1 0 {CanPlaceOn:["red_nether_brick_stairs"]}

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