/fill
< Commands
{ "title": "<code>/fill</code>", "rows": [ { "field": "\n* 2 <sup class=\"noprint nowrap Inline-Template \" title=\"\">[<i><span title=\"This statement only applies to Java Edition\">(link to Java Edition article, displayed as JE) only</span></i>]</sup>\n* 1 <sup class=\"noprint nowrap Inline-Template \" title=\"\">[<i><span title=\"This statement only applies to Bedrock Edition\">(link to Bedrock Edition article, displayed as BE) only</span></i>]</sup>", "label": "(link to Permission level article, displayed as Permission level<br>required)" }, { "field": "(link to Options article, displayed as Cheat) only<sup class=\"noprint nowrap Inline-Template \" title=\"\">[<i><span title=\"This statement only applies to Bedrock Edition\">(link to Bedrock Edition article, displayed as BE) only</span></i>]</sup>", "label": "(link to Commands#Restrictions article, displayed as Restrictions)" } ], "invimages": [], "images": [] }
Fills all or parts of a region with a specific block.
Syntax[edit | edit source]
- Java Edition
fill <from> <to> <block> keep
fill <from> <to> <block> [replace <filter>] [destroy|hollow|outline|strict]
- Bedrock Edition
fill <from: x y z> <to: x y z> <tileName: Block> <blockStates: block states> [oldBlockHandling: FillMode]
fill <from: x y z> <to: x y z> <tileName: Block> [oldBlockHandling: FillMode]
- The fill command also has an optional alternate syntax for
replace
mode: fill <from: x y z> <to: x y z> <tileName: Block> <blockStates: block states> replace [replaceTileName: Block] [replaceBlockStates: block states]
fill <from: x y z> <to: x y z> <tileName: Block> replace [replaceTileName: Block] [replaceBlockStates: block states]
Arguments[edit | edit source]
JE: <from>
: block_pos and <to>
: block_pos
BE: from: x y z
: CommandPosition and to: x y z
: CommandPosition
- Specifies any two opposing corner blocks of the region to be filled (the "fill region").
- In Java Edition, must be a block position composed of
<X>
,<Y>
and<Z>
, each of which must be an integer or a tilde and caret notation. In Bedrock Edition, must be a three-dimensional coordinates composed of<X>
,<Y>
and<Z>
, each of which must be a single-precision floating-point number or tilde and caret notation. - Block position is the coordinates of the point at the lower northwest corner of a block. Because of this, the lesser coordinates of each axis are on the region boundary, but the greater coordinates are one block from the boundary, and the block volume of the source region is (xgreater - xlesser + 1) × (ygreater - ylesser + 1) × (zgreater - zlesser + 1). For example,
0 0 0 0 0 0
has a 1-block volume, and0 0 0 1 1 1
and1 1 1 0 0 0
both identify the same region with an 8-block volume.
JE: <block>
: block_state
BE: tileName: Block
: enum
- Specifies the block to fill the region with.
- In Java Edition, must be in the format of
block_id[block_states]{data_tags}
(does not accept block tags), in which block states and data tags can be omitted when they are not needed. In Bedrock Edition, must be a block id.
BE: blockStates: block states
: BlockStateCommandParam
- Specifies the block states to use for the block.
- Must be a blockstate argument as
["<state1>"=<value1>,"<state2>"=<value2>,...]
. For example:["old_leaf_type"="birch","persistent_bit"=true]
.
JE: destroy|hollow|keep|outline|replace
, keep
, and destroy|hollow|outline|strict
BE: oldBlockHandling: FillMode
: enum
- Specifies the handling of the block changes. Must be one of the following:
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 be mined only with shears, such as vines, do not drop; neither do liquids.)hollow
- Replaces only the 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 likereplace
.keep
- Replaces only the air blocks in the fill region with the specified block.outline
- Replaces only the 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 likereplace
.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.strict
- Place blocks as-is without triggering block updates and shape updates.
- If not specified, defaults to
replace
.
JE: <filter>
: block_predicate
BE: replaceTileName: Block
: enum
- Specifies the ID of the blocks in the fill region to be replaced. If not specified, replaces all blocks in the fill region.
- In Java Edition, must be in the format of
block_id[block_states]{data_tags}
(accepts block tags), in which block states and data tags can be omitted when they are not needed. In Bedrock Edition, must be a block id.
BE: replaceBlockStates: block states
: BlockStateCommandParam
- Specifies the block states to use for the block to be replaced.
- Must be a blockstate argument as
["<state1>"=<value1>,"<state2>"=<value2>,...]
. For example:["old_leaf_type"="birch","persistent_bit"=true]
.
Result[edit | edit source]
Command | Trigger | Java Edition | Bedrock Edition |
---|---|---|---|
Any | The command is incomplete, or any argument is not specified correctly. | Unparseable | Unparseable |
One or both specified positions are unloaded or out of the world. | Failed | Failed | |
The volume of the source region is greater than commandModificationBlockLimit gamerule value. | |||
/fill ... hollow | No block is changed. | ||
/fill ... destroy | There is no block changed in the fill region. | ||
The specified block is air. | |||
Any | Otherwise | Successful |
Output[edit | edit source]
Command | Edition | Situation | Success Count | /execute store success ... | /execute store result ... |
---|---|---|---|---|---|
Any | Java Edition | On fail | 0 | 0 | 0 |
/fill ... hollow | On success | 1 | 1 | the number of blocks changed in the fill region | |
/fill ... destroy | On success | 1 | 1 | the number of blocks changed in the fill region | |
Any | Bedrock Edition | On fail | 0 | N/A | N/A |
On success | 1 | N/A | N/A |
Examples[edit | edit source]
/fill 52 63 -1516 33 73 -1536 minecraft:gold_block replace minecraft:orange_glazed_terracotta
[Java Edition only]/fill 52 63 -1516 33 73 -1536 gold_block [] replace orange_glazed_terracotta
[Bedrock Edition only]- Replaces all the orange glazed terracotta in the selected area with gold blocks.
/fill ~-3 ~-3 ~-3 ~3 ~-1 ~3 water
- Replaces the blocks in a 7×3×7 region directly beneath the command execution's location with water.
/fill ~-3 ~ ~-4 ~3 ~4 ~4 stone hollow
[Java Edition only]/fill ~-3 ~ ~-4 ~3 ~4 ~4 stone 0 hollow
[Bedrock Edition only]- Creates a house-sized box around the command execution's location, replacing any blocks that would have been inside the box with air.
/fill ~-15 ~-15 ~-15 ~15 ~15 ~15 stone
- Creates a solid cube of stone centered on the command execution's location.
/fill ~-1 ~ ~ ~1 ~ ~ minecraft:prismarine_brick_stairs[facing=south,waterlogged=true]
- Replaces the specific blocks around the command execution's location with waterlogged prismarine brick stairs facing south.
History[edit | edit source]
This section needs expansion.
You can help by expanding it.
[hide]Java Edition | |||||||
---|---|---|---|---|---|---|---|
1.8 | 14w03a | Added /fill . | |||||
1.11 | 16w32a | Added block state support to /fill . | |||||
1.19.4 | 23w03a | Now the limit volume of the fill region is controlled by commandModificationBlockLimit gamerule, instead of a hardcoded value 32768. | |||||
1.21.5 | 25w02a | The behavior of /fill command has changed in how it handles block entity data. | |||||
The replace option in the fill command is no longer terminal, and can be followed with additional options. | |||||||
Accepts a new option: strict . | |||||||
New syntax for commands to use the new strict option, and more flexible use of replace. | |||||||
[hide]Pocket Edition Alpha | |||||||
v0.16.0 | build 1 | Added /fill . | |||||
[hide]Bedrock Edition | |||||||
1.16.210 | beta 1.16.210.53 | Added block state support to /fill . | |||||
1.19.70 | Preview 1.19.70.21 | Removed tileData: int and replaceDataValue: int arguments. |