Skip to content

Instantly share code, notes, and snippets.

@henrygarner
Created May 11, 2014 19:08
Show Gist options
  • Save henrygarner/7799e8176c57884b880b to your computer and use it in GitHub Desktop.
Save henrygarner/7799e8176c57884b880b to your computer and use it in GitHub Desktop.
from mcpi.minecraft import Minecraft
import mcpi.block as block
mc = Minecraft.create()
pos = mc.player.getTilePos()
width = 6
depth = 5
height = 4
def isWall(x, y, z):
return (x == 0 or x == width - 1 or
z == 0 or z == depth - 1)
def isRoof(x, y, z):
return y == height - 1
for x in range(width):
for y in range(height):
for z in range(depth):
if isRoof(x, y, z):
mc.setBlock(pos.x + x, pos.y + y, pos.z + z, block.GLASS)
elif isWall(x, y, z):
mc.setBlock(pos.x + x, pos.y + y, pos.z + z, block.COBBLESTONE)
else:
mc.setBlock(pos.x + x, pos.y + y, pos.z + z, block.AIR)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment