Commands/fill

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

Syntax

 * Java Edition


 * The fill command also has an optional alternate syntax when using the  option:




 * Bedrock Edition

Arguments

 * x1 y1 z1 and x2 y2 z2 (BE: 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,  has a 1-block volume, and   and   both identify the same region with an 8-block volume.


 * block (Bedrock: tileName: Block)
 * Specifies the block to fill the region with. Must be a block id (for example, ).


 * tileData: int (optional)
 * Specifies the block data to use for the fill block. Must be between 0 and 15 (inclusive).


 * [destroy|hollow|keep|outline|replace] (optional)
 * - 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.)
 * - 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.
 * - Replaces only air blocks in the fill region with the specified block.
 * - 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.
 * - 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.


 * dataTag (optional)
 * 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, ). Cannot be combined with the replaceTileName and replaceDataValue arguments.


 * replaceTileName (Bedrock: replaceTileName: Block and replaceDataValue: int) (optional)
 * Arguments are only valid when  is used.
 * 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 Bedrock 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

 * Replaces all the orange stained hardened clay in the selected area with gold blocks.
 * Replaces the blocks in a 7x7x3 cube directly beneath the player with water.
 * Creates a house-sized box around the player, replacing any blocks that would have been inside the box with air.
 * Replaces the blocks in a 7x7x3 cube directly beneath the player with water.
 * Creates a house-sized box around the player, replacing any blocks that would have been inside the box with air.
 * Creates a house-sized box around the player, replacing any blocks that would have been inside the box with air.

History
Команды консоли/fill