Replace normal block with same block that has a special property
I want to use a command block that detects if there is a gold block in the player's inventory and replace it with a gold block that can only be placed on grass.
Now, here is what I'm doing: I started a redstone clock which connects to a command block which has this command to clear all gold blocks.
clear @p gold_block
Then I have a comparator that takes that signal and points into another command block that gives the player a gold block that can only be placed on grass.
give @p gold_block 1 0 {CanPlaceOn:[grass]}
What happens is that this special gold block also gets removed by the previous command block. I've tried to give the gold block a name with the display tag, but I don't know how to configure the command to give the block both tags (Display & Can PlaceOn).
Pictures about "Replace normal block with same block that has a special property"



How do you replace all of a certain block with another block?
In Minecraft, you can use the /fill command to replace a specific type of block with another. In this case, we want to replace all water blocks with air blocks within a fill range. Let's explore how to do this in Minecraft.How do I replace specific blocks with fill?
Do one of the following:How do you change one block to another?
You need to replace [X1] [Y1] [Z1] [X2] [Y2] [Z2] with the coordinates between which you want to replace the blocks. Show activity on this post. Replace X1 - Z2 with the edges of the cube you want to fill and WhatYouWantToReplace with what type of block you want to replace. The "minecraft:" is optional.Destroy \u0026 Replace Simultaneously (Destroy Specific Blocks in a /Fill Command)
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Pixabay, Maria Orlova, Meruyert Gonullu, Maria Orlova

