Place-able and breakable block in Adventure Mode [duplicate]
I am making my Adventure map, and i have one problem. I want to create a block what can be placed on diamond ore, for example, and when player destroy it, he could place it again.
Best Answer
Using certain tags when using the /give command in minecraft you can allow certain blocks/tools to be placed/broken To break blocks:
/give @p minecraft:stone_shovel 1 0 {CanDestroy:[minecraft:dirt, minecraft:gravel, minecraft:soulsand]}
The gravel, dirt, and soulsand can be replaced with your desired blocks to be able to break.
To place:
/give @p minecraft:gravel 1 0 {CanPlaceOn:["minecraft:stone","minecraft:stonebrick"]}
This will allow the player to only place the block on "stone" and "stone brick"
To be more advanced you could run a testfor when the player breaks an item it could execute the command:
/give @p minecraft:gravel 1 0 {CanPlaceOn:["minecraft:stone","minecraft:stonebrick"]}
Then when they break the block they would get the block, and have it able to be placed on specific blocks.
Lets say that your "block" is emerald ore, you can give them an item/tool like this:
/give @p minecraft:diamond_pickaxe 1 0 {CanDestroy:[minecraft:emerald_ore]}
Then you could testfor that the emerald ore has been broken. Then you could execute the command:
/give @p minecraft:gravel 1 0 {CanPlaceOn:["minecraft:diamond_ore"]}
There you go!
Pictures about "Place-able and breakable block in Adventure Mode [duplicate]"
![Place-able and breakable block in Adventure Mode [duplicate] - Cheerful young woman in sunglasses standing on rocky ground among multicolored huge ice blocks during trip to north Place-able and breakable block in Adventure Mode [duplicate] - Cheerful young woman in sunglasses standing on rocky ground among multicolored huge ice blocks during trip to north](/assets/images/placeable_and_breakable_block_in_adventure_mode_duplicate_1.jpeg)
![Place-able and breakable block in Adventure Mode [duplicate] - Woman admiring view of gigantic ice chunks Place-able and breakable block in Adventure Mode [duplicate] - Woman admiring view of gigantic ice chunks](/assets/images/placeable_and_breakable_block_in_adventure_mode_duplicate_2.jpeg)
![Place-able and breakable block in Adventure Mode [duplicate] - Female traveler viewing huge ice chunk Place-able and breakable block in Adventure Mode [duplicate] - Female traveler viewing huge ice chunk](/assets/images/placeable_and_breakable_block_in_adventure_mode_duplicate_3.jpeg)
How do you place and break blocks in adventure mode?
Custom Minecraft maps make good use of Adventure mode, and many custom maps are set to this game mode; players cannot break blocks or place them, therefore disallowing them to destroy the map, or add anything to it that would ruin the map. Also, it is often used to protect various multiplayer servers from griefers.Can you place blocks in adventure mode?
To break wood (logs) in adventure mode, you need a tool which is specially enabled to destroy logs by having it's CanDestroy tag set to include "minecraft:log" for oak, birch, spruce and jungle logs, and/or "minecraft:log2" for old oak or acacia logs.Can you break stuff in adventure mode?
In adventure mode, players can only break blocks with the right tool. For example, a pickaxe cannot break a Log, a shovel cannot break stone blocks, and an axe cannot break Dirt.How to PLACE and DESTROY blocks in Minecraft ADVENTURE MODE! (Tutorial, 1.16+ (Java))
More answers regarding place-able and breakable block in Adventure Mode [duplicate]
Answer 2
Since blocks can't store data tags, you can't have the block retain information like CanPlaceOn tags when broken from the world. What you'd have to do instead is detect when the player has the right block type (by setting a scoreboard tag when their inventory data tag contains that item), then /clear'ing it from their inventory and /give them a copy of the block with the CanPlaceOn tag you want.
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Lisa, ArtHouse Studio, ArtHouse Studio, ArtHouse Studio
