Nice job! I've added a link to this thread from a blog where I'm trying to keep track of all the cool python scripts being developed for minecraft pi. Thanks for sharing it here!
I type import mcpi.minecraft as minecraft and it says error no module named mcpi.minecraft
Run the script in /home/pi/mcpi/api/python (the module error basically means that it can't find the Minecraft API, which it expects to be in mcpi/minecraft.py.
Put into the api/python folder, then, cd to that folder and execute python whateveryounamedit.py while Minecraft is running.
e.g.
Download the script to /home/pi/mcpi/api/python/a.py
Open terminal
cd /home/pi/mcpi/api/python
python a.py
I tested this by using RaspberryJuice to simulate Pi edition, so I'm curious to see whether this runs on a real Pi.
But
http://mcpipy.wordpress.com/2013/02/12/rainbows-in-minecraft/
Run the script in /home/pi/mcpi/api/python (the module error basically means that it can't find the Minecraft API, which it expects to be in mcpi/minecraft.py.