Hardware Reference
In-Depth Information
FIGURE.3-4
After running
clearSpace.py
, note how some of the trees are sawn
off at the trunks!
CHALLENGE
The
clearSpace.py
program clears a cuboid space near the player, using the
player's position as the bottom left corner of that space. However it depends
which way your player is facing as to whether you will see this space at first
without turning around. It might be more convenient for your purposes if it
cleared some space with the player at the centre of that space. If so, you can
modify the relative coordinates in your
setBlocks()
statement to calculate
the two corner coordinates of the 3D rectangle to clear, so that your player is
placed at the centre. You might also want to get
clearSpace.py
to “dig
down” a few blocks by reducing the y coordinate, to give you some space to lay
foundations, grass or other ground blocks. Try this now to see if you can work
out how to do it. It will be a much more useful program!
Building a House
When playing Minecraft in survival mode, one of the first things you need to is build a
shelter for your player to protect him from the dangers lurking in the Minecraft night.
What if you could build a house with the touch of a button? Fortunately, when pro-
gramming with Minecraft, you can turn complex tasks into just that—the touch of a
button.