Skip to content

Instantly share code, notes, and snippets.

@uktechreviews
Created July 6, 2015 17:50
Show Gist options
  • Save uktechreviews/11c71ccd7d988cecc522 to your computer and use it in GitHub Desktop.
Save uktechreviews/11c71ccd7d988cecc522 to your computer and use it in GitHub Desktop.
Build a simple hospital in Minecraft Pi edition
# 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment