This cool little program designed by ‘500 Internal Server Error‘, automatically builds a rainbow in your MCPI world, upon loading the python file.
The code is as follows:
import mcpi.minecraft as minecraft import mcpi.block as block from math import *colors = [14, 1, 4, 5, 3, 11, 10] mc = minecraft.Minecraft.create() height = 60 mc.setBlocks(-64,0,0,64,height + len(colors),0,0) for x in range(0, 128): for colourindex in range(0, len(colors)): y = sin((x / 128.0) * pi) * height + colourindex mc.setBlock(x - 64, int(y), 0, block.WOOL.id, colors[len(colors) - 1 - colourindex])
The original thread where the program was shared can be found here.
To run the program, open up ‘LeafPad‘, copy this code into it and save it in /mcpi/api/python as a .py file. Save it as rainbow.py. Then, once you have a MCPI world loaded up, open up ‘Terminal‘ and navigate to where you saved the file using cd and type python rainbow.py.