How do I use the /fill command to fill multiple areas?

How do you use the /fill
command to fill multiple things? For example, how do you use the /fill
command to fill stone and cobblestone, all in random places inside where you set the coordinates? I'm making a prison game where there is a mine which refills itself with random ores and stone and stuff when you hit a button.
Best Answer
What you are asking for isn't a simple /fill
, but a system that can generate a cube of stone filled with ores. Imagine the cube just being a bunch of stacked layers that each have been randomly filled with ores.
Summon an armorstand in the bottom corner at the -x -z side of the mine and name it `Layer
/summon ArmorStand x y z {CustomName:Layer,NoGravity:1,Invisible:1,Marker:1}
This will be the pointer of the current layer.
We will also need some armorstands to mark the ores
/execute @e[type=ArmorStand,name=Layer] ~ ~ ~ summon ArmorStand ~ ~ ~ {CustomName:Ore,NoGravity:1,Invisible:1,Marker:1}
You can name some of the armorstands GoldOre
or DiamondOre
ect for diffrent ores (The more armorstands summoned, the more ores per layer)
We will first of all fill the layer with stone. (our mine will be 11*11 in this example)
/execute @e[type=ArmorStand,name=Layer] ~ ~ ~ fill ~ ~ ~ ~10 ~ ~10 stone
now spread the armorstands randomly along the layer
/execute @e[type=ArmorStand,name=Layer] ~ ~ ~ spreadplayers ~5.5 ~5.5 0 5 false @e[type=ArmorStand,r=2,name=!Layer]
make the Ore armorstands place some ores below them (do this for all ore types)
/execute @e[type=ArmorStand,name=Ore] ~ ~ ~ setblock ~ ~-1 ~ coal_ore
Tp The ore armorstands to Layer
/tp @e[type=ArmorStand,name=Ore] @e[type=ArmorStand,name=Layer]
and finally tp Layer
one block up and repeat
/tp @e[type=ArmorStand,name=Layer] ~ ~1 ~
Pictures about "How do I use the /fill command to fill multiple areas?"



How do you fill an area with multiple blocks in Minecraft?
Show activity on this post. Do /fill then both of your coordinates, 50 wood, 50 stone or any other block. It will be random but both of the blocks will be placed.How do you fill a large area in Minecraft with commands?
If you're willing to be patient for 1.8 to come out, you can use the /fill command.How many blocks can you fill with the Fill command?
Fill command can't place blocks in the void or beyond the world limit. It can place up to 32,768 blocks at once.HOW TO USE THE FILL COMMAND ON MINECRAFT
More answers regarding how do I use the /fill command to fill multiple areas?
Answer 2
The fill command doesn't have a functionality like this. However, there is a way I can think of that you could make this work. It would be something like this:
In the area you would like to fill with blocks, you could place armor stands in each block location with NBT tags set to {Marker:1,Invisible:1,Invulnerable:1,NoGravity:1,CustomName:"block"}
.
This would make the armor stands have no hitbox, they would be invisible, indestructible, and not be effected by gravity.
From there, you could use the execute command like so
execute @r[type=!Player,name=block,c=4] ~ ~ ~ detect ~ ~ ~ air 0 setblock ~ ~ ~ gold_ore 0 replace
As an extension to the execute command, the detect component allows you to check if there is a certain type of block relative to the entity being targeted by the execute command. To change the number of random armor stands to select to perform the setblock command, just adjust the c=?
portion to your liking. That would allow you to set maximum amounts of ore types and such that you would like to be generated.
The larger the area you wish to make mine-able, the more impractical this approach becomes. Hope it helps though.
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Gustavo Fring, Sora Shimazaki, Jill Burrow, Sora Shimazaki