O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adventures in Minecraft, 2nd Edition

Book Description

Learn valuable programming skills while building your own Minecraft adventure!

If you love playing Minecraft and want to learn how to code and create your own mods, this book was designed just for you. Working within the game itself, you'll learn to set up and run your own local Minecraft server, interact with the game on PC, Mac and Raspberry Pi, and develop Python programming skills that apply way beyond Minecraft. You'll learn how to use coordinates, how to change the player’s position, how to create and delete blocks and how to check when a block has been hit.

The adventures aren't limited to the virtual – you'll also learn how to connect Minecraft to a BBC micro:bit so your Minecraft world can sense and control objects in the real world! The companion website gives you access to tutorial videos to make sure you understand the book, starter kits to make setup simple, completed code files, and badges to collect for your accomplishments. Written specifically for young people by professional Minecraft geeks, this fun, easy-to-follow guide helps you expand Minecraft for more exciting adventures, and put your personal stamp on the world you create. Your own Minecraft world will be unlike anyone else's on the planet, and you'll pick up programming skills that will serve you for years to come on other devices and projects. Among other things, you will:

  • Write Minecraft programs in Python® on your Mac®, PC or Raspberry Pi®
  • Build houses, structures, and make a 3D duplicating machine
  • Build intelligent objects and program an alien invasion
  • Build huge 2D and 3D structures like spheres and pyramids
  • Build a custom game controller using a BBC micro:bit™
  • Plan and write a complete interactive arena game

Adventures in Minecraft teaches you how to make your favourite game even better, while you learn to program by customizing your Minecraft journey. 

Table of Contents

    1. Cover
    2. Title Page
    3. About the Authors
    4. Foreword
    5. Introduction
      1. What Is Minecraft?
      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 Need for the Projects
      7. A Note for Parents and Teachers
      8. The Companion Website
      9. Other Sources of Help
      10. Conventions
      11. Reaching Out
    6. Adventure 1: Hello Minecraft World
      1. Setting Up Your Raspberry Pi to Program Minecraft
      2. Setting Up Your PC or Apple Mac to Program Minecraft
      3. Creating a Program
      4. Running a Program
    7. Adventure 2: Tracking Your Players as They Move
      1. Sensing Your Player’s Position
      2. Building the Welcome Home Game
      3. Using Geo-Fencing to Charge Rent
      4. Moving Your Player
      5. Further Adventures in Tracking Your Player
    8. Adventure 3: Building Anything Automatically
      1. Creating Blocks
      2. Building More Than One Block
      3. Using for Loops
      4. Clearing Some Space
      5. Building a House
      6. Building More Than One House
      7. Adding Random Carpets
      8. Further Adventures in Building Anything
    9. Adventure 4: Interacting with Blocks
      1. Finding Out What You Are Standing On
      2. Using Python Lists as Magic Memory
      3. Sensing That a Block Has Been Hit
      4. Writing a Treasure Hunt Game
      5. Further Adventures in Interacting with Blocks
    10. Adventure 5: Using Data Files
      1. Reading Data from a File
      2. Building Mazes from a Data File
      3. Building a 3D Block Printer
      4. Building a 3D Block Scanner
      5. Building a Duplicating Machine
      6. Further Adventures in Data Files
    11. Adventure 6: Building 2D and 3D Structures
      1. The minecraftstuff Module
      2. Creating Lines, Circles and Spheres
      3. Creating a Minecraft Clock
      4. Drawing Polygons
      5. Pyramids
      6. Further Adventures with 2D and 3D Shapes
    12. Adventure 7: 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
    13. Adventure 8: Building a Game Controller with a BBC micro:bit
      1. What You Need for This Adventure
      2. What Is a BBC micro:bit?
      3. Setting Up Your Computer to Connect to Your BBC micro:bit
      4. Hello BBC micro:bit
      5. The Magic Doormat Revisited
      6. Making a Detonator
      7. Writing a Ball-Rolling Game
      8. Further Adventures with Your BBC micro:bit Game Controller
    14. 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
      4. Part 3: Game Play
      5. Part 4: Adding a Button and Display
      6. Further Adventures in Your Continuing Journey with Minecraft
    15. Appendix A: Where to Go from Here
      1. Websites
      2. Videos
      3. Books
    16. Appendix B: Quick Reference
    17. Glossary
    18. End User License Agreement