Arqade Asked by ok u on April 24, 2021
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?
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 theCanPlaceOn
NBT tag to be placed. In Bedrock Edition, similarly,can_destroy
andcan_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.
Answered by ExpertCoder14 on April 24, 2021
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.
Answered by randomuser922 on April 24, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP