Minecraft:Commands/fill: Difference between revisions
More actions
Remove broken links to missing pages |
Fix template calls: add MC/ prefix |
||
| Line 24: | Line 24: | ||
==Arguments== | ==Arguments== | ||
{{ | {{MC/El|je|short=1}}: {{MC/Argument|from|block_pos}} and {{MC/Argument|to|block_pos}}<br> | ||
{{ | {{MC/El|be|short=1}}: {{MC/Argument|be=1|from: x y z|CommandPosition}} and {{MC/Argument|be=1|to: x y z|CommandPosition}} | ||
: Specifies any two opposing corner blocks of the region to be filled (the "fill region"). | : Specifies any two opposing corner blocks of the region to be filled (the "fill region"). | ||
: {{ | : {{MC/Arg desc|je=block_pos|be=CommandPosition}} | ||
: 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 (x<sub>greater</sub> - x<sub>lesser</sub> + 1) × (y<sub>greater</sub> - y<sub>lesser</sub> + 1) × (z<sub>greater</sub> - z<sub>lesser</sub> + 1). For example, <code>0 0 0 0 0 0</code> has a 1-block volume, and <code>0 0 0 1 1 1</code> and <code>1 1 1 0 0 0</code> both identify the same region with an 8-block volume. | : 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 (x<sub>greater</sub> - x<sub>lesser</sub> + 1) × (y<sub>greater</sub> - y<sub>lesser</sub> + 1) × (z<sub>greater</sub> - z<sub>lesser</sub> + 1). For example, <code>0 0 0 0 0 0</code> has a 1-block volume, and <code>0 0 0 1 1 1</code> and <code>1 1 1 0 0 0</code> both identify the same region with an 8-block volume. | ||
{{ | {{MC/Argument|block|block_state|tileName: Block|enum}} | ||
: Specifies the block to fill the region with. | : Specifies the block to fill the region with. | ||
: {{ | : {{MC/Arg desc|je=block_state|be=Block}} | ||
{{ | {{MC/El|be|short=1}}: {{MC/Argument|be=1|blockStates: block states|BlockStateCommandParam}} | ||
: Specifies the block states to use for the block. | : Specifies the block states to use for the block. | ||
: {{Arg desc|be=BlockStateCommandParam}} | : {{MC/Arg desc|be=BlockStateCommandParam}} | ||
{{ | {{MC/El|je|short=1}}: {{cd|d=and|outline{{!}}hollow{{!}}destroy{{!}}strict{{!}}replace{{!}}keep|replace|outline{{!}}hollow{{!}}destroy{{!}}strict}}<br> | ||
{{ | {{MC/El|be|short=1}}: {{MC/Argument|be=1|oldBlockHandling: FillMode|enum}} | ||
: Specifies the handling of the block changes. Must be one of the following: | : Specifies the handling of the block changes. Must be one of the following: | ||
:* <code>destroy</code> - 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 [[Minecraft:shovel]] or [[Minecraft:pickaxe]]. (Blocks that can be mined only with shears, such as [[Minecraft:vines]], do not drop; neither do liquids.) | :* <code>destroy</code> - 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 [[Minecraft:shovel]] or [[Minecraft:pickaxe]]. (Blocks that can be mined only with shears, such as [[Minecraft:vines]], do not drop; neither do liquids.) | ||
| Line 49: | Line 49: | ||
:If not specified, defaults to <code>replace</code>. | :If not specified, defaults to <code>replace</code>. | ||
{{ | {{MC/Argument|filter|block_predicate|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. | : Specifies the ID of the blocks in the fill region to be replaced. If not specified, replaces all blocks in the fill region. | ||
: {{ | : {{MC/Arg desc|je=block_predicate|be=Block}} | ||
{{ | {{MC/El|be|short=1}}: {{MC/Argument|be=1|replaceBlockStates: block states|BlockStateCommandParam}} | ||
: Specifies the block states to use for the block to be replaced. | : Specifies the block states to use for the block to be replaced. | ||
: {{Arg desc|be=BlockStateCommandParam}} | : {{MC/Arg desc|be=BlockStateCommandParam}} | ||
==Result== | ==Result== | ||
| Line 71: | Line 71: | ||
== Output == | == Output == | ||
{{Output table}} | {{MC/Output table}} | ||
{{Output table|edition=je|On fail|0|0|0}} | {{MC/Output table|edition=je|On fail|0|0|0}} | ||
{{Output table|cmd=/fill ... hollow<br>/fill ... keep<br>/fill ... outline<br>/fill ... replace ...|On success|1|1|the number of blocks changed in the fill region}} | {{MC/Output table|cmd=/fill ... hollow<br>/fill ... keep<br>/fill ... outline<br>/fill ... replace ...|On success|1|1|the number of blocks changed in the fill region}} | ||
{{Output table|cmd=/fill ... destroy|On success|1|1|the number of blocks changed in the fill region}} | {{MC/Output table|cmd=/fill ... destroy|On success|1|1|the number of blocks changed in the fill region}} | ||
{{Output table|cmd=|edition=be|On fail|0}} | {{MC/Output table|cmd=|edition=be|On fail|0}} | ||
{{Output table|On success|1}} | {{MC/Output table|On success|1}} | ||
{{Output table}} | {{MC/Output table}} | ||
==Examples== | ==Examples== | ||
| Line 95: | Line 95: | ||
== History == | == History == | ||
{{Expand section}} | {{MC/Expand section}} | ||
=== ''Java Edition'' === | === ''Java Edition'' === | ||
{{HistoryTable | {{HistoryTable | ||
|{{HistoryLine|java}} | |{{MC/HistoryLine|java}} | ||
|{{HistoryLine||1.8|dev=14w03a|Added {{ | |{{HistoryLine||1.8|dev=14w03a|Added {{MC/Cmd|fill|link=none}}.}} | ||
|{{HistoryLine||1.11|dev=16w32a|Added block state support to {{ | |{{HistoryLine||1.11|dev=16w32a|Added block state support to {{MC/Cmd|fill|link=none}}.}} | ||
|{{HistoryLine||1.19.4|dev=23w03a|Now the limit volume of the fill region is controlled by <code>commandModificationBlockLimit</code> gamerule, instead of a hardcoded value 32768.}} | |{{MC/HistoryLine||1.19.4|dev=23w03a|Now the limit volume of the fill region is controlled by <code>commandModificationBlockLimit</code> gamerule, instead of a hardcoded value 32768.}} | ||
|{{HistoryLine||1.21.5|dev=25w02a|The behavior of {{ | |{{HistoryLine||1.21.5|dev=25w02a|The behavior of {{MC/Cmd|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: <code>strict</code>.|New syntax for commands to use the new strict option, and more flexible use of replace.}} | ||
|{{HistoryLine||1.21.11|dev=25w44a|All game rules have now been moved into a registry. Therefore <code>commandModificationBlockLimit</code> has been renamed to <code>max_block_modifications</code>.}}}} | |{{MC/HistoryLine||1.21.11|dev=25w44a|All game rules have now been moved into a registry. Therefore <code>commandModificationBlockLimit</code> has been renamed to <code>max_block_modifications</code>.}}}} | ||
=== ''Bedrock Edition'' === | === ''Bedrock Edition'' === | ||
{{HistoryTable | {{HistoryTable | ||
|{{HistoryLine|pocket alpha}} | |{{MC/HistoryLine|pocket alpha}} | ||
|{{HistoryLine||v0.16.0|dev=build 1|Added {{ | |{{HistoryLine||v0.16.0|dev=build 1|Added {{MC/Cmd|fill|link=none}}.}} | ||
|{{HistoryLine|bedrock}} | |{{MC/HistoryLine|bedrock}} | ||
|{{HistoryLine||1.16.210|dev=beta 1.16.210.53|Added block state support to {{ | |{{HistoryLine||1.16.210|dev=beta 1.16.210.53|Added block state support to {{MC/Cmd|fill|link=none}}.}} | ||
|{{HistoryLine||1.19.70|dev=Preview 1.19.70.21|Removed <code>tileData: int</code> and <code>replaceDataValue: int</code> arguments.}} | |{{MC/HistoryLine||1.19.70|dev=Preview 1.19.70.21|Removed <code>tileData: int</code> and <code>replaceDataValue: int</code> arguments.}} | ||
}} | }} | ||
| Line 120: | Line 120: | ||
== Navigation == | == Navigation == | ||
{{Navbox commands}} | {{MC/Navbox commands}} | ||
de:Befehl/fill | de:Befehl/fill | ||
Latest revision as of 20:09, 9 April 2026
Fills all or parts of a region with a specific Minecraft:block.
Syntax
- Java Edition
fill <from> <to> <block> [outline|hollow|destroy|strict|replace|keep]fill <from> <to> <block> replace <filter> [outline|hollow|destroy|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
replacemode: 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
- REDIRECT Template:Edition
Template:Rcat: <from>: block_pos and <to>: block_pos
- REDIRECT Template:Edition
Template:Rcat: 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").
- {{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|block_pos}}{{#vardefine:be-arg|block_pos}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
- 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 0has a 1-block volume, and0 0 0 1 1 1and1 1 1 0 0 0both identify the same region with an 8-block volume.
Template:El: <block>: block_state
Template:El: tileName: Block: enum
- Specifies the block to fill the region with.
- {{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|block_state}}{{#vardefine:be-arg|block_be}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
- REDIRECT Template:Edition
Template:Rcat: blockStates: block states: BlockStateCommandParam
- Specifies the block states to use for the block.
- {{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|blockstatecommandparam}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
- REDIRECT Template:Edition
- REDIRECT Template:Edition
Template:Rcat: 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 Minecraft:shovel or Minecraft:pickaxe. (Blocks that can be mined only with shears, such as Minecraft: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, 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.
Template:El: <filter>: block_predicate
Template:El: 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.
- {{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|block_predicate}}{{#vardefine:be-arg|block_be}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
- REDIRECT Template:Edition
Template:Rcat: replaceBlockStates: block states: BlockStateCommandParam
- Specifies the block states to use for the block to be replaced.
- {{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|blockstatecommandparam}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
Result
Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table
Output
{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-table-lines|-2}}{{#vardefine:output-table-lines-now|}}{{#vardefine:command-num-now|}}{{#vardefine:command-line-now|}}{{#vardefine:commands-num|}}{{#vardefine:output-edition-num-now|}}{{#vardefine:output-edition-line-now|}}{{#vardefine:output-editions-num|}}{{#vardefine:je-outputs-dis|}}
{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On fail}}{{#vardefine:output1-{{#var:output-table-lines}}|0}}{{#vardefine:output2-{{#var:output-table-lines}}|0}}{{#vardefine:output3-{{#var:output-table-lines}}|0}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-editions-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-{{#var:output-editions-num}}|je}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|1}}
{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|1}}{{#vardefine:output2-{{#var:output-table-lines}}|1}}{{#vardefine:output3-{{#var:output-table-lines}}|the number of blocks changed in the fill region}}{{#vardefine:commands-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:command-{{#var:commands-num}}|/fill ... hollow}}{{#vardefine:command-row-{{#var:commands-num}}|1}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|Expression error: Unrecognized punctuation character "{".}}
{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|1}}{{#vardefine:output2-{{#var:output-table-lines}}|1}}{{#vardefine:output3-{{#var:output-table-lines}}|the number of blocks changed in the fill region}}{{#vardefine:commands-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:command-{{#var:commands-num}}|
/fill ... keep
/fill ... outline
/fill ... replace .../fill ... destroy}}{{#vardefine:command-row-{{#var:commands-num}}|1}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|Expression error: Unrecognized punctuation character "{".}}
{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On fail}}{{#vardefine:output1-{{#var:output-table-lines}}|0}}{{#vardefine:output2-{{#var:output-table-lines}}|N/A}}{{#vardefine:output3-{{#var:output-table-lines}}|N/A}}{{#vardefine:commands-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:command-{{#var:commands-num}}|Any}}{{#vardefine:command-row-{{#var:commands-num}}|1}}{{#vardefine:output-editions-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-{{#var:output-editions-num}}|be}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|1}}
{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|1}}{{#vardefine:output2-{{#var:output-table-lines}}|N/A}}{{#vardefine:output3-{{#var:output-table-lines}}|N/A}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|Expression error: Unrecognized punctuation character "{".}}
{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-table-lines|-2}}{{#vardefine:output-table-lines-now|}}{{#vardefine:command-num-now|}}{{#vardefine:command-line-now|}}{{#vardefine:commands-num|}}{{#vardefine:output-edition-num-now|}}{{#vardefine:output-edition-line-now|}}{{#vardefine:output-editions-num|}}{{#vardefine:je-outputs-dis|}}
Examples
/fill 52 63 -1516 33 73 -1536 minecraft:gold_block replace minecraft:orange_glazed_terracottaTemplate:Only/fill 52 63 -1516 33 73 -1536 gold_block [] replace orange_glazed_terracottaTemplate: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 hollowTemplate:Only/fill ~-3 ~ ~-4 ~3 ~4 ~4 stone 0 hollowTemplate: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
Template:Message boxTemplate:Article other
Java Edition
Bedrock Edition
External links
de:Befehl/fill es:Comandos/fill fr:Commandes/fill ja:コマンド/fill ko:명령어/fill pt:Comandos/fill ru:Команды консоли/fill uk:Команди консолі/fill zh:命令/fill