Cloning/filling blocks

You can use these commands to move, copy or create big sections of blocks.


This video shows the clone command being called by command blocks activated by a minecart. The commands keep the rail going indefinitely. You can download the map here.

Cloning blocks

The clone command copies one section of the map to another area of the map. It has options to copy or move. It also has options to only clone blocks of a certain type or to clone non-air blocks. If possible, avoid cloning the same command block that uses the /clone command.

There are three types of clone commands: Replace, masked or filtered.

  • Replace: clone all block, overwriting the original blocks (the default)
  • Masked: clone only non-air blocks
  • Filtered: clone only blocks of a certain type

For replace or masked clone commands:

Syntax: /clone [begin x y z] [end x y z] [destination x y z] [replace OR masked] [normal OR force OR move]

The clone command uses two sets of coordinates to select the area. They represent diagonally opposite corners of a box. The destination coordinates are where the box will be cloned to (the lowest x y z corner). Relative coordinates using ~ can also be used.

The second optional argument is one of the following:

  • Normal: Don't force or move (the default)
  • Force: Clones even if the source and destination areas overlap
  • Move: Replaces the destination area with air

For the filtered clone command, a block name and optional tileData number are added. The command only clones the blocks that match this type.

Syntax: /clone [begin x y z] [end x y z] [destination x y z] filtered [normal OR force OR move] [block name] [tileData number]

The [block name] is just the name of the block (Example: cobblestone) that will be cloned. You can also use a more generic block name like stone and then give a number for the specific tileData number 0-15 (Example: wool 5 will give you orange wool.) The default tileData number is 0.

Here are some examples:

/clone 10 100 10 -10 105 -10 -10 200 -10 replace move

/clone 10 100 10 -10 105 -10 -10 200 -10 filtered normal cobblestone


Setblock

The /setblock command is very similar to the /fill command except that it only does one block.

Syntax: /setblock [position x y z] [block name] [tileData number] [replace OR destroy OR keep]

The last argument has three options:

  • replace (the default): The old block is replaced with the new one. Neither the block nor its contents drop.
  • destroy: The original is destroyed and drops the block and its contents.
  • keep: Only changes if the original was air.

Here are some examples:

/setblock ~ ~5 ~ cobblestone


Filling blocks

The /fill command fills a box with one type of block. It does not have a source like the /clone command. It can be used to quickly fill or destroy large sections of blocks. You can't create blocks that need to be attached to other block, such as buttons or doors.

Syntax:
/fill [from: x y z] [to: x y z] [block name] [tileData number] [outline OR hollow OR destroy OR keep]
/fill [from: x y z] [to: x y z] [block name] [tileData number] replace [block name] [tileData number]

The /fill command has five options:

  • Outline: Replaces only the blocks on the outer edge of the fill area. Block inside stay intact.
  • Hollow: Replaces the blocks on the outer edge of the fill area. Inner blocks are changed to air.
  • Destroy: Replaces all block in the area. Original blocks and their contents drop.
  • Keep: Replaces only the air blocks.
  • Replace (default): Replaces only the blocks that match the second [block name] and [tileData number]. If second [block name] and [tileData number] are not given, all blocks are replaced.

Here are some examples:

/fill 52 100 -15 100 73 -20 stone 0 replace wool 5

/fill 52 100 -15 100 73 -20 blue_ice hollow



Previous lesson: Environment


Copyright 2020, Peacemaker Media Empire.   |