The BE equivalents of these tags are minecraft:can_place_on
and minecraft:can_destroy
respectively. You can use these in the /give
and /replaceitem
commands using the final [components: json]
argument. For example, the syntax of /give
is:
give <player: target> <itemName: Item> [amount: int] [data: int] [components: json]
Note that unlike Java Edition, block names go inside an array named blocks
that goes inside minecraft:can_place_on
and minecraft:can_destroy
. Like so:
give @s stone 1 0 {"minecraft:can_place_on":{"blocks":["grass","dirt"]}}
give @s netherite_axe 1 0 {"minecraft:can_destroy":{"blocks":["pumpkin"]}}
You can also combine both minecraft:can_place_on
and minecraft:can_destroy
:
give @s iron_block 1 0 {"minecraft:can_place_on":{"blocks":["iron_block"]},"minecraft:can_destroy":{"blocks":["grass","dirt"]}}
N.B. The namespace ID (minecraft:
) is optional before the words can_place_on
or can_destroy
, and can be omitted. However, concerning block IDs, the namespace ID is forbidden and must not be present.
Unfortunately, these components only go as specfic as the block IDs, which can be limiting as some blocks rely on data values for variants or positioning. For example, it is impossible to specify a specific color of concrete, as the block ID concrete
is used by all concrete colors. This is unlike Java Edition, where data values have been abolished in favour of separate block IDs for each variant.
This syntax is called JavaScript Object Notation (JSON), which is a format similar to the NBT used in JE commands (technically SNBT). Objects are surrounded by braces ({
and }
), have keys and values separated by colons (:
), and have key-value pairs separated by commas (,
). Keys and strings are surrounded by double quotes ("
); arrays are surrounded by brackets ([
and ]
) and contain items delimited by commas (,
).