In this project, we'll build on the previous two projects and allow our character to construct an even more complex house — with many different types of blocks — at the touch of a button.

For this project, we just need a single button, wired to GPIO24:

The code for this project is nearly the same as the previous project. However, in this project, the house is very detailed, made up of many house slices that are very intricate. In addition, the house is made up of dozens of block_types including stairs, fireplaces and flowers.

In fact, there are so many block types that we've had to make a minor adjustment to the code. Each block in the house was previously either just a 0 or a 1. Now, the block type can range from '0' through '9', 'A' through 'Z', or 'a' through 'z'. If you look at the block_types in the code, you'll see that each type in the list is followed by a comment about which number/letter corresponds to that type.

Full Code

Here is what the code for this project should look like at this point (with new changes highlighted with arrows):

Give it a try!

  1. Assuming you still have your controller wired up, add this house making code to the Minecraft controller code ( project) so that you can build a house while using the CREATOR Kit as a controller.

  2. Time to mod-your-house! Convert doors to windows, or windows to doors. Add flowers. Insert a NETHER_REACTOR_CORE into the corner. Add a whole new level. All of this can be done just by editing the house and block_types lists!

  3. Can you add another button to your hardware and modify the code that the house disappears at the press of the second button?