HTTPS SSH

pyMinecraft


This repo is meant to hold scripts used to interact with a Minecraft server running the RasberryJuice plugin. To do this we will use the Spigot minecraft server mod, along with RasberryJuice for Bukkit. Once the server is setup we will then be able to use python to make changes to game world via mcpi which is the python interface written by Mojang for the RasberryPi version of Minecraft.

Everything else is examples for manipulating data within the world.

Directions for setting up the server (with Docker)

OS X and Windows:

First, install Docker Toolbox, which will provide Virtualbox, docker-machine, docker, docker-compose.

If you already have docker and boot2docker installed, it is recommended that you migrate to the Docker Toolbox as provides the up-to-date docker toolset, along with the boot2docker replacement docker-machine.

Linux:

Install docker and docker-compose for your distribution.

Docker first-time setup (on OS X)

docker is a relatively new technology that relies upon Linux containers (LXC) to run isolated environments. It does not run natively on OS X, hence its reliance upon a Virtual Machine management tool like Virtualbox.

After installing the Docker Toolbox on OS X, you can now set up a new virtual machine with which to run docker containers.

Automatic VM setup

Simply open the Docker Quickstart Terminal app, then follow the instructions from the Terminal output.

Manual VM setup

Open Terminal or iTerm, then use docker-machine to create the default VM:

docker-machine create -d virtualbox default

The output of the command above will be something like this:

Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
To see how to connect Docker to this machine, run: docker-machine env default

As noted in the last line of the docker-machine output above run:

docker-machine env default

Then run the following command to setup the environment variables needed. You'll need to run this whenever you start up a docker container.

eval "$(docker-machine env default)"

Setup the docker container

In a Terminal, navigate to where you cloned the pyMinecraft repo locally.

cd /path/to/pyMinecraft

Then run:

docker-compose build

This command will setup a Debian Jessie container within which the dependencies of Spigot will be installed, and Spigot itself will be built and run along with the RaspberryJuice plugin.

You should not have to do anything, except perhaps to wait patiently. If you are unable to wait patiently, it may be helpful to grab a cup of coffee or write the latest chapter of your novel whilst the operations complete.

Once the container has been built, you can then use docker-compose to bring up the spigot server and expose the necessary port to the host.

docker-compose up

In another Terminal tab, run: docker-machine ip default to determine the IP address mapped to the running docker container. This will be what you need to enter in the Server Address field when adding a new server to connect to in the Minecraft client.

Directions for setting up the server (non-Docker, manual process)

  • Install JAVA and JDK
  • Download Spigot's build tools:

> curl -O https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar

  • Build the Spigot Server:
##(MAC)
> export MAVEN_OPTS="-Xmx2G"
> java -Xmx2G -jar BuildTools.jar

##(NON-MAC)
> java -jar BuildTools.jar
  • Attempt to launch the server
> java -Xms512M -Xmx1024M -jar spigot-1.x.x.jar
  • Accept the EULA by editing eula.txt and changing eula=false to eula=true
  • Edit the server.properties file to dictate the type of world you want. See this webpage and this webpage for options. You'll likely want to turn on creative mode, turn off monster spawning, and set level-type=FLAT. An example server.properties file is available in the plugins directory.
  • Launch the server:
> java -Xms512M -Xmx1024M -jar spigot-1.x.x.jar