Minecraft Molehills?

Here’s a little program for generating random holes in the landscape and automatically putting a candle at the bottom. The idea is that this could be run on the Raspberry Pi running as a server so that other players can have a little fun hunting for them.

I’ve discovered that candles don’t like being put underwater… no surprise there!

Hole generated in Python with a candle at the bottom.

Watch your step – a deep hole created by the python program.

Screenshots have been created following the instructions at Raspberry Pi – Spy.

from mcpi import minecraft
import time
import random
mc = minecraft.Minecraft.create()

mc.postToChat("Python is now in control!")

def Molehole(x,y,z,depth):
    mc.setBlocks(x,y+40,z,x+0,y-depth,z+0,0) #clear the space first
    mc.setBlock(x,y-depth,z,50) #Put a candle at the bottom of the tunnel  

for loop in range(20):
    startx = random.randint(-120,120)
    startz = random.randint(-120,120)
    starty = 0

RPi Kitchen elsewhere…

I’m very keen to make resources available, so here are links to the other sites. They’re not all Raspberry Pi related, but they do include programming, 3d design, hacking, modifying and making:

YouMagine – for my 3d printing and other design files.

YouTube – for my videos of models, programming ideas and demonstrations.