Commands/fill

From Minecraft Wiki
Jump to: navigation, search
fill
Restrictions

Operator

First introduced

1.8 (14w03a)
PE Alpha 0.16.0 (PE Alpha 0.16.0 build 1)

Fills all or parts of a region with a specific block.

Syntax
  • Java Edition
fill <x1> <y1> <z1> <x2> <y2> <z2> <block> [dataValue|state] [oldBlockHandling] [dataTag]
The fill command also has an optional alternate syntax when using the replace option:
fill <x1> <y1> <z1> <x2> <y2> <z2> <block> <dataValue|state> replace [replaceTileName] [replaceDataValue]
  • Pocket Edition
fill <from: x y z> <to: x y z> <tileName: string> [tileData: int] [oldBlockHandling: string] [replaceTileName: string] [replaceDataValue: int]
Color added to make reading easier.
Arguments
x1 y1 z1 and x2 y2 z2 (PE: from: x y z and to: x y z)
Specifies any two opposing corner blocks of the region to be filled (the "fill region"). May use tilde notation to specify distances relative to the command's execution.
The blocks that make up the corners extend in the positive direction from the coordinates used to identify them. Because of this, the lesser coordinates of each axis will be right on the region boundary, but the greater coordinates will be one block from the boundary, and the block volume of the source region will be (xgreater - xlesser + 1) × (ygreater - ylesser + 1) × (zgreater - zlesser + 1). For example, 0 0 0 0 0 0 has a 1-block volume, and 0 0 0 1 1 1 and 1 1 1 0 0 0 both identify the same region with an 8-block volume.
block (PE: tileName: string)
Specifies the block to fill the region with. Must be a block id (for example, minecraft:stone).
dataValue (PE: tileData: int) (optional)
Specifies the block data to use for the fill block. Must be between 0 and 15 (inclusive).
state (optional)[Java Edition only]
Specifies the block state to use for the fill block. Must be a valid block state for the block specified in block.
oldBlockHandling (PE: oldBlockHandling: string) (optional)
Must be one of:
  • destroy - Replaces all blocks (including air) in the fill region with the specified block, dropping the existing blocks (including those that are unchanged) and block contents as entities as if they had been mined with an unenchanted diamond shovel or pickaxe. (Blocks that can only be mined with shears, such as vines, will not drop; neither will liquids.)
  • hollow - Replaces only blocks on the outer edge of the fill region with the specified block. Inner blocks are changed to air, dropping their contents as entities but not themselves. If the fill region has no inner blocks (because it is smaller than three blocks in at least one dimension), acts like replace.
  • keep - Replaces only air blocks in the fill region with the specified block.
  • outline - Replaces only blocks on the outer edge of the fill region with the specified block. Inner blocks are not affected. If the fill region has no inner blocks (because it is smaller than three blocks in at least one dimension), acts like replace.
  • replace - Replaces all blocks (including air) in the fill region with the specified block, without dropping blocks or block contents as entities. Optionally, instead of specifying a data tag for the replacing block, block id and data values may be specified to limit which blocks are replaced (see replaceTileName and replaceDataValue below)
If not specified, defaults to replace.
dataTag (optional)[Java Edition only]
Specifies the data tag to use for the fill block (for example, contents of a chest, patterns on a banner, etc.). Must be a compound NBT tag (for example, {CustomName:Fred}). Cannot be combined with the replaceTileName and replaceDataValue arguments.
replaceTileName and replaceDataValue (PE: replaceTileName: string and replaceDataValue: int) (optional)
Arguments are only valid when oldBlockHandling is replace. Cannot be combined with the dataTag argument.
Specifies the block id and data of the blocks in the fill region to be replaced. If replaceDataValue is not specified, data value is ignored when determining which blocks to replace. If both arguments are not specified, replaces all blocks in the fill region.
Result
Fails if the arguments are not specified correctly, if the fill region is not rendered, if the block volume of the fill region is greater than 32768, if dataValue or dataTag are invalid for the specified block id, or if no blocks were changed. However, in Pocket Edition, you can fill unlimited blocks unless one of the sides of the filled blocks is 1 block long.
On success, changes blocks in the fill region to the specified block.
Examples
/fill 52 63 -1516 33 73 -1536 minecraft:gold_block 0 replace minecraft:stained_hardened_clay 1
Replaces all the orange stained hardened clay in the selected area with gold blocks.
/fill ~-3 ~-3 ~-3 ~3 ~-1 ~3 minecraft:water 0
Replaces the blocks in a 7x7x3 cube directly beneath the player with water.
/fill ~-3 ~ ~-4 ~3 ~4 ~4 minecraft:planks 2 hollow
Creates a house-sized box around the player, replacing any blocks that would have been inside the box with air.