function fillCube(startingX: integer, startingY: integer, startingZ: integer):
set {_loc} to location at {_startingX}, {_startingY}, {_startingZ} in world "cpi"
loop 30 times:
loop 30 times:
loop 30 times:
# All these thirties are, respectively, the height (y), width (z) and length (x) of the cube.
chooseBlock({_loc})
add 1 to x-coordinate of {_loc}
add 1 to z-coordinate of {_loc}
set x-coordinate of {_loc} to {_startingX}
add 1 to y-coordinate of {_loc}
set x-coordinate of {_loc} to {_startingX}
set z-coordinate of {_loc} to {_startingZ}
function chooseBlock(loc: location):
# The function that handles which blocks are going to be placed. I tried to code something a little more dynamic than long, monotonous 'chance of' blocks
set {_percentages::*} to 5%, 10%, 15%, 20% and 100%
set {_blocks::*} to dirt, gold ore, iron ore, stone and cobblestone
loop {_percentages::*}:
chance of loop-value:
set block at {_loc} to {_blocks::%loop-index%}
stop loop
on script load:
# Usage:
fillCube(0, 120, 0) # Specify the coordinates of one of the corners of the cube in the parameters.
# Note that you need to check if it is the right one by looking at the opposite corner of the cube, that is, the one diagonal to it, and check if the x-values and z-values in that direction are positive, since in the function we are constantly ADDING x and z coordinates.