Updated:

What adventure mode allows

/gamemode adventure @a

In adventure mode players cannot break or place blocks by default, but they can still use buttons, levers, doors and chests. To allow breaking or placing, give items that carry permission.

Tools that break only chosen blocks (Java)

VersionA pickaxe that mines only stone
1.20.5+/give @p minecraft:diamond_pickaxe[can_break={blocks:"minecraft:stone"}]
1.13–1.20.4/give @p minecraft:diamond_pickaxe{CanDestroy:["minecraft:stone"]}

List several blocks as blocks:["minecraft:stone","minecraft:coal_ore"]. A tag such as blocks:"#minecraft:logs" covers a whole group, like every log.

Blocks that go only on chosen blocks (Java)

VersionTorches that go only on gold blocks
1.20.5+/give @p minecraft:torch[can_place_on={blocks:"minecraft:gold_block"}] 16
1.13–1.20.4/give @p minecraft:torch{CanPlaceOn:["minecraft:gold_block"]} 16

The listed block is the one you place against, not the item being placed.

Hide the tooltip

Allowed blocks show in the item tooltip under "Can break". To hide them on 1.21.5+, add tooltip_display={hidden_components:["can_break"]} inside the same [ ]. On 1.20.4 and older, use HideFlags:8 (CanDestroy) or HideFlags:16 (CanPlaceOn).

Bedrock syntax

/give @p diamond_pickaxe 1 0 {"minecraft:can_destroy":{"blocks":["stone"]}}
/give @p torch 16 0 {"minecraft:can_place_on":{"blocks":["gold_block"]}}

Bedrock puts JSON after the amount and data value, and the name is can_destroy. The same JSON can add "minecraft:keep_on_death":{} so an item survives death, or "minecraft:item_lock":{"mode":"lock_in_inventory"} so it cannot leave the inventory.

Ideas

For the full game flow, see how to make a minigame.

Common problems

Common questions

Check your command

The Command Error Doctor checks common syntax mistakes in your browser.