In a map I'm making the player has to survive while locked in a maze. To stop them from breaking out, they will be in adventure mode. However, I still want them to be able to craft items and use them with specified blocks. I have tried several methods already but they all have a flaw.

One method is to have a scoreboard objective called item and giving certain item entities a specific score using something like:

/scoreboard players set @e[type=Item] item 1 {Item:{id:"minecraft:sapling"}}

Then it is possible to select these items with:

/entitydata @e[type=Item,score_item=1,score_item_min=1] {Item:{tag:{CanPlaceOn:["dirt"],HideFlags:24}}}

This works but it requires the item to be dropped, which isn't a problem for saplings, but for tools and other craftable items, it becomes a hassle.

To fix this, I'm currently clearing tools without damage and giving the player a slightly damaged tool in return:

/clear @a minecraft:stone_axe 0 1  
/give @a minecraft:stone_axe 1 1 {CanDestroy:["log","log2","leaves","leaves2"],HideFlags:24}

This doesn't work for items without damage values (e.g. torches), but I don't mind these having to be dropped as there aren't too many of these. However, there is another problem. In the nether, the player will have access to an enchantment table and an anvil. This means they can repair enchanted tools, which will cause them to be cleared and replaced with unenchanted ones as soon as they go back to the overworld.

I also thought about using a stat.craftItem scoreboard objective and giving them the usable item if they craft it. However, this would result in the player having a duplicate of every item they crafted, as I think it is impossible to select an item without NBT-data in the /clear command.

Is there any way to make this work? And if not, would it be better to have the player drop all crafted items or have duplicates of them all?

  • Probably dropping. You pretty much thought about all solutions I would have thought of. In 1.13 you can use execute store to modify numbers of items (count, enchantment level, …), but that doesn't help you for CanPlaceOn. Maybe you should avoid crafting completely and have them unlock items in a different way, maybe a villager. Commented Jul 8, 2018 at 21:36

1 Answer 1


So if I understod it right you want tools to work in adventure mode for specific type of blocks. Well I think this might help you then. Just follow the steps.

  1. First you make a scoreboard for the tool

    /scoreboard objectives add (name) dummy
  2. Then you place this command inside a repeating command block that is always active and unconditional facing up:

    /scoreboard players set @a (scoreboard name) 2 {SelectedItem:{id:"minecraft:THE_TOOL"}}
  3. Now over the repeating command block you place a chain block that is always active and unconditional and you want it to face upwards:

    /scoreboard players set @a (scoreboard name) 1 {SelectedItem:{id:"minecraft:TOOL_NAME",tag:{display:{Name:"THE NAME YOU WANT THE TOOL TO BE CALLED"}}}}
  4. And now the last command block. It will be a chain block and it will face up. it must be always active and unconditional:

    /replaceitem entity @a[score_SCOREBOARD_NAME_min=2] slot.weapon.mainhand minecraft:TOOL_NAME 1 0 {HideFlags:8,display:{Name:"THE NAME THAT YOU CALLED YOUR TOOL"},CanDestroy:["sand","grass","gravel","dirt","mycelium","clay","farmland","grass_path","soul_sand","snow","snow_layer","FakeBlock"]}
  5. Your pretty much done. Here is an example:

  6. /scoreboard players set @a Diapick 2 {SelectedItem:{id:"minecraft:diamond_pickaxe"}}

  7. /scoreboard players set @a Diapick 1 {SelectedItem:{id:"minecraft:diamond_pickaxe",tag:{display:{Name:"Diamond Pickaxe"}}}}

  8. /replaceitem entity @a[score_Diapick_min=2] slot.weapon.mainhand minecraft:diamond_pickaxe 1 0 {HideFlags:8,display:{Name:"Diamond Pickaxe"},CanDestroy:["obsidian","ender_chest","anvil","coal_block","diamond_block","emerald_block","iron_block","gold_block","lapis_block","redstone_block","enchanting_table","iron_bars","iron_door","mob_spawner","dispenser","dropper","furnace","coal_ore","diamond_ore","emerald_ore","gold_ore","iron_ore","redstone_ore","lapis_ore","quartz_ore","end_stone","hopper","iron_trapdoor","brick_stairs","brick_block","cauldron","cobblestone","stone_stairs","cobblestone_wall","mossy_cobblestone","nether_brick","nether_brick_fence","nether_brick_stairs","stone_slab","andesite","deorite","granite","polished_andesite","polished_deorite","polished_granite","stone","stone_bricks","stone_brick_stairs","prismarine","prismarine_bricks","dark_prismarine","stained_hardened_terracotta","hardened_clay","quartz_block","quartz_stairs","sandstone","sandstone_stairs","brewing_stand","stone_pressure_plate","heavy_weighted_pressure_plate","light_weighted_pressure_plate","netherrack","rail","ice","packed_ice"]}

command block setup

This is what it should look like

  • This command: /scoreboard players set @a Diapick 2 {SelectedItem:{id:"minecraft:diamond_pickaxe"}} doesn't work in minecraft 1.17.1 Commented Nov 3, 2021 at 21:18

You must log in to answer this question.

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