Last active
August 29, 2015 14:24
-
-
Save uktechreviews/bf3e967ad497ef129ae1 to your computer and use it in GitHub Desktop.
Minecraft house build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Automated house 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 and y so you don't end up facing the house | |
x +=2 | |
y +=2 | |
# set the dimensions of the house | |
height = 10 | |
length = 10 | |
width = 10 | |
# build the house with block id b_name | |
b_name = 1 | |
mc.setBlocks(x,y,z,x+length, y+width,z+height, b_name) | |
# hollow out the building with air b_name = 0 | |
# house doesn't have a floor at this stage - will add one in a minute | |
b_name =0 | |
mc.setBlocks(x+1,y,z+1,x+(length-1), y+(width-1),z+(height-1), b_name) | |
# make a gap on the front wall of the building | |
mc.setBlocks(x+(length/2),y,z,x+(length/2),y,z+2),0) | |
# add a door to the gap | |
b_name = 196 | |
mc.setBlocks(x+(length/2),y,z,x+(length/2),y,z+2),b_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment