Struggling with CanPlaceOn tags in MCPE



  • 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?



  • 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 https://gaming.stackexchange.com/questions/374598/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 [], and instead you have to type {"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!




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2