Skip to main content

Adventures in Minecraft, 2nd Edition




Adventures in Minecraft, 2nd Edition

David Whale, Martin O'Hanlon

ISBN: 978-1-119-43958-5 January 2018 320 Pages

Download Product Flyer

Download Product Flyer

Download Product Flyer is to download PDF in new tab. This is a dummy description. Download Product Flyer is to download PDF in new tab. This is a dummy description. Download Product Flyer is to download PDF in new tab. This is a dummy description. Download Product Flyer is to download PDF in new tab. This is a dummy 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. 

Introduction 1

What Is Minecraft? 1

The Virtual World 1

How Did Minecraft Come About? 2

What Is Minecraft Programming? 2

Who Should Read This Book? 3

What You Will Learn 4

What We Assume You Already Know 5

What You Will Need for the Projects 5

A Note for Parents and Teachers 6

Changes Made to the Second Edition 7

How This Book Is Organised 7

The Companion Website 9

Other Sources of Help 9

Conventions 10

Reaching Out 12

Adventure 1 Hello Minecraft World 13

Setting Up Your Raspberry Pi to Program Minecraft 15

Downloading the Starter Kit 16

Starting Minecraft on Your Raspberry Pi 17

Setting Up Your PC or Apple Mac to Program Minecraft 18

Installing the Starter Kit and Python on Your Windows PC 19

Installing the Starter Kit and Python on Your Apple Mac 21

Starting Minecraft on Your Windows PC or Apple Mac 23

Stopping the Minecraft Server 27

Creating a Program 27

Running a Program 30

Stopping a Program 33

Adventure 2 Tracking Your Players as They Move 35

Sensing Your Player’s Position 36

Getting Started 37

Showing Your Player’s Position 39

Tidying Up Your Position Display 41

Using postToChat to Change Where Your Position Displays 43

Introducing a Game Loop 43

Building the Welcome Home Game 46

Using if Statements to Make a Magic Doormat 46

Checking if Your Player Is at a Particular Location 47

Building a Magic Doormat 49

Writing the Welcome Home Game 49

Using Geo‐Fencing to Charge Rent 53

Working Out the Corner Coordinates of the Field 54

Writing the Geo‐Fence Program 56

Moving Your Player 59

Further Adventures in Tracking Your Player 62

Adventure 3 Building Anything Automatically 65

Creating Blocks 66

Building More Than One Block 68

Using for Loops 69

Building Multiple Blocks with a for Loop 70

Building a Huge Tower with a for Loop 71

Clearing Some Space 73

Using setBlocks to Build Even Faster 73

Reading Input from the Keyboard 74

Building a House 76

Building More Than One House 82

Using Python Functions 82

Building a Street of Houses with a for Loop 86

Adding Random Carpets 87

Generating Random Numbers 88

Laying the Carpets 89

Further Adventures in Building Anything 92

Adventure 4 Interacting with Blocks 95

Finding Out What You Are Standing On 96

Finding Out if Your Feet Are on the Ground 96

Building Magic Bridges 99

Using Python Lists as Magic Memory 102

Experimenting with Lists 102

Building Vanishing Bridges with a Python List 105

Sensing That a Block Has Been Hit 109

Writing a Treasure Hunt Game 112

Writing the Functions and the Main Game Loop 113

Placing Treasure in the Sky 114

Collecting Treasure When It Is Hit 115

Adding a Homing Beacon 116

Adding Your Bridge Builder 117

Further Adventures in Interacting with Blocks 119

Adventure 5 Using Data Files 121

Reading Data from a File 121

Interesting Things You Can Do with Data Files 122

Making a Hint‐Giver 122

Building Mazes from a Data File 126

Understanding CSV Files 127

Building a Maze 128

Building a 3D Block Printer 134

Hand‐Crafting a Small Test Object to 3D Print 134

Writing the 3D Printer 137

Building a 3D Block Scanner 140

Building a Duplicating Machine 144

Writing the Framework of the Duplicating Machine Program 144

Displaying the Menu 148

Building the Duplicator Room 149

Demolishing the Duplicator Room 149

Scanning from the Duplicator Room 151

Cleaning the Duplicator Room 152

Printing from the Duplicator Room 153

Listing Files 154

Further Adventures in Data Files 157

Adventure 6 Building 2D and 3D Structures 159

The minecraftstuff Module 160

Creating Lines, Circles and Spheres 161

Drawing Lines 162

Drawing Circles 164

Drawing Spheres 165

Creating a Minecraft Clock 166

Drawing Polygons 172

Pyramids 175

Further Adventures with 2D and 3D Shapes 179

Adventure 7 Giving Blocks a Mind of Their Own 181

Your Block Friend 181

Using Random Numbers to Make Your Block Friend More Interesting 188

Bigger Shapes 191

Alien Invasion 194

Further Adventures in Simulation 200

Adventure 8 Building a Game Controller with a BBC micro:bit 203

What You Need for This Adventure 204

What Is a BBC micro:bit? 204

Understanding Inputs and Outputs 205

Using Your BBC micro:bit as a Game Controller 206

Setting Up Your Computer to Connect to Your BBC micro:bit 207

Plugging In Your BBC micro:bit 207

Loading the Game Controller Code onto Your BBC micro:bit 208

Hello BBC micro:bit 209

Sensing Button Presses 210

Using Your BBC micro:bit Display 211

The Magic Doormat Revisited 212

Developing the Magic Doormat Program 212

Designing Your Own Icon for the Display 213

Making a Detonator 215

Attaching a Banana to Your BBC micro:bit 215

Sensing Touch Inputs 216

Writing the Detonator Program 217

Writing a Ball‐Rolling Game 220

Building the Structure of the Program 221

Adding a Button and a Countdown 224

Building the Game 225

Sensing Tilt Movements with Your BBC micro:bit 227

Moving the Ball When You Tilt Your BBC micro:bit 230

Collecting Items from the Table 232

Finishing the Game Play 233

Adding a Time Penalty for Falling into a Hole 234

Further Adventures with Your BBC micro:bit Game Controller 236

Adventure 9 The Big Adventure: Crafty Crossing 239

A Game within a Game 239

Part 1: Building the Arena 241

Part 2: Creating the Obstacles 245

The Wall 245

Building the River 251

Creating the Holes 254

Part 3: Game Play 258

Starting the Game 259

Collecting Diamonds 261

Out of Time 263

Tracking the Player 265

Setting the Level as Complete and Calculating Points 266

Adding the Game Over Message 267

Part 4: Adding a Button and Display 268

Set Up the BBC micro:bit 268

Countdown Clock 269

Diamonds to Collect 270

Further Adventures in Your Continuing Journey with Minecraft 271

Appendix A Where to Go from Here 273

Websites 273

Minecraft 273

Python 275

Others 276

Other Ways to Make Things Happen Automatically 276

Projects and Tutorials 277

Videos 278

Books 279

Appendix B

Quick Reference 281

Glossary 291

Index 295

Chapter 1 badge
Chapter 2 badge
Chapter 3 badge
Chapter 4 badge
Chapter 5 badge
Chapter 6 badge
Chapter 7 badge
Chapter 8 badge
Chapter 9 badge
Minecraft Stickers US size
Minecraft Stickers UK size
Code Download
Description of program code
Starter Kit Mac
Starter Kit PC