20

I'd like to be able to select a region, either with an outside graphical utility or command line, or with native Minecraft commands, and be able to replace all blocks of one block type with another type, e.g. change all cobblestone in the region to stone. Does a program/mod exist that can do this? What about commands?

4 Answers 4

35
+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:

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.

0
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.

1
  • 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
    Commented Sep 22, 2014 at 15:37
6

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
4

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .