Hardware Reference
In-Depth Information
Drawing Lines
he
MinecraftDrawing
object has a function called
drawLine()
, which when
called and passed two positions (x, y, z) and a block type as parameters it will create a
line of blocks between those position. Just like the
setBlocks()
function you first
learnt about in Adventure 3.
When a function needs information in order to run, such as
setBlock()
which
needs an x, y, z and a block type, these values are known as
parameters
. When
a program uses that function it is said to
call
it and
pass
parameters.
The following function creates the line of blocks like that shown in Figure 7-2:
drawLine(x1, y1, z1, x2, y2, z2, blockType, blockData)
FIGURE.7-2
he
drawLine()
function creates a line of blocks between two sets of
x,y,z points.
Now update your program so that it uses the
drawLine()
function to create three
lines in Minecraft — one straight up, one across and one diagonal from the players
position. Add the following code to the bottom of the
LinesCirclesAndSpheres.
py
program: