You are previewing Adventures in Minecraft.
O'Reilly logo
Adventures in Minecraft

Book Description

Here's your ticket to a world of adventures with Minecraft and programming.

Learn how to extend Minecraft and create a new gaming experience, by exploring the magical world of Minecraft programming. Adventures in Minecraft, like other books in the highly successful Adventures series, is written especially for 11- to 15-year-olds. With this book you will learn new programming skills while having fun with Minecraft!

Minecraft programming experts David Whale and Martin O'Hanlon walk you step-by-step through everything you need to know to:

  • Get started writing Minecraft programs in Python on your PC, Mac, or Raspberry Pi

  • Build houses and other structures in the blink of an eye, and make a 3D duplicating machine

  • Write interactive games like a field that charges you rent, and a treasure hunt using magic vanishing bridges

  • Build custom game control panels using simple electronic circuits

  • Easily build huge 2D and 3D structures such as spheres and pyramids

  • Build intelligent objects like a massive Minecraft clock, and program an alien invasion

  • Plan and write a complete interactive arena game

  • Using the programming skills you learn from this book, writing Minecraft programs offers endless possibilities to create anything you can imagine.

    To make your journey that much easier, the Adventures in Minecraft companion website supplies you with a video for each adventure in the book, downloadable code files, helpful programming reference tables, a bonus adventure, and badges to collect for your Minecraft accomplishments.

    By day, David Whale and Martin O'Hanlon are software engineers who design computer products. By night, they play Minecraft and develop exciting new programs that interact with the Minecraft world. They both work regularly with young people in schools, computing clubs and at community events, giving talks about Minecraft programming and running programming workshops.

    Table of Contents

      1. Introduction
        1. What Is Minecraft?
          1. The Virtual World
          2. How Did Minecraft Come About?
        2. What Is Minecraft Programming?
        3. Who Should Read This Book?
        4. What You Will Learn
        5. What We Assume You Already Know
        6. What You Will Need for the Projects
        7. A Note for Parents and Teachers
        8. How This Book Is Organised
        9. The Companion Website
        10. Other Sources of Help
        11. Conventions
        12. Reaching Out
      2. Adventure 1: Hello Minecraft World
        1. Setting up Your Raspberry Pi to Program Minecraft
          1. Installing Minecraft on Your Raspberry Pi
          2. Starting Minecraft on Your Raspberry Pi
        2. Setting up Your PC or Apple Mac to Program Minecraft
          1. Installing the Starter Kit and Python on Your Windows PC
          2. Installing the Starter Kit and Python on Your Apple Mac
          3. Starting Minecraft on Your Windows PC or Apple Mac
          4. Stopping Bukkit
        3. Creating a Program
        4. Running a Program
        5. Stopping a Program
      3. Adventure 2: Tracking Your Players as They Move
        1. Sensing Your Player’s Position
          1. Getting Started
          2. Showing Your Player’s Position
          3. Tidying Up Your Position Display
          4. Using postToChat to Change Where Your Position Displays
          5. Introducing a Game Loop
        2. Building the Welcome Home Game
          1. Using if Statements to Make a Magic Doormat
          2. Checking if Your Player Is at a Particular Location
          3. Building a Magic Doormat
          4. Writing the Welcome Home Game
        3. Using Geo-Fencing to Charge Rent
          1. Working out the Corner Coordinates of the Field
          2. Writing the Geo-Fence Program
        4. Moving Your Player
        5. Further Adventures in Tracking Your Player
      4. Adventure 3: Building Anything Automatically
        1. Creating Blocks
        2. Building More than One Block
        3. Using for Loops
          1. Building Multiple Blocks with a for Loop
          2. Building a Huge Tower with a for Loop
        4. Clearing Some Space
          1. Using setBlocks to Build Even Faster
          2. Reading Input from the Keyboard
        5. Building a House
        6. Building More than One House
          1. Using Python Functions
          2. Building a Street of Houses with a for Loop
        7. Adding Random Carpets
          1. Generating Random Numbers
          2. Laying the Carpets
        8. Further Adventures in Building Anything
      5. Adventure 4: Interacting with Blocks
        1. Finding Out What You Are Standing On
          1. Finding out if Your Feet Are on the Ground
          2. Building Magic Bridges
        2. Using Python Lists as Magic Memory
          1. Experimenting with Lists
          2. Building Vanishing Bridges with a Python List
        3. Sensing that a Block Has Been Hit
        4. Writing a Treasure Hunt Game
          1. Writing the Functions and the Main Game Loop
          2. Placing Treasure in the Sky
          3. Collecting Treasure when It Is Hit
          4. Adding a Homing Beacon
          5. Adding Your Bridge Builder
        5. Further Adventures in Interacting with Blocks
      6. Adventure 5: Interacting with Electronic Circuits
        1. What You Will Need for this Adventure
        2. Prototyping Electronics with a Breadboard
          1. Building a Circuit that Lights an LED
          2. Connecting Electronics to Your Computer
        3. Setting Up the PC or Mac to Control Electronic Circuits
          1. Configuring the Drivers
          2. Finding the Serial Port Number
        4. Controlling an LED
          1. Lighting Up an LED from your Computer
          2. Flashing the LED
          3. Running a GPIO Program
          4. Writing the Magic Doormat LED Program
        5. Using a 7-Segment Display
          1. What is a 7-Segment Display?
          2. Wiring Up the 7-Segment Display
          3. Writing Python to Drive the 7-Segment Display
          4. Using a Python Module to Control the Display
        6. Making a Detonator
          1. Wiring Up a Button
          2. Writing the Detonator Program
        7. Further Adventures in Electronic Circuits
      7. Adventure 6: Using Data Files
        1. Reading Data from a File
          1. Interesting Things You Can Do With Data Files
          2. Making a Hint-Giver
        2. Building Mazes from a Data File
          1. Understanding CSV Files
          2. Building a Maze
        3. Building a 3D Block Printer
          1. Hand-Crafting a Small Test Object to 3D Print
          2. Writing the 3D Printer
        4. Building a 3D Block Scanner
        5. Building a Duplicating Machine
          1. Writing the Framework of the Duplicating Machine Program
          2. Displaying the Menu
          3. Building the Duplicator Room
          4. Demolishing the Duplicator Room
          5. Scanning from the Duplicator Room
          6. Cleaning the Duplicator Room
          7. Printing from the Duplicator Room
          8. Listing Files
        6. Further Adventures in Data Files
      8. Adventure 7: Building 2D and 3D Structures
        1. The minecraftstuff Module
        2. Creating Lines, Circles and Spheres
          1. Drawing Lines
          2. Drawing Circles
          3. Drawing Spheres
        3. Creating a Minecraft Clock
        4. Drawing Polygons
        5. Pyramids
        6. Further Adventures with 2d and 3d Shapes
      9. Adventure 8: Giving Blocks a Mind of Their Own
        1. Your Block Friend
        2. Using Random Numbers to Make Your Block Friend More Interesting
        3. Bigger Shapes
        4. Alien Invasion
        5. Further Adventures in Simulation
      10. Adventure 9: The Big Adventure: Crafty Crossing
        1. A Game within a Game
        2. Part 1—Building the Arena
        3. Part 2—Creating the Obstacles
          1. The Wall
          2. Running More Than One Obstacle
          3. Building the River
          4. Creating the Holes
        4. Part 3—Game Play
          1. Starting the Game
          2. Collecting Diamonds
          3. Out of Time
          4. Tracking the Player
          5. Setting the Level as Complete and Calculating Points
          6. Adding the Game Over Message
        5. Part 4—Adding a Button and Display
          1. What You Will Need
          2. Set Up the Hardware
          3. Diamond Countdown
          4. Time-Left Indicator
        6. Further Adventures in Your Continuing Journey with Minecraft
      11. Appendix A: Where to Go from Here
        1. Websites
          1. Minecraft
          2. Python
          3. Bukkit
          4. Other Ways to Make Things Happen Automatically
        2. Projects and Tutorials
        3. Videos
        4. Books