Hardware Reference
In-Depth Information
4. Next, create the glass walls by creating a cube of GLASS blocks and then clearing
the area in the middle by creating a cube of AIR inside the GLASS :
mc.setBlocks(pos.x - 1, pos.y + 1, pos.z - 1,
pos.x + ARENAX + 1, pos.y + ARENAY,
pos.z + ARENAZ + 1,
block.GLASS.id)
mc.setBlocks(pos.x, pos.y + 1, pos.z,
pos.x + ARENAX, pos.y + ARENAY,
pos.z + ARENAZ,
block.AIR.id)
5. he createArena() function is now complete, but it still needs to be called
from the main program. Add the following to the bottom of the program to get
the player's position and pass it as a variable to the createArena() function:
arenaPos = mc.player.getTilePos()
createArena(arenaPos)
6. It's time to run the program! You should see the arena built next to the player, as
in FigureĀ 9-3.
FIGURE.9-3 Create the game arena.
Search WWH ::




Custom Search