In my Minecraft world I am building a map and in this map I need to be able to give the player a lever that can be placed on only one block of my choice (like a gold block for instance).

I tried these commands in a command block

give @p lever 1 0 {CanPlaceOn:[“gold_block”]}
give @p lever 1 0 {CanPlaceOn:[“minecraft:gold_block”]}
give @p lever 1 0 {CanPlaceOn:[gold_block]}
give @p lever 1 0 {CanPlaceOn:[“Block:gold_block]}

All of them give me an error at the syntax past the CanPlaceOn:[ (copy/paste them into your world and you’ll see what I mean).

What am I doing wrong? I've checked all over the internet and it seems there aren’t any really clear guides on how to do this (and I know it can be done because there is a map on mcpedl.com that is called “Escape!” and you get a lever that can only be placed on gold blocks).


1 Answer 1


This is the proper command syntax for MCPE:

/give @p lever 1 0 {"can_place_on":{"blocks":["gold_block"]}}

You can change the block or placeable item after the /give @p lever but it has to be a placeable item.

Also changing the block or adding more do this:

  • To change the block you want to place it on, just change the string inside the square brackets after {"blocks":["**this string here**"]}}.

  • Adding more blocks:

    /give @p lever 1 0 {"can_place_on":{"blocks":["gold_block", "iron_block"]}}

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