Build Worlds in Minecraft with Python Documentation Contents

This is the master table of contents. However, you will probably find the Overview Page to be more user-friendly.

Build Worlds in Minecraft with Python

This documentation supports the CoderDojo Twin Cities’ Build worlds in Minecraft with Python code group. This group intends to teach you how to use Python, a general purpose programming language, to mod the popular game called Minecraft. It is targeted at students aged 10 to 17 who have some programming experience in another language. For example, in Scratch.

In the Classroom?

Are you in the classroom right now? This section is for you! Visit the first page linked below (hint: it reads Overview), read through the material, and then click through the link under the Next topic heading on each page to work through all the documentation.

Getting Help

Having trouble? Here are some pointers this might be useful:

  • If you are reading an off-line version of our documentation, you might want to refer to the authoritative site. This site will always have the latest and greatest material.
  • Take a look at the FAQ. We are loading this up with answers to common questions. Maybe the answer to your question is already here.
  • Looking for specific information? You might find it in the detailed table of contents, or you might be able to use the Search Page or Index to help you locate it.
  • Our glossary might define a term that is new to you.
  • If something seems different than the way it was before, consult the release notes for more detail.
  • If something is still unclear, we really would like to know. Please visit our ticket tracker to let us know about the problem. Use the New Issue button.

Other Setups

Here are some instructions for setting up software to support different circumstances:

  • At Home, The Easy Way: If you are interested in recreating the environment we use in the CoderDojo lab, but for a single user, on your own PC, you should consult our guide for Vagrant.
  • At Home, The Hard Way: If you are interested in installing all the software needed to run these examples directly on your PC (without using Vagrant to simplify the job), we currently have a guide that covers doing so on Windows. Users of other platforms can consult this guide and try to adapt it for their circumstances. Ultimately, we intend to also provide guides for Apple’s OS X and Ubuntu Linux.

Mentors

Mentors need docs too! Here they are:

Classroom Documentation

The section contains documentation useful for participants in a CoderDojo classroom event. Visit each of the links below to find the documentation needed to get set up and then work through the classroom exercises of the Build worlds in Minecraft with Python code group.

First, we start with an overview:

Overview of Today’s Class

This section describes how we normally work in the CoderDojo classroom and what to expect in today’s session.

Organization and Introductions

We try to have around three students per mentor. After you first get settled into your seat, take a few moments to get to know the mentors and the other students sitting near you. Here are some example questions to break the ice:

  • What’s your name?
  • What grade are you in? Or for mentors, what year were you last in school?
  • Have you attended (or mentored) this class before?
  • What kind of experience do you have with programming?
  • Why did you come to this class today? What are you hoping to do or learn?

Be sure to talk to the people around you. You may have something to teach them, and they may know something you want to learn. This isn’t a library, so you won’t get into trouble for talking. Making friends, sharing stories, and working together are all OK.

Learning Objectives

Here are some of the things you will learn while participating in today’s class:

  • How to read, write, and run code in IPython
  • Basic Python syntax
  • How to change the Minecraft world using Python
  • How to have the Minecraft world trigger activity in Python
  • Anything else you want! Be sure to talk to a mentor if there is something specific you are looking to learn.

Order of Events

Here’s how things typically happen in the CoderDojo classroom:

  1. Get connected. This means getting your PC onto the Wi-Fi network, and then getting connected to your lab instance.
  2. Work through each exercise. We have several exercises, each designed to teach you different things about the IPython notebook environment, Python programming, and interacting with Minecraft through Python code. The exercises are numbered, and it’s a good idea to tackle them in order.
  3. Look at the other examples. See if you can understand what they do, and think about how you might want to change them. Then give it a try!

Ground Rules

In CoderDojo, the one rule is “be cool”. Putting this into practice in the classroom, you can be cool by:

  • Helping each other. Check with other students before asking a mentor for help. “Ask three, then me,” is a good rule of thumb.
  • Learning Python. Today’s focus is on programming, not the game of Minecraft. Remember, this is a CoderDojo, not a LAN party!

Now that you know how this class works, it’s time to learn how to get started with the first steps for setup.

Next, we want to be sure you have all the pieces set up to work through the exercises:

First Steps for Setup

To participate in today’s classroom activities, you need a few things:

  1. Get a PC. If you brought your own, you’re set. Plug it in and get comfortable. If not, look for an unoccupied classroom PC at one of the Python-Minecraft tables. If none are available, talk to a mentor.
  2. Next, talk to mentor to get your lab instance connection card. This card has the unique details you need to connect to the instance. We will need your Mojang account name (the player name, inside Minecraft) so we can set up your instance and give your player permission to connect to it. If you don’t have a Mojang account, we have several available for use in the classroom.
  3. Make sure your PC is connected to Wi-Fi. If you are using a classroom PC, this may have already been set up. This is covered in more detail in the Wi-Fi instructions.
  4. Connect to your IPython Notebook and Minecraft worlds. If you are using a classroom PC, this may have already been set up. This is covered in more detail in the lab instance setup instructions.
  5. Test the connection between Python and Minecraft. Even if you are using a classroom PC, it is good to test out the connection yourself. Instructions are here.

Now that you have a high-level understanding, make sure you have Wi-Fi setup.

Connect to Wi-Fi

The username and password needed you need to connect to the campus Wi-Fi is printed on the name badge passed out to each student and mentor. These credentials are only good for the day of the session, so if you have credentials saved on your computer from a prior session, you will need to delete them and use the ones on your name badge. These credentials are good for a single device (e.g., one laptop). If you need an extra set of credentials for additional devices, check with one of the mentors.

The official documentation for connecting to the UMN campus Wi-Fi is available in the WiFi Setup Guides. You should look at the section for your specific operating system under the heading UoM Secure.

That said, you might be able to muddle through setting up a connection using only the key bits of information below:

  • Connect to the UofM Secure SSID. Other networks might seem to work (e.g., UofM Guest), but they are bandwidth-restricted. You will have Internet connectivity, but will be terribly slow.

  • Choose WPA2-Enterprise security.

  • Choose AES encryption.

  • If you’re only visiting the campus for a short time to participate in a CoderDojo event, it is probably unnecessary to configure the Protected EAP properties or to mess around with any advanced settings like 802.1X or its certificates. Skipping those steps means you can’t be positive that your PC is talking to the University-provided Wi-Fi infrastructure, but the risk is pretty low.

    Warning

    However, if you live, study, or work on campus, take the extra time to go through all the setup steps in the official documentation so you stay secure.

Once Wi-Fi is working and you are able to visit websites (try the CoderDojo site), move on to connecting to your lab instance.

Connect to Your Lab Instance

Once you are connected to Wi-Fi, you need to turn your attention to connecting your PC to the IPython Notebook and the Minecraft world in your lab instance. The diagram below illustrates what sits where:

_images/programming-environment.png

The architecture guide explains a bit more about the peices in this diagram.

Lab Instance Connection Card

Your lab instance connection card has all the critical information, so make sure you have it in hand, and make sure the Mentor who took your account name has had time to set up your instance on the lab server. If so, you’re ready to proceed.

The connection card looks something like the following:

_images/lab-instance-connection-card.png

Key information found on this card:

  • Your Instance Number. In the upper right corner of the card is your Lab Instance Number. If you need to ask a mentor to restart your instance, they will need to know your instance number.

    Note

    Too much TNT? A pyramid made out of beds or water? A restart can get you going again quickly.

  • The IPython URL. It looks something like https://python.coderdojotc.org:12356/. Many people miss the S in the https part of the URL. Many other people miss the numbers that follow the domain name. Both of these are critical to connect to your instance.

  • The IPython password. When you first connect, you will be asked for a password to make sure only you can access the IPython notebook server in your instance.

  • Your Minecraft/Mojang account name. This is printed on the line that reads “Step 3: Connect to the Minecraft Server as coderdojo##” This is the account you should use to log into the Minecraft world. Only this account will be able to make changes in your world.

  • Your Minecraft server address. This looks very similar to the IPython URL, but it just contains the server name (python.coderdojotc.org) and a port number (the digits following the colon).

Connect to the IPython Notebook

The steps involved in connecting to IPython include:

  1. Open your web browser. You need to use Chrome, Firefox, or IE 11 or newer. Safari is known to not work, at least on older Macs.
  2. Visit the URL given on the connection card. The browser will probably complain that it doesn’t trust the site. Proceed past the warnings.
  3. Enter the IPython password when prompted.

You should see a screen like the one below:

_images/ipython-notebook.png

Connect to the Minecraft Server

The steps involved in connecting to Minecraft include:

  1. Launch Minecraft on your PC. If you haven’t already installed and played Minecraft on your PC, visit the Minecraft download page. Download and install the appropriate version for your operating system.

  2. You will need to log into Minecraft. The account name is printed on the connection card. A mentor will need to log you in. If you are working through these exercises at home, use your personal Minecraft account.

  3. Create a profile and make sure it uses the latest patch in the 1.8 release series. For example, you can specify release 1.8.4 of the game. The image below illustrates what a properly configured profile will loook like:

    _images/minecraft-profile.png
  4. After saving the profile (if necessary), click Play to launch it.

  5. Choose Multiplayer, then choose Direct Connect.

  6. In the Server Address field, enter the Minecraft Server address from your connection card, including the port number at the end.

  7. Finally, click Join Server. After a brief delay, you should see your Minecraft world.

Once you can talk to the IPython notebook server and the Minecraft server, you need to make sure they can talk to each other. Continue on to test your environment.

Testing the Setup

A very basic test will show you whether the connection is working between the Minecraft server and the IPython notebook server.

  1. In IPython, click on the exercises folder to navigate to where the classroom exercises are stored.

  2. Click on Exercise 1 – Hello World! to open the notebook for the first exercise. Your screen should look roughly like the following:

    _images/hello-world-notebook.png
  3. Choose Cell ‣ Run All from the menu.

  4. In the Minecraft game, look for the Hello Minecraft! message. If you don’t see it, try opening chat by typing T. You should see something like the following:

    _images/hello-world-minecraft.png

If this works, fantastic! You are ready to continue on with the exercises.

After you are set up, you’re ready to tackle the meat of the class:

Prepared Exercises

We have a handful of exercises prepared for your exploration in the classroom. The exercises should be visible in your IPython notebook session, under the folder named exercises. If you cannot see the exercises folder in IPython, click on the icon of the house to navigate to the top level folder.

Exercise 1: Hello World!
You’ve probably already walked through this exercise as part of testing your environment, but later on, you might see if you can change it to do something more interesting, like saying your name or printing the current time.
Exercise 2: Getting Started with IPython
This exercise gets you familiar with the IPython environment.
Exercise 3: Basic Python Syntax
This exercise introduces you to the core syntax of the Python language.
Exercise 4: Change the Minecraft world using Python
This exercise helps you use Python to make changes within the Minecraft world.
Exercise 5: Minecraft changes trigger activity in Python
This exercise shows you how Python can detect when something has happened in the Minecraft world so it can react.

Other Scripts to Explore

In addition to the prepared IPython exercises, your IPython instance has access to plenty of other IPython examples. The examples should be visible in your IPython notebook session, under the folder named examples. If you cannot see the examples folder in IPython, click on the icon of the house to navigate to the top level folder.

Here are some that might be fun to play with:

Simple Sripts

These scripts are pretty simple, and good places for beginners to start:

Moderate Sripts

These scripts are a step more complex. Move on to these when you are ready for a challenge.

brooksc_tntsnake

This script makes a “snake” of TNT through your world.

sphere

This script creates spherical objects in your Minecraft world.

sphere_hollow

This script shows you how to make spheres hollow: fill them with air. This technique comes in handy in other places, too.

Advanced Sripts

These scripts are really complex. If you can figure these out, you are ready to make your own Mods.

sleepyoz_analogclock

This script draws and animates an analog clock in your Minecraft world. Really cool.

Doing Your Own Thing

Once you’ve gone through the exercises and explored some of the other pre-existing scripts, here are some activities you can try when you’re ready to create your own Mod:

  1. Imagine what you want your Mod to do. Think through the behaviors a player will see. Think about what they can’t see. Try to write it down.
  2. Next, see if you can explain it to another person. Was anything unclear? Did they see any problems that you need to fix?
  3. Talk to a mentor or another student about how they might tackle this challenge in Python.
  4. Look through existing code for something that seems similar. It’s often easier to start from something that already exists, making the changes you need, than starting from scratch.
  5. If you do have to start from scratch, try writing little bits at a time and testing them out. That way, you can tell if you are on the right track or not.

Finally, show it off. If you create something cool, please share. Maybe it will be an example for future students to study some day!

Finally, some reference material you might need:

Controlling Minecraft from Python

Coordinate System

Most coordinates are in the form of a three integer vector (x,y,z) which address a specific tile in the game world. (0,0,0) is the spawn point sea level. (X,Z) is the ground plane, and Y is towards the sky. In other words, X is left and right, Z is forward and backward, and Y is up and down.

_images/coordinates.png

Minecraft’s odd x-y-z coordinate system

Minecraft Programming Reference

These are just a few highlights. A more detailed reference can be found in the full API reference.

World
world.getBlock(x, y, z)

Look up the type of block at the specified coordinates.

world.setBlock(x, y, z, block_type)

Set the block at the specified coordinates to the type block_type.

world.setBlocks(x1, y1, z1, x2, y2, z2, block_type)

Create a set of blocks starting at one coordinate point extending to another point with blocks of the type block_type. This can be used to make cubes or rectangles.

world.getHeight(x, z)

Look up the height (y coordinate) of the tallest brick at the specified x and y coordinates.

world.postToChat("Message")

Send a message over chat.

Player
player.getPos()

Look up the coordinates that the player is currently positioned at.

player.setPos(x, y, z)

Set the player’s position to the specified coordinates.

Blocks

As is the case in most things related to programming, the mcpi/block.py source code file is the ultimate authority for which blocks are available for your use. The table below lists those constants and includes a few notes about some of the blocks.

Block Name Notes
AIR  
STONE  
GRASS  
DIRT  
COBBLESTONE  
WOOD_PLANKS Use block_data to control what kind of planks.
SAPLING  
BEDROCK  
WATER_FLOWING  
WATER An alias for WATER_FLOWING
WATER_STATIONARY  
LAVA_FLOWING  
LAVA An alias for LAVA_FLOWING
LAVA_STATIONARY  
SAND  
GRAVEL  
GOLD_ORE  
IRON_ORE  
COAL_ORE  
WOOD Use block_data to control what kind of wood.
LEAVES  
GLASS  
LAPIS_LAZULI_ORE  
LAPIS_LAZULI_BLOCK  
SANDSTONE  
BED  
COBWEB  
GRASS_TALL  
WOOL Use block_data to control what color wool.
FLOWER_YELLOW  
FLOWER_CYAN  
MUSHROOM_BROWN  
MUSHROOM_RED  
GOLD_BLOCK  
IRON_BLOCK  
STONE_SLAB_DOUBLE  
STONE_SLAB  
BRICK_BLOCK  
TNT  
BOOKSHELF  
MOSS_STONE  
OBSIDIAN  
TORCH  
FIRE  
STAIRS_WOOD  
CHEST  
DIAMOND_ORE  
DIAMOND_BLOCK  
CRAFTING_TABLE  
FARMLAND  
FURNACE_INACTIVE  
FURNACE_ACTIVE  
DOOR_WOOD  
LADDER  
RAIL  
STAIRS_COBBLESTONE  
DOOR_IRON  
REDSTONE_ORE  
SNOW  
ICE  
SNOW_BLOCK  
CACTUS  
CLAY  
SUGAR_CANE  
FENCE  
GLOWSTONE_BLOCK  
BEDROCK_INVISIBLE  
STONE_BRICK  
GLASS_PANE  
MELON  
FENCE_GATE  
GLOWING_OBSIDIAN  
NETHER_REACTOR_CORE  

The underlying engine actually provides all of these block types. If you see one is missing from the MCPI block module, you are free to edit mcpi/block.py to add more blocks using the decimal value listed and following the pattern you find in the existing code.

Minecraft Controls

This is a brief synopsis. For more details, see the Controls article.

Keyboard

Keys Function
W Move forward (or up, when navigating inventory)
A Move left
S Move backward (or down, when navigate inventory)
D Move right
Space Jump, double tap to start/stop flying, hold to fly higher
Shift Sneak, hold to fly lower
E Open inventory
Number keys Select inventory slot item to use
Esc Show/hide menu
Tab Release mouse without showing menu
Enter Confirm menu selection

Mouse

Movement Result
Steer Look/turn around
Left button Remove block (hold)
Right button Place block, hit block with sword
Mouse wheel Select inventory slot item to use

Resources

Python Programming

Online Coding Classes

More about the Minecraft API

Note

Although the StuffAboutCode links discuss using an Raspberry Pi, you don’t need a Raspberry Pi to use the API. We’re using CanaryMod server instead with the RaspberryJuice plugin. More information about that is in the architecture guide.

Other Setups

When you are participating in a CoderDojo class, we host a lab server so that most of the setup is already done for you. However, if you want to do these exercises on your home PC, you will need to choose one of the approaches described below.

Setting up environments like this can be tricky. The simplest way is to use a tool called Vagrant, and described in the chapter below.

Setup for a Vagrant-Based Environment

A Vagrant-based environment is the preferred way to replicate our classroom environment on your home PC. It is relatively easy to install, especially when compared with installing all the different software components one-by-one, directly on your PC. It also provides a consistent working environment, so all our other instructions only need to be written once, instead of once for each operating system. Finally, Vagrant-based environments are becoming more and more common in professional software development organizations, so becoming familiar with this technology will serve students well in the future.

Resulting Environment

Once you are done following these instructions, you will have a command line tool provided by Vagrant. Using Vagrant, you will be able to create a lab environment inside a virtual machine running on your PC. This environment will behave just like the one we use in the CoderDojo classrooms, so you will be able to follow along with all the examples.

Installation Steps

These steps outline the tasks you need to perform to be able to use our Vagrant-based lab environment.

Step 1: Install Vagrant

Vagrant is free, open source software from HashiCorp that helps recreate development environments from a simple set of instructions that Vagrant understands. A development environment is a computer setup where authors of software have all the tools they need to write, test, and run their software.

Vagrant can be downloaded for Windows, Mac, and Linux from the Vagrant website. Visit the website, then click on the Downloads link and chose the right version of the software for your PC’s operating system.

Install it like you would any other software.

You can check if you have the latest version of the Vagrant software installed correctly by typing in the following command at a command line:

vagrant version

It should print output similar to the following:

Installed Version: 1.7.2
Latest Version: 1.7.2

You're running an up-to-date version of Vagrant!
Step 2: Install VirtualBox

VirtualBox is used by Vagrant to host virtual machines that contain all the pieces of our development environment. A virtual machine is a simulated computer, running inside your actual computer. Vagrant takes care of setting up the virtual machine, starting and stopping it, and destroying it when you no longer need it. But you need to install VirtualBox yourself before Vagrant can do the rest.

VirtualBox can be downloaded for Windows, Mac, and Linux from the VirtualBox website. Visit the website, then click on the Downloads link. You want to download the VirtualBox platform package for your PC’s operating system.

Install it like you would any other software.

You can check if you have the latest version of the VirtualBox software installed correctly by typing in the following command at a command line:

vboxmanage --version

It should print output similar to the following:

4.3.20r96996
Step 3: Get a Copy of the python-minecraft Repository

The files we use in our CoderDojo workshops are stored on GitHub. GitHub is organized into repositories, and the python-minecraft repository contains all the files used for our lab environment.

The simplest way to get a copy of these files is to download the Zip file with all the files from the project. Decompress this file into a place where you can work on the files, such as a folder under your My Documents folder on Windows, or your home folder on OS X. We will refer to this location as your working directory.

Another alternative, if you have installed a version of Git for your PC, is to clone the repository from GitHub into a working copy on your PC. The following command, entered at the command line, will create a copy in a folder named python-minecraft:

git clone https://github.com/CoderDojoTC/python-minecraft.git python-minecraft

Using the Environment

Once you’ve completed the steps above, you have everything in place. As mentioned above, Vagrant is the tool that assembles all the pieces and starts and stops environments. This section describes how to use it.

All the commands in this section are intended to be typed at a command line. Before continuing, be sure to change to the appropriate working directory you created with a copy of the python-minecraft repository. Use the cd command as follows:

cd python-minecraft
To start your lab environment

The first step is to configure a file in your python-minecraft folder called private_config.yaml. The easiest way to do this is to open the file named sample_config.yaml in a text editor and use the equivalent of File ‣ Save As to create a copy with the name private_config.yaml. Once you’ve saved a copy to the new filename, you must edit it to place your Mojang account name in the appropriate place. You might also want to replace the default IPython password.

Once the configuration file is in place, start up the environment using the vagrant up command with the argument --provider=docker. Together, the two will read vagrant up --provider=docker. An example of how this looks on an Ubuntu PC is as follows:

[user@pc:~/python-minecraft]$ vagrant up --provider=docker
Bringing machine 'default' up with 'docker' provider...
==> default: Creating the container...
    default:   Name: python-minecraft_default_1424041630
    default:  Image: coderdojotc/python-minecraft-student:latest
    default: Volume: /home/user/python-minecraft:/vagrant
    default:   Port: 10443:8888
    default:   Port: 10565:25565
    default:
    default: Container created: 76984c0ca81b1fd8
==> default: Starting container...
==> default: Provisioners will not be run since container doesn't support SSH.

Note

The first time you execute the vagrant up command on a PC might take a long time, depending on the speed of the computer and the speed of your connection to the Internet. It could take tens of minutes, or maybe even an hour.

Vagrant downloads software from the Internet to create the lab server environment. Most of this software is saved on your computer, so it should be faster when you start it a second time.

After running the above command, you can pick up with the instructions in Connect to Your Lab Instance. Since you are running this on your own PC, you won’t have a lab instance connection card. Instead, check the table below for the necessary information:

Information Description
Server Name In the classroom documentation, wherever it says python.coderdojotc.org, use localhost instead. The name localhost refers to your PC itself.
IPython URL For your local environment, your IPython URL is https://localhost:10443/.
IPython Password This is the value you placed in your private_config.yaml file. It defaults to fooBARbaz.
Mojang Account Name This is the value you placed in your private_config.yaml file. It should be something like coderdojotc01. It is not your email address.
Mojang Server Address For your local environment, this is the value localhost:10565.
Destroy the virtual machine

To temporarily stop the lab environment, use the vagrant halt command. You can restart the environment later with the vagrant up command.

To shut down the lab environment, permanently releasing the memory and hard drive space it is using, you use the vagrant destroy command:

[user@pc:~/python-minecraft]$ vagrant destroy
    default: Are you sure you want to destroy the 'default' VM? [y/N] y
==> default: Stopping container...
==> default: Deleting the container...

Any servers you were running will be stopped and your Minecraft world will be lost. The files you edited in your working directory will still be present. And you can always recreate the lab environment using the vagrant up command described above.

If you don’t use Vagrant, you need to perform many, many more steps. These steps depend on the operating system you are using. The chapters below give you some instructions for these steps:

Setup for Microsoft Windows

These are the steps to get a full development environment working on a Windows PC, in roughly the order you should perform them.

Figure Out Your System Type

Some of the software installed below requires the correct choice to be made between a 32-bit or 64-bit version of the software. You can learn the proper choice for your computer by checking your Computer Properties:

  1. From your desktop, choose Start, then right-click on Computer and choose Properties.

  2. In the window that opens, look for the System type under System. On a 64-bit system, it will say 64-bit Operating System.

    Note

    Remember this value for later.

Working Directory

Much of the work we do will involve a set of files on your computer. It’s helpful if you organize these into a single location. On a Windows PC, the default place for user files is in the Documents folder. We will start from there:

  1. From your desktop, choose Start ‣ Documents to open a Windows Explorer view of your Documents folder.

  2. In the window that opens, right-click in the main window and choose New ‣ Folder. Give it the name CoderDojo.

  3. Double-click into the CoderDojo folder and again, right-click in the main window and choose New ‣ Folder. Give this one the name MinecraftMod.

    Note

    From here on, we will refer to this as your MinecraftMod folder.

  4. Double-click into the MinecraftMod folder and again, right-click in the main window and choose New ‣ Folder. Give this one the name CanaryMod.

TortoiseGit and Git for Windows

TortoiseGit is a nice, GUI wrapper for Git on Windows. With this, you can use Git entirely from within Windows Explorer.

  1. Visit the TortoiseGit download page. Select the appropriate version based on your system type and download it.
  2. Once the file has downloaded, run it. You can leave all the installer options at their defaults. Allow it to install.
  3. Visit the git for windows download page. Click on the Download link.
  4. Once the file has downloaded, run it. You can leave all the installer options at their defaults. Allow it to install.
  5. Now is a good time to reboot your PC.

CanaryMod Server

  1. Visit the CanaryMod download page.

  2. Right click on the link to the Jar file and save it within the MinecraftMod\CanaryMod folder.

  3. In the MinecraftMod\CanaryMod folder, create a new file named startserver.bat, and give it the following contents:

    CanaryMod-1.7.10-1.1.2.jar
    pause
    
  4. In the MinecraftMod\CanaryMod folder, create a new file named eula.txt, and give it the following contents:

    eula=true
    

Give the CanaryMod server a test run by double-clicking on the startserver.bat script you created. The CanaryMod: Minecraft server window should open, and you should see log messages indicating that the server is running.

RaspberryJuice for CanaryMod

We’re going to use Git to clone the repository where RaspberryJuice comes from. The Jar file containing the plugin is available in the repository, so we will copy it from there.

  1. Visit the GitHub page for the CanaryRaspberryJuice plugin.
  2. On the right-hand side of the page, you will see a field labeled HTTPS clone URL. Copy the value from here into your clipboard. It will be something like https://github.com/martinohanlon/CanaryRaspberryJuice.git.
  3. Using Windows Explorer, navigate to your MinecraftMod folder.
  4. Right-click within the main panel and choose Git Clone....
  5. In the window that opens, double check that the URL field contains the one you copied above, that the Directory field specifies the MinecraftMod\CanaryRaspberryJuice folder, and then click OK.
  6. After the Clone process finishes, open the MinecraftMod\CanaryRaspberryJuice\jars folder. Copy the file named canaryraspberryjuice-1.3.jar into MinecraftMod\CanaryMod\plugins.

Restart the CanaryMod server again (double-clicking on the startserver.bat script). This time, among the log messages, you should see one that reads [INFO]: Enabling CanaryRaspberryJuicePlugin Version 1.3.

Minecraft

  1. Visit the Minecraft download page.

  2. Right click on the Minecraft.exe and save it into your MinecraftMod folder.

  3. Do the same with the Minecraft_server.1.8.9.exe file. We plan to use the CanaryMod server instead, but it may be useful to have the vanilla server for troubleshooting.

  4. Give Minecraft a test run by opening the MinecraftMod folder in Windows Explorer. Then double-click on Minecraft.exe.

  5. Once the Minecraft Launcher opens, create a new Profile that is configured to use Minecraft version 1.7.10 (consistent with the CanaryMod server version).

    1. Click New Profile.

    2. In the Profile Editor dialog, change the fields as follows:

      Field Value
      Profile Name MinecraftMod 1.7.10
      Use version release 1.7.10

      Then click Save Profile.

Python 2.7.8 for Windows

  1. Visit the Python Downloads page for Windows.
  2. Be sure to locate the 2.7.8 version of Python, and then select the right installer based on your system type.
  3. Once the file has downloaded, run it. You can leave all the installer options at their defaults. Allow it to install.

CoderDojo TC’s python-minecraft Repository

We’re going to use Git to clone the repository where the CoderDojo Twin Cities chapter has stored the example Python scripts.

  1. Visit the GitHub page for the CoderDojoTC python-minecraft repository.
  2. On the right-hand side of the page, you will see a field labeled HTTPS clone URL. Copy the value from here into your clipboard. It will be something like https://github.com/CoderDojoTC/python-minecraft.git.
  3. Using Windows Explorer, navigate to your MinecraftMod folder.
  4. Right-click within the main panel and choose Git Clone....
  5. In the window that opens, double check that the URL field contains the one you copied above, that the Directory field specifies the MinecraftMod\python-minecraft folder, and then click OK.

Environment Shakeout

Now that all the necessary parts have been installed, let’s see if everything is in working order.

  1. Shut down the Minecraft game, if it is running. Shut down the CanaryMod server, if it is running.
  2. Start the CanaryMod server by double-clicking on the startserver.bat script you created in the MinecraftMod\CanaryMod folder.
  3. Start Minecraft by opening the MinecraftMod folder in Windows Explorer. Then double-click on Minecraft.exe.
  4. Once the Minecraft Launcher opens, choose the MinecraftMod 1.7.10 Profile, and click Play.
  5. Once the game starts, click the Multiplayer button. Choose the Direct Connect button on the next page. Enter localhost in the Server Address button and then press Join Server.
  6. Once your player has joined the game, from the Windows desktop, choose Start ‣ All Programs ‣ Python 2.7 ‣ IDLE (Python GUI) to open a Python Shell.
  7. In the Python Shell, choose File ‣ Open... and navigate to the MinecraftMod\python-minecraft folder. Choose hello_world.py.
  8. Choose Run ‣ Run Module, and look for the “Hello Minecraft” message within the game.

If you saw the “Hello Minecraft” message, congratulations! You are ready to proceed. If you ran into any problems with the environment shakeout, you should examine the error messages you might be seeing, think about what they might mean, and revisit the appropriate section of this document. Or, ask for help!

Setup for Apple’s OS X

Todo

If you are able to help write (or help write) this chapter of the documentation, please take ownership of the GitHub issue: https://github.com/CoderDojoTC/python-minecraft/issues/3

Setup for Ubuntu Linux

Todo

More to come.

Mentor Documentation

The section contains documentation useful for mentors supporting the Build worlds in Minecraft with Python code group.

First, please familiarize yourself with the documentation used by the students during a class, then return to this document. We’re going to try to avoid repeating ourselves.

Next, review the core overview for mentors:

Being a CoderDojo Mentor

What is a Mentor?

Being a CoderDojo Mentor is like being a guide on an adventure. It helps if you know where you’re going, but more important is a sense of curiosity and a willingness to work alongside the students as they learn. We haven’t had a chance yet to find write this guide about being a mentor at the CoderDojo Twin Cities, but there are lots of other resources available:

CoderDojo Twin Cities High-level Overview

Events are usually held once or twice a month. Events are held on the Saturdays on the University of Minnesota campus.

Students are in the classroom for about two hours, typically between 1:30pm and 3:30pm. Mentors are asked to arrive around 12:45pm to help with setup, and to stay a bit after to help with cleanup.

Classroom setup includes:

  1. Selecting the right number of tables for the expected number of students in each code group. Each table in our usual classroom holds about nine students comfortably.
  2. Retrieving the mentor and student name badges for the code group, and stuffing them in the badge holders.
  3. For students using classroom laptops, placing the laptops on the desks, connecting them to power supplies, logging them into the campus Wi-Fi, and preparing any needed software.

Students may either bring their own laptop, or use one of the classroom laptops. Classroom laptops are all Apple Macs of varying vintages. Students arrive with a variety of different kinds of computers. Most are running some version of Microsoft Windows.

Being a Python Minecraft Mentor

The marketing material for the Python Minecraft code group describes it as follows:

Use Python, a general purpose programming language, to mod the popular Minecraft game. Best for coders 10+ or younger with some experience in programming (like Scratch!)

It recommends that students be between the ages of 10 and 17, with some experience in programming.

Mentors in this code group ideally have some of the following experience, though none of these are a hard requirement:

  • Python programming.
  • IPython usage.
  • Minecraft usage.
  • Teaching skills.

Lessons Learned

We are attempting to capture lessons learned in the course of conducting the classroom sessions over time.

Lessons/Thoughts from 2015-01-24

The WiFi setup on name-badges was much easier to manage than trying to cross credentials off lists. It did take a little more coordination to get WiFi set up on Dojo-provided PCs. We had to line up the badges on the appropriate PCs, and then log them in.

We had a lot of students who came without a PC, or without a PC that could run Minecraft (e.g., one student brought a Chromebook). This put us behind the curve because several students didn’t have a PC to work from. We eventually settled on having them join another student with a working PC, but it was suboptimal.

There are a variety of problems running Minecraft on the PCs:

  • We had some student experience crashes upon trying to connect their PC to the server. They could join servers with 1.8, but on 1.7.10, they got a java OutOfBounds exception crash.

After reviewing the material above, you are probably well ready to be a mentor at a Dojo event. We look forward to seeing you there!

If you are hosting the technology used for a session, you should consult these guides:

The Lab Server

If you are responsible for running a lab server that hosts multiple student instances during a CoderDojo session, this is the guide for you.

This is currently a pretty cursory explanation for how to setup a lab server from scratch, and then how to operate it during a CoderDojo session.

Todo

Need to elaborate on AWS usage, such as how to create an instance, pick the size and availability zone, configure the Elastic IP, etc.

In summary, the Lab Server hosts a bunch of Instances. Each student will get their own Instance. Each Instance hosts a private Minecraft server, the RaspberryJuice plugin that lets Python talk to Minecraft, and an IPython Notebook server that can talk to the Minecraft server. These Instances give each student an isolated environment in which they can work through lessons and challenges.

To control the instances on the Lab Server, there is a python script called the Lab Server Controller. It runs on the Lab Server, and it is responsible for configuring, starting, and stopping individual Instances. The Lab Server Controller gets its information from the Control Sheet, which is a Sheet in Google Docs that contains information about the desired configuration of the various Instances.

While class is in session, Mentors will control the Lab Server and its instances by making updates to the Control Sheet.

Building the Lab Server AWS Instance

The following steps are needed to create a new lab server instance using nothing but a standard Ubuntu 14.04 LTS installation and the contents of the python-minecraft repository.

  1. Launch an Ubuntu instance in AWS.

  2. Log in and gain root access.

  3. Install and configure the essentials:

    apt-get install git-core
    
    git config --global user.name "Your Name"
    git config --global user.email youremail@example.com
    
  4. Clone our repository:

    git clone https://github.com/CoderDojoTC/python-minecraft.git python-minecraft
    cd python-minecraft
    cd lab-server
    
  5. Review the lab-server-setup.sh script and tweak it where needed, then run it:

    ./lab-server-setup.sh
    
  6. Build the student-env-image:

    cd student-env-image
    docker build -t "coderdojotc.org/python-minecraft-student" .
    

The Lab Server Controller

The Lab Server Controller is a command line tool that helps manage the lab server used for teaching the CoderDojo TC’s Python-Minecraft code group.

The Lab Server Controller (LSC, from here) helps manage the server. The LSC is embodied in a command named lsc. This command provides several different operations, which are basically subcommands. It can be run interactively for some operations. For others, it is designed to be run as a scripted tool.

For many operations, the LSC pulls its configuration data from a Google Sheet that follows a pre-defined format. This Sheet, referred to from here on as the Control Sheet, describes how the containers should be configured for the students. Keeping this information in a Google Doc allows it to be easily updated by Mentors in the classroom. The expected contents are described in detail below in the section titled Control Sheet Format.

Configuration

Before you can use the LSC command for the first time, create a file in your current directory named lsc.ini. Populate it with content like the following:

[Lab Config Sheet]
email = your-google-account-email@example.com
password = YOUR_APPLICATION_SPECIFIC_GOOGLE_PASSWORD
spreadsheet = Lab Server Controller
worksheet = 2014-11-15

[Instances]
instance_data_dir = /mnt
docker_control_url = unix://var/run/docker.sock
sourcecode_repo = https://github.com/CoderDojoTC/python-minecraft.git
docker_image = coderdojotc.org/python-minecraft-student:latest

The spreadsheet value is the name of the Google Sheet that the LSC should use for its configuration data. The worksheet is the name of the specific tab within the Sheet.

The email value is the address of the Google Account that the LSC should use to connect to the Sheet. It will probably be the email address of the person responsible for setting up and running the server.

The password field is the password the LSC should use, in conjunction with the email address of the Google Account, when connecting to the Google Sheet. It is a terrible, terrible idea to enter your main Google password in this field. Please consult the warning below for what to do instead.

Warning

Absolutely everyone ought to be using Google’s 2-factor authentication, especially people who need to write down their password in a configuration file. To make the LSC tool work when you have it set up, you need to create an application-specific password. The password you set up on that page should be the one you enter in the config file.

Todo

Need to document other values in config file above.

Usage

Normal usage when the lab server is up and running is to log into the lab server, switch to the root user (who can start and stop Docker instances), launch a tmux session, then start running the lab server controller in a loop with a command like the following:

watch -n 10 timeout 60 lsc -v --debug process-commands

If you want to know more about what the lsc command can actually do, this section describes various usage examples. The name of the command itself is lsc. Each of the different subcommands follows lsc on the command line.

Environment Shakeout Commands

The commands in this section help with environment shakeout.

The lsc test command checks the environment. It confirms that the config file is present. It validates that the information in the config file allows it to reach the Control Sheet used to manage the student instances.

Control Sheet Commands

The commands in this section help with managing the Control Sheet.

The lsc show command dumps the contents of the Control Sheet.

The lsc process-commands command walks through the Control Sheet and attempts to act on each command in the sheet, as indicated in the sheet. It also checks the current state of each instance and updates the appropriate columns in the Control Sheet.

Control Sheet Format

The LSC expects the Control Sheet to follow a certain format, so it knows where to find the necessary information. Overall, the first row in the sheet should contain the column headings listed below. Each row after that describes an Instance.

Here is how the columns expected to be laid out within the sheet:

Inst #

This is the numeric identifier of the instance. It should be unique. It should be an integer greater than zero. Otherwise, it just provides a short-hand way for people and the LSC to talk about Instances.

Some of the other columns are calculated based on this identifier, but it is not a strict requirement.

Student Name
This is the name of the student who will be using this instance. It is here to make it easier to associate an instance with the person who will be using it.
Mojang Accounts

This is a list of one or more Mojang account names that will be included on the instance’s whitelist. If multiple people should on the whitelist, separate names with commas. Whitespace is ignored.

The special value of All Accounts indicates that the whitelist for this instance should be filled with all accounts listed for other instances. This makes it easy to construct a “Classroom Server” where any student with a private instance will also be included on the Classroom Server’s whitelist.

The special value of Open Server indicates that the whitelist for this instance should be left empty. In this case, Minecraft will permit anybody to connect.

Warning

Beware that a truly open server can be joined by anyone. If you don’t want this, you are recommended to use the whitelist.

Minecraft Port

This is the TCP IP port at which the instance’s Minecraft server will be available. Since the default Minecraft port is 25565, the default Control Sheet calculates port numbers based off the instance ID, using 565 as the suffix.

Keep in mind that TCP restricts port numbers to integer values between 1 and 65,535. Ports between 1 and 1,024 are reserved for special purposes, so you should make sure the port numbers in this field fall between 1,025 and 65,535.

Note

Since Minecraft defaults to port 25565 by default, students who forget to enter their assigned port number will try reach a server at this port. It is recommend that you run a specially configured server at this default port. This server could be open for all students to participate in (e.g., a Classroom Server), or it should be configured with no access, and a deny message that prompts students to enter their assigned port number.

IPython Port

This is the TCP IP port at which the instance’s IPython Notebook server will be available. Since the server runs over HTTPS, which uses port 443 by default, the default Control Sheet calculates port numbers based off the instance ID, using 443 as the suffix.

Keep in mind that TCP restricts port numbers to integer values between 1 and 65,535. Ports between 1 and 1,024 are reserved for special purposes, so you should make sure the port numbers in this field fall between 1,025 and 65,535.

Student Password

When a student connects to the IPython Notebook server with a web browser, it will prompt them to enter the password contained in this column. It is recommended that you generate the passwords in this list and then provide them to the students along with their assigned port numbers.

The following command will generate a list of 30, 6-character passwords, each made up of lowercase letters and numbers, and excluding some characters that can be easily mistaken for each other:

apg -a 1 -n 30 -m 6 -x 6 -M ln -E lI10OS
Instance Type

The LSC knows how to deploy the instance types listed in the table below. Use the types listed below in the Control Sheet.

Instance Type Description
STUDENT A normal student instance. Most of the documentation in this file refers to this Instance Type.
REDIRECT An instance that denies all access with the following message “You need to specify your assigned Minecraft port. Please try again.”
Command

This is the way you control the instances. This column should contain one of the values from the first column in the table below. The LSC interprets the command you entered and moves the instance into the desired state when the lsc process-commands command is run.

Command Description
RUN The instance should be moved to a normal, running state. This is the state where students can use the instance.
DOWN The instance should be stopped (if running), but the files will be preserved.
RESETWORLD Stop the instance (if running) and clear out the world files. This is most useful if the student has done something horrible to their world and needs a fresh one to start over.
RESETNOTEBOOKS Stop the instance (if running) and clear out the IPython notebook files. This is for when the student has done something horrible to their notebook files and and needs a fresh set to start over.
DESTROY The instance should be stopped (if running) and all related files are permanently erased.
Status As Of
Timestamp of when the Current Instance State was last updated. This should be pretty close to the current time. You should not manually edit this value.
Container IDs
Hexadecimal identifiers of the container(s) that make up this instance. If there are multiple values, they will be separated by commas. You should not manually edit this value.
LSC Message
This column will hold any instance-specific message from the LSC command. You should not manually edit this value.
S3 Bucket
This is the address that will be used by the LOAD and SAVE commands. More to come as we flesh out this feature.

The following documentation covers various kinds of project technology, maintenance, and other tasks:

Project Technology

In the very barest of sketches, this document lays out the different technologies and resources used for the Python Minecraft code group.

Technologies

Jupyter

The interface to Python used by the students during our workshop is the Jupyter Notebook. The Python code is embedded in Jupyter Notebook files, which are the files named *.ipynb in the source code repository.

The Jupyter project hosts an online notebook viewer that can turn these ipynb files into easily readable versions. Just paste any URL from a GitHub file into the box on the NBViewer site, and and you will it will generate a linkable result like this one.

Online Resources

Source Code Repository

Our code repository lives on GitHub. This repository is the master source for the documents, code examples, and scripts and tools used to support the class.

We try to follow the feature branch workflow in our Git repository. Atlassian provides a nice overview of this workflow.

Mailing Lists

Our mailing list is hosted on Google Groups. It is a public group, open to all.

Project Documentation

The source code for our documentation is in the code repository. A readable, online version is available in our project’s Read the Docs site. Any changes to tracked branches in the repository (especially master) will result in the project documentation being rebuilt so they are current. The Read the Docs project page is the administrative interface for this online version.

Docker Hub

We use Docker Hub to host a public repository that contains the student image used on the lab server for each student. These images are built using the Dockerfile contained in lab-server/student-env-image of our source code repository. Once built, they are pushed to the Docker Hub so they can be retrieved by anyone hosting a lab server, or by students using Vagrant to host an environment on their personal computer.

Project Maintenance

Notes on various maintenance tasks.

Todo

This document needs to be drafted.

Creating/updating documentation

Creating/updating examples

Updating the Student Environment

Building a Lab Server on a Host

Reference

This section contains reference material and covers other random topics.

Overview of the Architecture

There are many different programs and tools involved in these activities. This document introduces you to these pieces.

Minecraft

This is what you run when you start the game itself. Most of the time, it is actually the Minecraft launcher, which you have downloaded from Mojang. This is sometimes referred to as the client, because in these activities, we will connect it to a separate server that you will control through Python.

CanaryMod Server

CanaryMod is a Minecraft server. Like the vanilla Minecraft server from Mojang itself, it can be used to host a multiplayer game of Minecraft. Unlike the vanilla server, CanaryMod has a plugin API which allows it to be customized by developers. Unlike the CraftBukkit server, it is still available to download in both source code and compiled forms (as of October 2014).

RaspberryJuice for CanaryMod

Mojang release a special version of Minecraft (called the Minecraft: Pi Edition) that runs on a small, inexpensive computer called the Raspberry Pi. This version of Minecraft is special because it is available to download and use for no cost, and because it comes with support for modifying the game server’s behavior in multiple programming languages. The only downside to this special version is that it requires a Raspberry Pi, and cannot be run on a regular computer. While a Raspberry Pi is relatively inexpensive, most students probably already have access to a regular computer than can run the normal version of Minecraft, so we’ve looked for an alternative.

The original alternative came from the RaspberryJuice plugin for the CraftBukkit server. This plugin supports the same methods for customizing the server’s behavior as the Minecraft: Pi Edition, but it can be used with the PC version of Minecraft.

Due to some turmoil in the Bukkit project beginning around early September 2014, CraftBukkit is unavailable for the time being. The good news is that the CanaryMod server also has a plugin equivalent to RaspberryJuice, so it is the one we can use.

Git

Git is a developer’s tool for keeping track of changes made to files. These kinds of tools are commonly referred to as Version Control Systems (VCS) or Source Code Management systems (SCM), because developers use them to keep track of the files that go into the programs they write. The examples used in the CoderDojo class are kept in a Git repository, along with the files that make up the RaspberryJuice plugin.

Python

Python is the language in which we will develop our mods for Minecraft. It is free and open source, it runs on pretty much any computer around. It is both easy for beginners and powerful enough for very complicated or sophisticated programs.

A Text Editor

Python programs are written in plain text files. As such, you will need a program that helps create and update these files. There are many available, and most computers even come with one out of the box. However, some editors have features that make it easier to read, write, and test computer programs, so we will select one of those.

Python Minecraft FAQ

Why can’t I...

... change anything in my world?

If you can’t create or destroy blocks in your world through the Minecraft game itself, you probably need to make sure that your player has Operator status on the game server.

How do I...

... create a new world?

To create a new world, you need to use the /createworld WORLDNAME to create a world named WORLDNAME. Then use the command /spawn WORLDNAME to switch to that world. To create and joing a world named Mine, you would use the following two commands:

/createworld Mine
/spawn Mine

The world you are in when the game starts it called default. To return to it, you would use the command /spawn default.

Why is...

... my network connection so slow?

You might have connected via Wi-Fi to UofM Guest instead of UofM Secure. The Guest network has much less bandwidth, and is too slow for most useful work.

Glossary

code group
Code groups are topics in the Twin Cities’ CoderDojo. When students sign up to attend, they indicate interest in three different code groups. They get assigned to a specific code group once the number of mentors is known. This usually happens a couple of days before the event.
command line
The command line is the place where you type commands and your computer executes them. On Windows, you need to launch the Command Prompt. On Ubuntu Linux and on OS X, you can launch a program called Terminal.
lab instance
In the hosted environment we use for the CoderDojo classes, each student has a private instance that contains a Minecraft server and world, an IPython notebook server, and copies of Python scripts with exercises and example programs.
lab instance connection card
A piece of paper that has the address of your private Minecraft server, the address of your private IPython notebook server, and the password needed to connect to it.
text editor

A text editor is a program that is lets a user edit plain text files. Most programs are stored in plain text files, so computer programmers often use text editors to create and change these files.

On a Windows PC, the text editor that comes with the Windows itself is called Notepad. On a many versions of Linux, a program named gedit is often installed. On Mac OS X, the text editor is commonly called TextEdit.

Documentation Needing Work

The following is an auto-generated list of documentation files with a “to do” note in them (.. todo:: Your note goes here...). If you are looking for something to do, this could give you some ideas.

Todo

Need to elaborate on AWS usage, such as how to create an instance, pick the size and availability zone, configure the Elastic IP, etc.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/python-minecraft/checkouts/latest/docs/mentors/lab-server.rst, line 13.)

Todo

Need to document other values in config file above.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/python-minecraft/checkouts/latest/docs/mentors/lab-server.rst, line 136.)

Todo

This document needs to be drafted.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/python-minecraft/checkouts/latest/docs/mentors/maintenance.rst, line 7.)

Todo

If you are able to help write (or help write) this chapter of the documentation, please take ownership of the GitHub issue: https://github.com/CoderDojoTC/python-minecraft/issues/3

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/python-minecraft/checkouts/latest/docs/other-setups/osx.rst, line 5.)

Todo

More to come.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/python-minecraft/checkouts/latest/docs/other-setups/ubuntu.rst, line 7.)

Release Notes

The following changes have been made to the classroom materials over time. Look for annotated Git tags that match the headings below.

The full changelog is available on GitHub.

Unreleased Changes

  • Merged several documentation fixes from Markus Khouri. Thanks Markus!
  • Began migrating documentation into the Jupyter/IPython notebook. This gives the students a more integrated path through the course, with less jumping between the static docs and the live environment.
  • Added some tools to help with course content development:
    • Added a requirements.txt file for use in setting up a Python environment with the necessary tools.
    • Added a Fabric script (fabfile.py) to help automate tasks performed while developing and delivering the course.

2015-08-01

  • Fixed the lab server controler to work with the latest version of gspread, which requires OAuth2.
  • Changed the source location where we pull the Canary JAR file. The CanaryMod project is going through some changes, and have reorganized where files are available on their web server.
  • Added a dirty hack to work around a problem that Canary seems to be having in determining the UUID of the players listed in ops.txt on startup. I’ve had to put this reactive code in the run-canary.sh script to do the job after the player joins the server. A better long-term fix is to find the root cause in Canary itself.

2015-05-09

  • Upgraded to CanaryMod 1.2.0 (compatible with Minecraft client version 1.8), version 1.3 of the RaspberryJuice plugin, and the latest python libraries that support them. This brings some new programming capabilities, such as being able to have Python code receive messages from the game chat.
  • Added Martin O’Hanlon’s Minecraft Turtles so that students can use the library and run the examples. This gives students a logo-like model for writing programs.
  • Upgraded to IPython 3.1.0. This improves the development user interface. It also changes the “branding” of the development UI from “IPython” to “Jupyter”.
  • Removed many calls to the obsolete server module from example scripts in the examples folder (thanks to Joshua Fasching).
  • Fixed a problem where it seemed to rain in Minecraft from time to time.

2015-02-21

  • Simplify the generated world in the student lab instance to make it better for programming projects. Now, the students are placed in a “FLAT” world (no terrain, no biomes, no structures, no mobs, etc.), and the weather is clear.

  • Reorganized the exercises and examples into subfolders, and converted all the previous *.py files into *.ipynb files so students can load them directly in IPython.

  • Improved our classroom exercises:

    • Exercise 1: Reformatted Hello World to be a single code block so that it’s easier to run, added some hints, and added some extra challenges.
    • Exercise 2: Took out the TNT Pyramid (which was too big and distracting), pointed students to the online help and guided tour, wrote more about added the REPL environment.
    • Exercise 4: Added a delay so students have a chance to observe what is happening as the script runs, added some extra challenges.
    • Exercise 5: Added a field of wool so students have something that will react to sword strikes.
  • Updated some example scripts to work better in our new student environment.

  • Upgraded to CanaryRaspberryJuice version 1.2. This added methods such as getPlayerId(playerName), getDirection(), getRotation(), and getPitch(). This also includes version 1.1, which added various entity methods.

  • Upgraded to IPython version 2.4 in the student lab server instance. This is a significant upgrade from the prior version, which was IPython 1.3. The main student-visible differences are that IPython can now navigate between directories, and the Notebook web UI now has separate Edit and Command modes.

  • The docs for setting up a local, Vagrant-based lab environment have been updated to work much better. It now uses exactly the same environment and setup that students get when attending a CoderDojoTC event. The solo-server docs and files have been removed.

  • The Lab Server Controller now accepts the name of a docker image (and version tags) in its configuration file. This makes it possible to use different lab images in different environments, which is particularly useful in testing a new image before committing to using it for a specific CoderDojo event.

  • Lots of documentation updates, including new docs for Mentors.

  • For people working on updating exercise or example code through the IPython notebook interface, launching a student lab instance with Vagrant will now copy the local working directory into the folder where IPython can edit the files. If there is no Vagrant-provided folder, the code will be retrieved from the Git repository specified in the private_config.yaml file.

    By itself, this copy from Vagrant into the IPython notebook folder is a one-way-street. Edits made there will not be visible on the Vagrant host (where they can be committed to source code control). However, there is also a script installed in the image called sync-notebooks.sh. It can be run as follows from the Vagrant host, and it will invoke Unison to sync up the changes:

    docker exec -it python-minecraft_default_1424407654 sync-notebooks.sh
    

2015-02-07

  • The table of contents and navigation between chapters has been improved. Some of the section index pages have been improved.
  • Improved the layout of the Lab Instance Connection card, and its related documentation.
  • Some unnecessary documentation files have been removed.

2015-01-24 and Before

Release notes are unavailable prior to the February 7, 2015 session. Please consult the git log for details of prior releases.

Indices and Tables