Adventures in Minecraft
Buy Rights Online Buy Rights

Rights Contact Login For More Details

More About This Title Adventures in Minecraft

English

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 PiBuild houses and other structures in the blink of an eye, and make a 3D duplicating machineWrite interactive games like a field that charges you rent, and a treasure hunt using magic vanishing bridgesBuild custom game control panels using simple electronic circuitsEasily build huge 2D and 3D structures such as spheres and pyramidsBuild intelligent objects like a massive Minecraft clock, and program an alien invasionPlan 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.

English

Martin O'Hanlon (Birmingham, UK) describes himself as a professional geek and amateur snowboarder. Martin blogs about Minecraft and Raspberry Pi at http://www.stuffaboutcode.com/.

David Whale (Essex, UK) runs the Saturday Club, where kids learn Minecraft and the Raspberry Pi, among other things. David was the Tech Editor on Adventures in Raspberry Pi.

English

Introduction 1

What Is Minecraft? 1

The Virtual World 2

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

How This Book Is Organised 7

The Companion Website 8

Other Sources of Help 9

Conventions 9

Reaching Out 11

Adventure 1 Hello Minecraft World 13

Setting up Your Raspberry Pi to Program Minecraft 15

Installing Minecraft on Your Raspberry Pi 16

Starting Minecraft on Your Raspberry Pi 17

Setting up Your PC or Apple Mac to Program Minecraft 19

Installing the Starter Kit and Python on Your Windows PC 20

Installing the Starter Kit and Python on Your Apple Mac 22

Starting Minecraft on Your Windows PC or Apple Mac 24

Stopping Bukkit 27

Creating a Program 28

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 38

Showing Your Player’s Position 38

Tidying Up Your Position Display 41

x ADV EN T URE S IN MINECRAF T

Using postToChat to Change Where Your Position Displays 43

Introducing a Game Loop 43

Building the Welcome Home Game 45

Using if Statements to Make a Magic Doormat 46

Checking if Your Player Is at a Particular Location 47

Building a Magic Doormat 48

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 58

Further Adventures in Tracking Your Player 61

Adventure 3 Building Anything Automatically 63

Creating Blocks 64

Building More than One Block 66

Using for Loops 67

Building Multiple Blocks with a for Loop 67

Building a Huge Tower with a for Loop 69

Clearing Some Space 71

Using setBlocks to Build Even Faster 71

Reading Input from the Keyboard 72

Building a House 74

Building More than One House 79

Using Python Functions 80

Building a Street of Houses with a for Loop 83

Adding Random Carpets 85

Generating Random Numbers 85

Laying the Carpets 86

Further Adventures in Building Anything 89

Adventure 4 Interacting with Blocks 91

Finding Out What You Are Standing On 92

Finding out if Your Feet Are on the Ground 92

Building Magic Bridges 95

Using Python Lists as Magic Memory 98

Experimenting with Lists 98

Building Vanishing Bridges with a Python List 101

TABLE OF CONTENTS xi

Sensing that a Block Has Been Hit 105

Writing a Treasure Hunt Game 108

Writing the Functions and the Main Game Loop 109

Placing Treasure in the Sky 110

Collecting Treasure when It Is Hit 111

Adding a Homing Beacon 112

Adding Your Bridge Builder 113

Further Adventures in Interacting with Blocks 115

Adventure 5 Interacting with Electronic Circuits 117

What You Will Need for this Adventure 118

Prototyping Electronics with a Breadboard 121

Building a Circuit that Lights an LED 123

Connecting Electronics to Your Computer 124

Setting Up the PC or Mac to Control Electronic Circuits 125

Configuring the Drivers 126

Finding the Serial Port Number 127

Controlling an LED 128

Lighting Up an LED from your Computer 129

Flashing the LED 132

Running a GPIO Program 134

Writing the Magic Doormat LED Program 137

Using a 7-Segment Display 138

What is a 7-Segment Display? 138

Wiring Up the 7-Segment Display 140

Writing Python to Drive the 7-Segment Display 142

Using a Python Module to Control the Display 144

Making a Detonator 145

Wiring Up a Button 146

Writing the Detonator Program 148

Further Adventures in Electronic Circuits 152

Adventure 6 Using Data Files 155

Reading Data from a File 155

Interesting Things You Can Do With Data Files 156

Making a Hint-Giver 156

xii ADV EN T URE S IN MINECRAF T

Building Mazes from a Data File 160

Understanding CSV Files 160

Building a Maze 162

Building a 3D Block Printer 168

Hand-Crafting a Small Test Object to 3D Print 169

Writing the 3D Printer 171

Building a 3D Block Scanner 174

Building a Duplicating Machine 178

Writing the Framework of the Duplicating Machine Program 178

Displaying the Menu 182

Building the Duplicator Room 183

Demolishing the Duplicator Room 185

Scanning from the Duplicator Room 186

Cleaning the Duplicator Room 187

Printing from the Duplicator Room 187

Listing Files 189

Further Adventures in Data Files 191

Adventure 7 Building 2D and 3D Structures 193

The minecraftstuff Module 194

Creating Lines, Circles and Spheres 194

Drawing Lines 196

Drawing Circles 197

Drawing Spheres 199

Creating a Minecraft Clock 200

Drawing Polygons 206

Pyramids 209

Further Adventures with 2d and 3d Shapes 213

Adventure 8 Giving Blocks a Mind of Their Own 215

Your Block Friend 215

Using Random Numbers to Make Your Block Friend More Interesting 222

Bigger Shapes 225

Alien Invasion 228

Further Adventures in Simulation 235

Adventure 9 The Big Adventure: Crafty Crossing 237

A Game within a Game 237

Part 1—Building the Arena 239

Part 2—Creating the Obstacles 243

The Wall 243

Running More Than One Obstacle 246

Building the River 249

Creating the Holes 252

Part 3—Game Play 256

Starting the Game 257

Collecting Diamonds 259

Out of Time 261

Tracking the Player 263

Setting the Level as Complete and Calculating Points 264

Adding the Game Over Message 265

Part 4—Adding a Button and Display 266

What You Will Need 266

Set Up the Hardware 267

Diamond Countdown 269

Time-Left Indicator 270

Further Adventures in Your Continuing Journey with Minecraft 271

Appendix A Where to Go from Here 273

Websites 273

Minecraft 273

Python 275

Bukkit 275

Other Ways to Make Things Happen Automatically 276

Projects and Tutorials 276

Videos 277

Books 278

Index 279

loading