3

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.

2

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!

| improve this answer | |
  • Please don't add signatures to your posts; they're noise, and don't belong. – Frank Jun 16 '16 at 22:01
0

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.

| improve this answer | |

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