14

I'd like to be able to select a region (either with a graphical utility or command line) and be able to switch one block type with another, e.g. change all cobblestone in the region to stone. Does a program/mod exist that can do this?

23
+100

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:

/fill <x1> <y1> <z1> <x2> <y2> <z2> stone 0 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.

  • 2
    What is the 0 after the stone for? – Geoffrey Hale May 24 '18 at 13:39
  • 3
    As of Minecraft 1.13, that 0 argument is not needed (and probably not valid) anymore. – NetherGranite Jun 30 at 1:04
11

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.

  • As the question refer to "Within a region" and i interpret it as a MCRegion aka a chunk, I would add on to the question the command /chunk which selects the chunks that your region encompasses. – DarkDestry Sep 22 '14 at 15:37
3

MCEdit has this capability. As an example, I made a selection that included grass blocks, and replaced the grass in that selection with cobblestone:

Before

After

The tool that's selected in the first image is the find tool. Once open, there's an option to change it to find and replace. Then it's just as easy as selecting your two block types and hitting replace.

3

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

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