Hardware Reference
In-Depth Information
FIGURE.3-1 A house built from Minecraft blocks
Creating Blocks
Each type of block in the Minecraft world has its own block number. If you are a regu-
lar Minecraft gamer, you probably already know a lot of block types by their numbers.
However, the Minecraft programming interface allows you to refer to block types by
name rather than number, which makes things much easier. The name is just a con-
stant (you met constants in Adventure  2) that holds the number of the block type.
There is a list of the most common block types and their names and numbers in the
reference section in Appendix B.
The Minecraft world is divided into invisible cubes (each with its own unique coordi-
nate), and the computer remembers the number of the type of block that's in that invis-
ible cube at any one time, even if it's just a block of type AIR . As a Minecraft programmer,
you can ask the Minecraft programming interface for the block type at any particular
coordinate, and you can change the block type of the block at any coordinate. This will
change the block that is displayed there. You can, for example, build bridges by changing
the block type from AIR to STONE , and you will do this in Adventure 4.
You are now going to start by writing a simple program that demonstrates this, by
automatically placing a single block immediately in front of your player. Once you can
place a single block in the Minecraft world, you can build anything you can possibly
imagine, automatically!
1. Start up Minecraft, IDLE, and if you are working on a PC or a Mac, start up the
server too. You should have had a bit of practice with starting everything up by
now, but refer back to Adventure 1 if you need any reminders.
 
Search WWH ::




Custom Search