Is there a utility to replace one block type with another within a region?
As of 1.8, this can be done in vanilla with the /fill command. It can be done using command blocks or typing it straight into the chat.
For example, to change cobblestone to stone:
1.8 to 1.12:
/fill <x1> <y1> <z1> <x2> <y2> <z2> stone 0 replace cobblestone
1.13+:
/fill <x1> <y1> <z1> <x2> <y2> <z2> stone replace cobblestone
Change <x1> <y1> <z1>
to the coordinates of one corner of the rectangular area, and <x2> <y2> <z2>
with the coordinates of the opposite corner.
WorldEdit has such a command after selecting the area type
//replace [old block] [new block]
This will turn all of the first block from the area into the second block.
In 1.13. The /fill
command has been updated, this is the new syntax:
/fill <from> <to> <block> [replace|destroy|hollow|outline|keep]
from
and to
define two opposite corners of the volume that you want to fill
block
is the block that you want to fill into that volume
The next keyword decides what exactly should happen in the specified volume, it is optional and not using it defaults to replace
.
replace
sets every block in the specified volume to the specified <block>
.
destroy
works like replace
, but every block in the specified volume will drop whatever item they would usually drop (diamond ore drops diamonds and experience for example) and there will be a breaking particle effect.
hollow
works like replace
, but the volume will then be hollow, there will be a one block thick wall and everything inside will be set to air.
outline
works like hollow
, but only the one block thick wall will be placed, everything inside will stay the way it is instead of being set to air.
keep
works like replace
, but only air blocks get filled with the specified block.
You can also use this syntax instead:
/fill <from> <to> <block> replace <filter>
In this case only blocks specified by the <filter>
will be set to the block specified in <block>
So to replace all cobblestone in a volume between the coordinates 60 60 60
and 70 70 70
with stone you can use this command:
/fill 60 60 60 70 70 70 stone replace cobblestone