#import the minecraft.py module from the minecraft directory
import minecraft.minecraft as minecraft
#import minecraft block module
import minecraft.block as block
#import time, so delays can be used
import time

if __name__ == "__main__":

#Gives us plenty of time to switch between terminal and Minecraft Pi edition
time.sleep(10)

#Connect to minecraft by creating the minecraft object
# - minecraft needs to be running and in a game
mc = minecraft.Minecraft.create()

#Find out your players position
playerPos = mc.player.getPos()

#Using your players position
# - the players position is an x,y,z coordinate of floats (e.g. 23.59,12.00,-45.32)
# - in order to use the players position in other commands we need integers (e.g. 23,12,-45)
# - so round the players position
# - the Vec3 object is part of the minecraft class library
playerPos = minecraft.Vec3(int(playerPos.x), int(playerPos.y), int(playerPos.z))

A few times we ran this script, we ended up stuck inside the cubes and had to exit the game. I would imagine placing this many blocks at once might make the app a bit fragile.

Sadly this week it seems an upgrade on the iOS Minecraft Pocket edition means that we can’t access each others networked games. Hopefully we’ll get that functionality back when another version of Pi edition is released.

Am thinking now of ways we can add some sensors via GPIO and see how we can program a bit of outside world interaction with the game – maybe getting the dog involved to be a bit of chaos.. Watch this space.