During activities week at school the Science department are doing some work based around first aid. Wanting (obviously) to use a Raspberry Pi I am running Minecraft workshops for groups of 30 students.

The students will have to design, build and evaluate Red Cross Emergency hospitals in Minecraft.

To give the students a head start I have written a Python program to build the shell of their hospitals for them.

# Automated hospital building code
# Spencer Organ - July 2015

# set up connection to Minecraft
import mcpi.minecraft as minecraft
import mcpi.block as block
mc = minecraft.Minecraft.create()
x,y,z = mc.player.getPos()

# set an off-set for x so you don't end up facing the house and wondering why it goes dark
x +=2

# define the dimensions of the hospital
height = 3	
length = 10
width = 10

# build the house with stone
b_name = 1
mc.setBlocks(x,y,z,x+length, y+height,z+width, b_name)

# hollow out the building with air
b_name =0
mc.setBlocks(x+1,y,z+1,x+(length-1), y+(height-1),z+(width-1), b_name)

# house doesn't have a floor at this stage - will add one in a minute

# make a gap on the front wall of the building half way down
b_name=0	
mc.setBlocks(x+(length/2),y,z,x+(length/2),y+1,z, b_name)

# Add a couple of torches either side of the door opening
b_name=50	
mc.setBlock(x+((length/2)-1),y+(height-1),(z-1), b_name)
mc.setBlock(x+((length/2)+1),y+(height-1),(z-1), b_name)

# Add a first aid sign to the left hand side of the door using white and red wool	
mc.setBlock(x+((length/2)+4),y+(height-2),(z), 35,14)
mc.setBlock(x+((length/2)+3),y+(height-2),(z), 35,14)
mc.setBlock(x+((length/2)+2),y+(height-2),(z), 35,14)
mc.setBlock(x+((length/2)+3),y+(height-1),(z), 35,14)
mc.setBlock(x+((length/2)+4),y+(height-1),(z), 35,0)
mc.setBlock(x+((length/2)+2),y+(height-1),(z), 35,0)
mc.setBlock(x+((length/2)+4),y+(height-3),(z), 35,0)
mc.setBlock(x+((length/2)+2),y+(height-3),(z), 35,0)
mc.setBlock(x+((length/2)+3),y+(height-3),(z), 35,14)

# Add a first aid sign to the right hand side of the door using white and red wool	
mc.setBlock(x+((length/2)-4),y+(height-2),(z), 35,14)
mc.setBlock(x+((length/2)-3),y+(height-2),(z), 35,14)
mc.setBlock(x+((length/2)-2),y+(height-2),(z), 35,14)
mc.setBlock(x+((length/2)-3),y+(height-1),(z), 35,14)
mc.setBlock(x+((length/2)-4),y+(height-1),(z), 35,0)
mc.setBlock(x+((length/2)-2),y+(height-1),(z), 35,0)
mc.setBlock(x+((length/2)-4),y+(height-3),(z), 35,0)
mc.setBlock(x+((length/2)-2),y+(height-3),(z), 35,0)
mc.setBlock(x+((length/2)-3),y+(height-3),(z), 35,14)

# add a foor to the house
b_name = 5
mc.setBlocks(x,y-1,z,x+length,y-1,z+(width-1),b_name)

Leave a Reply

Your email address will not be published. Required fields are marked *