0

I am making a Minecraft Adventure map that makes use of the CanPlaceOn and CanDestroy tags. For example, here is a command to give a pickaxe that can break diamond ore:

/give @p diamond_pickaxe{CanDestroy:["diamond_ore"]}

What do I do if I want a user to be able to break certain blocks without a tool?

7
  • Well im not making a adventure map or any map – ok u Oct 2 '20 at 0:44
  • How do i do that – ok u Oct 2 '20 at 0:46
  • I think its good I mean – ok u Oct 2 '20 at 0:47
  • I meant I thought its good – ok u Oct 2 '20 at 0:48
  • Yes and do you know the command even? – ok u Oct 2 '20 at 0:49
1

What you have requested is impossible.

Let's look at the Minecraft Wiki page on Adventure Mode:

Adventure mode is similar to Survival in that players receive damage from their environment, dying is possible, and players must manage hunger. However, it is different in many ways as well. In the Java Edition, blocks can be destroyed only with an item/tool that has the CanDestroy NBT tag, and cannot be destroyed by the player's fist. Likewise, blocks require the CanPlaceOn NBT tag to be placed. In Bedrock Edition, similarly, can_destroy and can_place_on NBT tags are required to destroy and place blocks.

Unfortunately, there isn't any way to specify blocks that can always be destroyed even without tools. The best way I would go about this problem is by giving players a tool at the start of the map that can break the block, and tell players not to lose it.

4
  • Well I watch people play maps and they can break blocks without a tool – ok u Oct 2 '20 at 0:59
  • In adventure mode – ok u Oct 2 '20 at 0:59
  • um there adventure maps and no mods – ok u Oct 2 '20 at 1:00
  • @oku An example please? – ExpertCoder14 Oct 2 '20 at 1:02
0

If you are in 1.13+ and can use datapacks then I have a solution. Although this isn’t the best solution it is a decent solution. First off you are going to need a block tag of all the blocks you will allow players to break. Then make a mcfunction for raycasting and put in that function a command to test if the block at ~ ~ ~ is a block from the block tag and if so change the player’s game mode to survival. Below is an example of what the command should look like. execute if block ~ ~ ~ #<datapack sub folder name>:<the block tag you created> run gamemode survival Replace the example tag with your block tag. Now after that run a command like the following. execute unless block ~ ~ ~ #<datapack sub folder name>:<the block tag you created> run gamemode adventure That will set the player to adventure mode if they aren’t looking at a block defined in the block tag. Finally, in a function defined in the minecraft tick function tag run the raycast function as @a with: execute as @a at @s run function <datapack sub folder name>:<function name> If you want a datapack so you don’t have to do anything just ask. Otherwise if you don’t know how to use datapacks, watch some videos on YouTube or something on how to do it. I hope this helps.

2
  • When you are posting answers on SE, you should be opting for the minimum effort from the user. This means you should be providing the data packs and function files by default, not on request. Remember, the original poster isn’t the only one that will come across this post! – ExpertCoder14 Nov 20 '20 at 7:48
  • @ExpertCoder14 Ok, I will add a sample datapack sometime soon. – randomuser922 Nov 20 '20 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.