Hardware Reference
In-Depth Information
blocks in the Minecraft world that have extra data, too, and each type of block
uses it in a different way. For WOOL , the “extra data” number selects the colour
of the block. This useful feature makes WOOL a versatile block to build with,
because you can choose any colour from a palette of supported colours, allow-
ing you to make your designs much more colourful and realistic.
At the end of this adventure you will find a table listing the numbers and their
associated colours for the WOOL block. Appendix B also lists various other block
types that have an extra data value that you can change.
If you have seen other Minecraft programs on the Internet, you might be
wondering why in this topic blocks are always referred to like this: block.
WOOL.id . Why do you always put the .id at the end of the block? And why is it
that other programs on the Internet don't do this? This is because setBlock()
and setBlocks() sometimes don't work when the “extra data” field is used,
unless you put the .id at the end of the block. So, to keep everything simple and
consistent in this topic, we decided always to use .id with blocks so that every
time you use it, it looks the same. You don't always have to put the .id at the
end, but it makes sense to put it there so you don't have to remember when you
have to use it and when you don't.
Try changing the SIZE constant in your program to a bigger number, such as 50,
and running your program again. What happens to your house when you do this?
Try changing SIZE to a small number like 10. What happens to your house now?
Why do you think this happens when the number stored in the SIZE constant
is very small?
Building More than.One House
Building one house is fun, but why stop there? Thinking back to your tower.py pro-
gram from earlier in this adventure, it's easy to write a for loop that repeats program
statements a fixed number of times. So, it must therefore be possible to build a whole
street of houses, or even a whole town, just by looping through your house-building
program many times.
Before you do this, though, you're going to improve your house-building program a
little, to make sure it doesn't get too big and complex to manage.
 
Search WWH ::




Custom Search