Hardware Reference
In-Depth Information
CHALLENGE
Define a house2() function that draws a different type of house. Use random-
ness in the main for loop to create one of two houses based on a random
number. Every house you build will be random. Extend this program to build
three different types of house. The more different types of house you build, the
more interesting your street will become. You could even experiment with nega-
tive coordinates like y=-5 to build a basement or even a swimming pool inside
your house!
To a large extent, the sort of huge structures you can build in Minecraft is limited
only by your imagination. There is a limit to the height of the Minecraft world,
of course, and that will restrict the height of the tallest structure you can build.
And some buildings in real life have slanting or curved structures. For example,
look at the design of The Shard, currently the tallest building in the European
Union at http://the-shard.com . This amazing building would be possible to build in
Minecraft, but because it has slanted edges it will be more difficult.
Be patient and start off with simple structures that are mainly rectangular in
shape. In Adventure  7, Martin will introduce you to some extra special helper
functions that are capable of building angled lines and curves. After that, there
will be no limit to the type of buildings you can build in your Minecraft world!
There are two other restrictions on how big you can build things in Minecraft—
how much memory the computer has, and how far you can see in front of you.
A larger structure takes up more computer memory; the size of the Minecraft
world has edges to it, so that the amount of memory required to store it is
practical. Secondly, your player can only see a certain distance, especially so on
the Raspberry Pi, which has a very limited viewing distance.
Quick Reference Table
Importing and using the block name
constants
Setting/changing a block at a
position
import mcpi.block as block
b = block.DIRT.id
mc.setBlock(5, 3, 2, block.DIRT.id)
Setting/changing lots of blocks in one go
Useful block types for houses
mc.setBlocks(0,0,0,5,5,5,block.DIRT.id)
block.AIR.id
block.STONE.id
block.COBBLESTONE.id
block.GLASS.id
block.WOOD.id
block.WOOL.id
block.SLATE.id
Search WWH ::




Custom Search