from gdpc import Editor, Block
def build_house(editor, x, y, z):
# Define dimensions
width = 7
depth = 5
height = 4
# Materials
wall_block = Block("minecraft:bricks")
floor_block = Block("minecraft:spruce_planks")
roof_block = Block("minecraft:stone_brick_stairs")
window_block = Block("minecraft:glass_pane")
door_block = Block("minecraft:oak_door")
# Clear area
editor.fill((x, y, z), (x + width, y + height + 1, z + depth), Block("minecraft:air"))
# Floor
editor.fill((x, y, z), (x + width - 1, y, z + depth - 1), floor_block)
# Walls
editor.fill((x, y + 1, z), (x + width - 1, y + height, z), wall_block) # Front wall
editor.fill((x, y + 1, z + depth - 1), (x + width - 1, y + height, z + depth - 1), wall_block) # Back wall
editor.fill((x, y + 1, z), (x, y + height, z + depth - 1), wall_block) # Left wall
editor.fill((x + width - 1, y + 1, z), (x + width - 1, y + height, z + depth - 1), wall_block) # Right wall
# Windows
editor.placeBlock((x + 1, y + 2, z), window_block)
editor.placeBlock((x + width - 2, y + 2, z), window_block)
editor.placeBlock((x + 2, y + 2, z + depth - 1), window_block)
editor.placeBlock((x + width - 3, y + 2, z + depth - 1), window_block)
# Roof
for i in range(width):
editor.placeBlock((x + i, y + height + 1, z - 1), roof_block.withState(facing='north'))
editor.placeBlock((x + i, y + height + 1, z + depth), roof_block.withState(facing='south'))
for i in range(depth):
editor.placeBlock((x - 1, y + height + 1, z + i), roof_block.withState(facing='west'))
editor.placeBlock((x + width, y + height + 1, z + i), roof_block.withState(facing='east'))
# Door
editor.placeBlock((x + width // 2, y + 1, z), door_block.withState(facing='south', half='lower'))
editor.placeBlock((x + width // 2, y + 2, z), door_block.withState(facing='south', half='upper'))
editor = Editor(buffering=True)
build_house(editor, x=0, y=4, z=0)
editor.flush()