japanese_house.py 18.3 KB
Newer Older
Craige McWhirter's avatar
Craige McWhirter committed
1 2 3 4 5 6 7
#!/usr/bin/python2.7

''' japanese_house.py
Produces a Minecraft interpretation of a classic Japanese house. Presently it
only produces the single configuration that is little more than an empty shell.
'''

Craige McWhirter's avatar
Craige McWhirter committed
8 9 10
import mcpi.minecraft as minecraft
import mcpi.block as block

Craige McWhirter's avatar
Craige McWhirter committed
11
MC = minecraft.Minecraft.create()
Craige McWhirter's avatar
Craige McWhirter committed
12

Craige McWhirter's avatar
Craige McWhirter committed
13
POS = MC.player.getTilePos()
Craige McWhirter's avatar
Craige McWhirter committed
14 15

# House dimensions
Craige McWhirter's avatar
Craige McWhirter committed
16 17
HOUSE_X = list(range(3, 20))
HOUSE_Z = list(range(-1, 12))
Craige McWhirter's avatar
Craige McWhirter committed
18
# Floor
Craige McWhirter's avatar
Craige McWhirter committed
19 20
GROUNDS_Y = POS.y - 1
FLOOR_Y = POS.y
Craige McWhirter's avatar
Craige McWhirter committed
21
LOWER_ROOF_Y = FLOOR_Y + 4
Craige McWhirter's avatar
Craige McWhirter committed
22
VERANDAH_SIZE = 1
Craige McWhirter's avatar
Craige McWhirter committed
23 24

# Set blocks
Craige McWhirter's avatar
Craige McWhirter committed
25 26 27 28 29 30 31 32 33 34 35 36
GROUNDS = block.GRASS.id
FLOORING = block.DOUBLE_WOODEN_SLAB.id, 5
POLES = block.WOOD.id, 1
PANELS = block.WOOL.id
STAIRS = block.WOODEN_SLAB.id, 5
ROOF_STAIRS_EAST = block.STAIRS_WOOD.id, 0
ROOF_STAIRS_WEST = block.STAIRS_WOOD.id, 1
ROOF_STAIRS_SOUTH = block.STAIRS_WOOD.id, 2
ROOF_STAIRS_NORTH = block.STAIRS_WOOD.id, 3
ROOF_SLAB = block.WOODEN_SLAB.id
ROOF_CORNERS = block.DOUBLE_WOODEN_SLAB.id, 0
CAPSTONE = block.STONE_SLAB.id, 0
Craige McWhirter's avatar
Craige McWhirter committed
37 38 39
LIGHT_POST = block.FENCE.id
EXTERIOR_LIGHT = block.GLOWSTONE_BLOCK.id
EXT_LIGHT_BASE = block.WOODEN_SLAB.id, 8
Craige McWhirter's avatar
Craige McWhirter committed
40 41 42


def clear_space():
Craige McWhirter's avatar
Craige McWhirter committed
43 44 45 46 47 48 49 50
    ''' Clear a space for the house by setting it to AIR '''
    MC.setBlocks(
        POS.x + HOUSE_X[0] - VERANDAH_SIZE - 3,
        FLOOR_Y,
        POS.z + HOUSE_Z[0] - VERANDAH_SIZE - 3,
        POS.x + HOUSE_X[-1] + VERANDAH_SIZE + 3,
        FLOOR_Y + 100,
        POS.z + HOUSE_Z[-1] + VERANDAH_SIZE + 3,
Craige McWhirter's avatar
Craige McWhirter committed
51 52 53 54 55
        block.AIR.id
        )


def build_grounds():
Craige McWhirter's avatar
Craige McWhirter committed
56 57 58 59 60 61 62 63 64
    ''' Build the grounds and gardens '''
    MC.setBlocks(
        POS.x + HOUSE_X[0] - VERANDAH_SIZE - 3,
        GROUNDS_Y,
        POS.z + HOUSE_Z[0] - VERANDAH_SIZE - 3,
        POS.x + HOUSE_X[-1] + VERANDAH_SIZE + 3,
        GROUNDS_Y,
        POS.z + HOUSE_Z[-1] + VERANDAH_SIZE + 3,
        GROUNDS
Craige McWhirter's avatar
Craige McWhirter committed
65 66 67 68
        )


def build_floor():
Craige McWhirter's avatar
Craige McWhirter committed
69 70 71 72 73 74 75 76 77
    ''' Build the floor and the verandah '''
    MC.setBlocks(
        POS.x + HOUSE_X[0] - VERANDAH_SIZE,
        FLOOR_Y,
        POS.z + HOUSE_Z[0] - VERANDAH_SIZE,
        POS.x + HOUSE_X[-1] + VERANDAH_SIZE,
        FLOOR_Y,
        POS.z + HOUSE_Z[-1] + VERANDAH_SIZE,
        FLOORING
Craige McWhirter's avatar
Craige McWhirter committed
78 79 80 81
        )


def house_posts():
Craige McWhirter's avatar
Craige McWhirter committed
82 83 84 85 86
    ''' Set out the house poles by making the entire walls poles, the carve
    away what we don't need later.
    '''
    post_y_bottom = FLOOR_Y + 1
    post_y_top = FLOOR_Y + 4
Craige McWhirter's avatar
Craige McWhirter committed
87
    # West posts:
Craige McWhirter's avatar
Craige McWhirter committed
88 89 90 91
    MC.setBlocks(
        POS.x + HOUSE_X[0], post_y_bottom, POS.z + HOUSE_Z[0],
        POS.x + HOUSE_X[0], post_y_top, POS.z + HOUSE_Z[-1],
        POLES
Craige McWhirter's avatar
Craige McWhirter committed
92 93
        )
    # East posts:
Craige McWhirter's avatar
Craige McWhirter committed
94 95 96 97
    MC.setBlocks(
        POS.x + HOUSE_X[-1], post_y_bottom, POS.z + HOUSE_Z[0],
        POS.x + HOUSE_X[-1], post_y_top, POS.z + HOUSE_Z[-1],
        POLES
Craige McWhirter's avatar
Craige McWhirter committed
98 99
        )
    # North posts:
Craige McWhirter's avatar
Craige McWhirter committed
100 101 102 103
    MC.setBlocks(
        POS.x + HOUSE_X[0], post_y_bottom, POS.z + HOUSE_Z[0],
        POS.x + HOUSE_X[-1], post_y_top, POS.z + HOUSE_Z[0],
        POLES
Craige McWhirter's avatar
Craige McWhirter committed
104 105
        )
    # South posts:
Craige McWhirter's avatar
Craige McWhirter committed
106 107 108 109
    MC.setBlocks(
        POS.x + HOUSE_X[0], post_y_bottom, POS.z + HOUSE_Z[-1],
        POS.x + HOUSE_X[-1], post_y_top, POS.z + HOUSE_Z[-1],
        POLES
Craige McWhirter's avatar
Craige McWhirter committed
110 111 112 113
        )


def wall_panels():
Craige McWhirter's avatar
Craige McWhirter committed
114 115 116
    ''' Build the wall panels for the ground floor '''
    panel_y_bottom = FLOOR_Y + 1
    panel_y_top = FLOOR_Y + 3
Craige McWhirter's avatar
Craige McWhirter committed
117
    # West Panels
Craige McWhirter's avatar
Craige McWhirter committed
118 119 120 121
    MC.setBlocks(
        POS.x + HOUSE_X[0], panel_y_bottom, POS.z + HOUSE_Z[1],
        POS.x + HOUSE_X[0], panel_y_top, POS.z + HOUSE_Z[3],
        PANELS
Craige McWhirter's avatar
Craige McWhirter committed
122
        )
Craige McWhirter's avatar
Craige McWhirter committed
123 124 125 126
    MC.setBlocks(
        POS.x + HOUSE_X[0], panel_y_bottom, POS.z + HOUSE_Z[5],
        POS.x + HOUSE_X[0], panel_y_top, POS.z + HOUSE_Z[7],
        PANELS
Craige McWhirter's avatar
Craige McWhirter committed
127
        )
Craige McWhirter's avatar
Craige McWhirter committed
128 129 130 131
    MC.setBlocks(
        POS.x + HOUSE_X[0], panel_y_bottom, POS.z + HOUSE_Z[9],
        POS.x + HOUSE_X[0], panel_y_top, POS.z + HOUSE_Z[11],
        PANELS
Craige McWhirter's avatar
Craige McWhirter committed
132 133
        )
    # East Panels
Craige McWhirter's avatar
Craige McWhirter committed
134 135 136 137
    MC.setBlocks(
        POS.x + HOUSE_X[-1], panel_y_bottom, POS.z + HOUSE_Z[1],
        POS.x + HOUSE_X[-1], panel_y_top, POS.z + HOUSE_Z[3],
        PANELS
Craige McWhirter's avatar
Craige McWhirter committed
138
        )
Craige McWhirter's avatar
Craige McWhirter committed
139 140 141 142
    MC.setBlocks(
        POS.x + HOUSE_X[-1], panel_y_bottom, POS.z + HOUSE_Z[5],
        POS.x + HOUSE_X[-1], panel_y_top, POS.z + HOUSE_Z[7],
        PANELS
Craige McWhirter's avatar
Craige McWhirter committed
143
        )
Craige McWhirter's avatar
Craige McWhirter committed
144 145 146 147
    MC.setBlocks(
        POS.x + HOUSE_X[-1], panel_y_bottom, POS.z + HOUSE_Z[9],
        POS.x + HOUSE_X[-1], panel_y_top, POS.z + HOUSE_Z[11],
        PANELS
Craige McWhirter's avatar
Craige McWhirter committed
148 149
        )
    # North Panels
Craige McWhirter's avatar
Craige McWhirter committed
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
    MC.setBlocks(
        POS.x + HOUSE_X[1], panel_y_bottom, POS.z + HOUSE_Z[0],
        POS.x + HOUSE_X[3], panel_y_top, POS.z + HOUSE_Z[0],
        PANELS
        )
    MC.setBlocks(
        POS.x + HOUSE_X[5], panel_y_bottom, POS.z + HOUSE_Z[0],
        POS.x + HOUSE_X[7], panel_y_top, POS.z + HOUSE_Z[0],
        PANELS
        )
    MC.setBlocks(
        POS.x + HOUSE_X[9], panel_y_bottom, POS.z + HOUSE_Z[0],
        POS.x + HOUSE_X[11], panel_y_top, POS.z + HOUSE_Z[0],
        PANELS
        )
    MC.setBlocks(
        POS.x + HOUSE_X[13], panel_y_bottom, POS.z + HOUSE_Z[0],
        POS.x + HOUSE_X[15], panel_y_top, POS.z + HOUSE_Z[0],
        PANELS
Craige McWhirter's avatar
Craige McWhirter committed
169 170
        )
    # South panels:
Craige McWhirter's avatar
Craige McWhirter committed
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
    MC.setBlocks(
        POS.x + HOUSE_X[1], panel_y_bottom, POS.z + HOUSE_Z[-1],
        POS.x + HOUSE_X[3], panel_y_top, POS.z + HOUSE_Z[-1],
        PANELS
        )
    MC.setBlocks(
        POS.x + HOUSE_X[5], panel_y_bottom, POS.z + HOUSE_Z[-1],
        POS.x + HOUSE_X[7], panel_y_top, POS.z + HOUSE_Z[-1],
        PANELS
        )
    MC.setBlocks(
        POS.x + HOUSE_X[9], panel_y_bottom, POS.z + HOUSE_Z[-1],
        POS.x + HOUSE_X[11], panel_y_top, POS.z + HOUSE_Z[-1],
        PANELS
        )
    MC.setBlocks(
        POS.x + HOUSE_X[13], panel_y_bottom, POS.z + HOUSE_Z[-1],
        POS.x + HOUSE_X[15], panel_y_top, POS.z + HOUSE_Z[-1],
        PANELS
        )
    MC.setBlocks(
        POS.x + HOUSE_X[1], panel_y_bottom, POS.z + HOUSE_Z[-1],
        POS.x + HOUSE_X[3], panel_y_top, POS.z + HOUSE_Z[-1],
        PANELS
Craige McWhirter's avatar
Craige McWhirter committed
195 196 197 198
        )


def door():
Craige McWhirter's avatar
Craige McWhirter committed
199 200 201 202 203 204
    ''' Every home needs a door, lets carve one right here, in the centre of
    the west side
    '''
    MC.setBlocks(
        POS.x + 3, POS.y + 1, POS.z + 5,
        POS.x + 3, POS.y + 2, POS.z + 5,
Craige McWhirter's avatar
Craige McWhirter committed
205 206 207 208 209
        block.AIR.id
        )


def verandah_stairs():
Craige McWhirter's avatar
Craige McWhirter committed
210 211 212 213 214 215 216 217 218 219
    ''' Define the stairs as area and let everything running later clobber it.
    '''
    MC.setBlocks(
        POS.x + HOUSE_X[0] - VERANDAH_SIZE - 1,
        FLOOR_Y,
        POS.z + HOUSE_Z[0] - VERANDAH_SIZE - 1,
        POS.x + HOUSE_X[-1] + VERANDAH_SIZE + 1,
        FLOOR_Y,
        POS.z + HOUSE_Z[-1] + VERANDAH_SIZE + 1,
        STAIRS
Craige McWhirter's avatar
Craige McWhirter committed
220 221 222 223
        )


def lower_roof():
Craige McWhirter's avatar
Craige McWhirter committed
224
    ''' Build the lower roof '''
Craige McWhirter's avatar
Craige McWhirter committed
225 226 227
    # Inner row
    # Set a wood block on each corner
    # North West corner
Craige McWhirter's avatar
Craige McWhirter committed
228
    MC.setBlock(
Craige McWhirter's avatar
Craige McWhirter committed
229
        POS.x + HOUSE_X[0] - 1, LOWER_ROOF_Y, POS.z + HOUSE_Z[0] - 1,
Craige McWhirter's avatar
Craige McWhirter committed
230
        ROOF_CORNERS
Craige McWhirter's avatar
Craige McWhirter committed
231 232
        )
    # South West corner
Craige McWhirter's avatar
Craige McWhirter committed
233
    MC.setBlock(
Craige McWhirter's avatar
Craige McWhirter committed
234
        POS.x + HOUSE_X[0] - 1, LOWER_ROOF_Y, POS.z + HOUSE_Z[-1] + 1,
Craige McWhirter's avatar
Craige McWhirter committed
235
        ROOF_CORNERS
Craige McWhirter's avatar
Craige McWhirter committed
236 237
        )
    # North East corner
Craige McWhirter's avatar
Craige McWhirter committed
238
    MC.setBlock(
Craige McWhirter's avatar
Craige McWhirter committed
239
        POS.x + HOUSE_X[-1] + 1, LOWER_ROOF_Y, POS.z + HOUSE_Z[0] - 1,
Craige McWhirter's avatar
Craige McWhirter committed
240
        ROOF_CORNERS
Craige McWhirter's avatar
Craige McWhirter committed
241 242
        )
    # South East corner
Craige McWhirter's avatar
Craige McWhirter committed
243
    MC.setBlock(
Craige McWhirter's avatar
Craige McWhirter committed
244
        POS.x + HOUSE_X[-1] + 1, LOWER_ROOF_Y, POS.z + HOUSE_Z[-1] + 1,
Craige McWhirter's avatar
Craige McWhirter committed
245
        ROOF_CORNERS
Craige McWhirter's avatar
Craige McWhirter committed
246 247 248
        )
    # Set outward facing stairs in between
    # Western roofing stairs
Craige McWhirter's avatar
Craige McWhirter committed
249
    MC.setBlocks(
Craige McWhirter's avatar
Craige McWhirter committed
250 251
        POS.x + HOUSE_X[0] - 1, LOWER_ROOF_Y, POS.z + HOUSE_Z[0],
        POS.x + HOUSE_X[0] - 1, LOWER_ROOF_Y, POS.z + HOUSE_Z[-1],
Craige McWhirter's avatar
Craige McWhirter committed
252
        ROOF_STAIRS_WEST
Craige McWhirter's avatar
Craige McWhirter committed
253 254
        )
    # Northern roofing stairs
Craige McWhirter's avatar
Craige McWhirter committed
255
    MC.setBlocks(
Craige McWhirter's avatar
Craige McWhirter committed
256 257
        POS.x + HOUSE_X[0], LOWER_ROOF_Y, POS.z + HOUSE_Z[0] - 1,
        POS.x + HOUSE_X[-1], LOWER_ROOF_Y, POS.z + HOUSE_Z[0] - 1,
Craige McWhirter's avatar
Craige McWhirter committed
258
        ROOF_STAIRS_NORTH
Craige McWhirter's avatar
Craige McWhirter committed
259 260
        )
    # Eastern roofing stairs
Craige McWhirter's avatar
Craige McWhirter committed
261
    MC.setBlocks(
Craige McWhirter's avatar
Craige McWhirter committed
262 263
        POS.x + HOUSE_X[-1] + 1, LOWER_ROOF_Y, POS.z + HOUSE_Z[0],
        POS.x + HOUSE_X[-1] + 1, LOWER_ROOF_Y, POS.z + HOUSE_Z[-1],
Craige McWhirter's avatar
Craige McWhirter committed
264
        ROOF_STAIRS_EAST
Craige McWhirter's avatar
Craige McWhirter committed
265 266
        )
    # Southern roofing stairs
Craige McWhirter's avatar
Craige McWhirter committed
267
    MC.setBlocks(
Craige McWhirter's avatar
Craige McWhirter committed
268 269
        POS.x + HOUSE_X[0], LOWER_ROOF_Y, POS.z + HOUSE_Z[-1] + 1,
        POS.x + HOUSE_X[-1], LOWER_ROOF_Y, POS.z + HOUSE_Z[-1] + 1,
Craige McWhirter's avatar
Craige McWhirter committed
270
        ROOF_STAIRS_SOUTH
Craige McWhirter's avatar
Craige McWhirter committed
271 272 273 274
        )
    # Middle row
    # Set a wood block on each corner
    # North West corner
Craige McWhirter's avatar
Craige McWhirter committed
275
    MC.setBlock(
Craige McWhirter's avatar
Craige McWhirter committed
276
        POS.x + HOUSE_X[0] - 2, LOWER_ROOF_Y, POS.z + HOUSE_Z[0] - 2,
Craige McWhirter's avatar
Craige McWhirter committed
277
        ROOF_CORNERS
Craige McWhirter's avatar
Craige McWhirter committed
278 279
        )
    # South West corner
Craige McWhirter's avatar
Craige McWhirter committed
280
    MC.setBlock(
Craige McWhirter's avatar
Craige McWhirter committed
281
        POS.x + HOUSE_X[0] - 2, LOWER_ROOF_Y, POS.z + HOUSE_Z[-1] + 2,
Craige McWhirter's avatar
Craige McWhirter committed
282
        ROOF_CORNERS
Craige McWhirter's avatar
Craige McWhirter committed
283 284
        )
    # North East corner
Craige McWhirter's avatar
Craige McWhirter committed
285
    MC.setBlock(
Craige McWhirter's avatar
Craige McWhirter committed
286
        POS.x + HOUSE_X[-1] + 2, LOWER_ROOF_Y, POS.z + HOUSE_Z[0] - 2,
Craige McWhirter's avatar
Craige McWhirter committed
287
        ROOF_CORNERS
Craige McWhirter's avatar
Craige McWhirter committed
288 289
        )
    # South East corner
Craige McWhirter's avatar
Craige McWhirter committed
290
    MC.setBlock(
Craige McWhirter's avatar
Craige McWhirter committed
291
        POS.x + HOUSE_X[-1] + 2, LOWER_ROOF_Y, POS.z + HOUSE_Z[-1] + 2,
Craige McWhirter's avatar
Craige McWhirter committed
292
        ROOF_CORNERS
Craige McWhirter's avatar
Craige McWhirter committed
293 294 295
        )
    # Set single wood slabs in between
    # Western roofing slabs
Craige McWhirter's avatar
Craige McWhirter committed
296
    MC.setBlocks(
Craige McWhirter's avatar
Craige McWhirter committed
297 298
        POS.x + HOUSE_X[0] - 2, LOWER_ROOF_Y, POS.z + HOUSE_Z[0] - 1,
        POS.x + HOUSE_X[0] - 2, LOWER_ROOF_Y, POS.z + HOUSE_Z[-1] + 1,
Craige McWhirter's avatar
Craige McWhirter committed
299
        ROOF_SLAB
Craige McWhirter's avatar
Craige McWhirter committed
300 301
        )
    # Northern roofing slabs
Craige McWhirter's avatar
Craige McWhirter committed
302
    MC.setBlocks(
Craige McWhirter's avatar
Craige McWhirter committed
303 304
        POS.x + HOUSE_X[0] - 1, LOWER_ROOF_Y, POS.z + HOUSE_Z[0] - 2,
        POS.x + HOUSE_X[-1] + 1, LOWER_ROOF_Y, POS.z + HOUSE_Z[0] - 2,
Craige McWhirter's avatar
Craige McWhirter committed
305
        ROOF_SLAB
Craige McWhirter's avatar
Craige McWhirter committed
306 307
        )
    # Eastern roofing slabs
Craige McWhirter's avatar
Craige McWhirter committed
308
    MC.setBlocks(
Craige McWhirter's avatar
Craige McWhirter committed
309 310
        POS.x + HOUSE_X[-1] + 2, LOWER_ROOF_Y, POS.z + HOUSE_Z[0] - 1,
        POS.x + HOUSE_X[-1] + 2, LOWER_ROOF_Y, POS.z + HOUSE_Z[-1] + 1,
Craige McWhirter's avatar
Craige McWhirter committed
311
        ROOF_SLAB
Craige McWhirter's avatar
Craige McWhirter committed
312 313
        )
    # Southern roofing slabs
Craige McWhirter's avatar
Craige McWhirter committed
314
    MC.setBlocks(
Craige McWhirter's avatar
Craige McWhirter committed
315 316
        POS.x + HOUSE_X[0] - 1, LOWER_ROOF_Y, POS.z + HOUSE_Z[-1] + 2,
        POS.x + HOUSE_X[-1] + 1, LOWER_ROOF_Y, POS.z + HOUSE_Z[-1] + 2,
Craige McWhirter's avatar
Craige McWhirter committed
317
        ROOF_SLAB
Craige McWhirter's avatar
Craige McWhirter committed
318 319 320 321
        )
    # Upper row
    # Set a wood block on each corner
    # North West corner
Craige McWhirter's avatar
Craige McWhirter committed
322
    upper_row_y = LOWER_ROOF_Y + 1
Craige McWhirter's avatar
Craige McWhirter committed
323 324 325
    MC.setBlock(
        POS.x + HOUSE_X[0], upper_row_y, POS.z + HOUSE_Z[0],
        ROOF_SLAB
Craige McWhirter's avatar
Craige McWhirter committed
326 327
        )
    # South West corner
Craige McWhirter's avatar
Craige McWhirter committed
328 329 330
    MC.setBlock(
        POS.x + HOUSE_X[0], upper_row_y, POS.z + HOUSE_Z[-1],
        ROOF_SLAB
Craige McWhirter's avatar
Craige McWhirter committed
331 332
        )
    # North East corner
Craige McWhirter's avatar
Craige McWhirter committed
333 334 335
    MC.setBlock(
        POS.x + HOUSE_X[-1], upper_row_y, POS.z + HOUSE_Z[0],
        ROOF_SLAB
Craige McWhirter's avatar
Craige McWhirter committed
336 337
        )
    # South East corner
Craige McWhirter's avatar
Craige McWhirter committed
338 339 340
    MC.setBlock(
        POS.x + HOUSE_X[-1], upper_row_y, POS.z + HOUSE_Z[-1],
        ROOF_SLAB
Craige McWhirter's avatar
Craige McWhirter committed
341 342 343
        )
    # Set single wood slabs in between
    # Western roofing slabs
Craige McWhirter's avatar
Craige McWhirter committed
344 345 346 347
    MC.setBlocks(
        POS.x + HOUSE_X[0], upper_row_y, POS.z + HOUSE_Z[1],
        POS.x + HOUSE_X[0], upper_row_y, POS.z + HOUSE_Z[-2],
        ROOF_STAIRS_WEST
Craige McWhirter's avatar
Craige McWhirter committed
348 349
        )
    # Northern roofing slabs
Craige McWhirter's avatar
Craige McWhirter committed
350 351 352 353
    MC.setBlocks(
        POS.x + HOUSE_X[1], upper_row_y, POS.z + HOUSE_Z[0],
        POS.x + HOUSE_X[-2], upper_row_y, POS.z + HOUSE_Z[0],
        ROOF_STAIRS_NORTH
Craige McWhirter's avatar
Craige McWhirter committed
354 355
        )
    # Eastern roofing slabs
Craige McWhirter's avatar
Craige McWhirter committed
356 357 358 359
    MC.setBlocks(
        POS.x + HOUSE_X[-1], upper_row_y, POS.z + HOUSE_Z[1],
        POS.x + HOUSE_X[-1], upper_row_y, POS.z + HOUSE_Z[-2],
        ROOF_STAIRS_EAST
Craige McWhirter's avatar
Craige McWhirter committed
360 361
        )
    # Southern roofing slabs
Craige McWhirter's avatar
Craige McWhirter committed
362 363 364 365
    MC.setBlocks(
        POS.x + HOUSE_X[1], upper_row_y, POS.z + HOUSE_Z[-1],
        POS.x + HOUSE_X[-2], upper_row_y, POS.z + HOUSE_Z[-1],
        ROOF_STAIRS_SOUTH
Craige McWhirter's avatar
Craige McWhirter committed
366 367
        )

Craige McWhirter's avatar
Craige McWhirter committed
368

Craige McWhirter's avatar
Craige McWhirter committed
369
def upper_level():
Craige McWhirter's avatar
Craige McWhirter committed
370
    ''' Build the mezzanine level '''
Craige McWhirter's avatar
Craige McWhirter committed
371
    # The floor of the mezzanine level
Craige McWhirter's avatar
Craige McWhirter committed
372 373 374 375
    upper_level_y = FLOOR_Y + 5
    MC.setBlocks(
        POS.x + HOUSE_X[1], upper_level_y, POS.z + HOUSE_Z[1],
        POS.x + HOUSE_X[-2], upper_level_y, POS.z + HOUSE_Z[-2],
Craige McWhirter's avatar
Craige McWhirter committed
376 377 378
        block.DOUBLE_WOODEN_SLAB.id, 1
        )
    # The upper floor wall
Craige McWhirter's avatar
Craige McWhirter committed
379 380 381 382
    MC.setBlocks(
        POS.x + HOUSE_X[1], upper_level_y + 1, POS.z + HOUSE_Z[1],
        POS.x + HOUSE_X[-2], upper_level_y + 1, POS.z + HOUSE_Z[-2],
        POLES
Craige McWhirter's avatar
Craige McWhirter committed
383 384
        )
    # The upper floor roof
Craige McWhirter's avatar
Craige McWhirter committed
385 386 387 388
    MC.setBlocks(
        POS.x + HOUSE_X[1] - 2, upper_level_y + 2, POS.z + HOUSE_Z[1] - 2,
        POS.x + HOUSE_X[-2] + 2, upper_level_y + 2, POS.z + HOUSE_Z[-2] + 2,
        ROOF_SLAB
Craige McWhirter's avatar
Craige McWhirter committed
389 390
        )
    # The upper floor roof stairs
Craige McWhirter's avatar
Craige McWhirter committed
391 392 393 394
    MC.setBlocks(
        POS.x + HOUSE_X[1], upper_level_y + 2, POS.z + HOUSE_Z[1],
        POS.x + HOUSE_X[-2], upper_level_y + 2, POS.z + HOUSE_Z[-2],
        ROOF_STAIRS_NORTH
Craige McWhirter's avatar
Craige McWhirter committed
395 396
        )
    # Clear the upper floor
Craige McWhirter's avatar
Craige McWhirter committed
397 398 399
    MC.setBlocks(
        POS.x + HOUSE_X[2], upper_level_y + 1, POS.z + HOUSE_Z[2],
        POS.x + HOUSE_X[-3], upper_level_y + 2, POS.z + HOUSE_Z[-3],
Craige McWhirter's avatar
Craige McWhirter committed
400 401 402 403
        block.AIR.id
        )
    # Add the decorative corner blocks
    # Northwest corner
Craige McWhirter's avatar
Craige McWhirter committed
404 405
    MC.setBlock(
        POS.x + HOUSE_X[1], upper_level_y + 2, POS.z + HOUSE_Z[1], ROOF_CORNERS
Craige McWhirter's avatar
Craige McWhirter committed
406
        )
Craige McWhirter's avatar
Craige McWhirter committed
407 408
    MC.setBlock(
        POS.x + HOUSE_X[0], upper_level_y + 2, POS.z + HOUSE_Z[0], ROOF_CORNERS
Craige McWhirter's avatar
Craige McWhirter committed
409
        )
Craige McWhirter's avatar
Craige McWhirter committed
410 411 412
    MC.setBlock(
        POS.x + HOUSE_X[0] - 1, upper_level_y + 2, POS.z + HOUSE_Z[0] - 1,
        ROOF_CORNERS
Craige McWhirter's avatar
Craige McWhirter committed
413 414
        )
    # Southwest corner
Craige McWhirter's avatar
Craige McWhirter committed
415 416
    MC.setBlock(
        POS.x + HOUSE_X[1], upper_level_y + 2, POS.z + HOUSE_Z[-2], ROOF_CORNERS
Craige McWhirter's avatar
Craige McWhirter committed
417
        )
Craige McWhirter's avatar
Craige McWhirter committed
418 419
    MC.setBlock(
        POS.x + HOUSE_X[0], upper_level_y + 2, POS.z + HOUSE_Z[-1], ROOF_CORNERS
Craige McWhirter's avatar
Craige McWhirter committed
420
        )
Craige McWhirter's avatar
Craige McWhirter committed
421 422 423
    MC.setBlock(
        POS.x + HOUSE_X[0] - 1, upper_level_y + 2, POS.z + HOUSE_Z[-1] + 1,
        ROOF_CORNERS
Craige McWhirter's avatar
Craige McWhirter committed
424 425
        )
    # Northeast corner
Craige McWhirter's avatar
Craige McWhirter committed
426 427
    MC.setBlock(
        POS.x + HOUSE_X[-2], upper_level_y + 2, POS.z + HOUSE_Z[1], ROOF_CORNERS
Craige McWhirter's avatar
Craige McWhirter committed
428
        )
Craige McWhirter's avatar
Craige McWhirter committed
429 430
    MC.setBlock(
        POS.x + HOUSE_X[-1], upper_level_y + 2, POS.z + HOUSE_Z[0], ROOF_CORNERS
Craige McWhirter's avatar
Craige McWhirter committed
431
        )
Craige McWhirter's avatar
Craige McWhirter committed
432 433 434
    MC.setBlock(
        POS.x + HOUSE_X[-1] + 1, upper_level_y + 2, POS.z + HOUSE_Z[0] - 1,
        ROOF_CORNERS
Craige McWhirter's avatar
Craige McWhirter committed
435 436
        )
    # Southeast corner
Craige McWhirter's avatar
Craige McWhirter committed
437 438 439
    MC.setBlock(
        POS.x + HOUSE_X[-2], upper_level_y + 2, POS.z + HOUSE_Z[-2],
        ROOF_CORNERS
Craige McWhirter's avatar
Craige McWhirter committed
440
        )
Craige McWhirter's avatar
Craige McWhirter committed
441 442 443
    MC.setBlock(
        POS.x + HOUSE_X[-1], upper_level_y + 2, POS.z + HOUSE_Z[-1],
        ROOF_CORNERS
Craige McWhirter's avatar
Craige McWhirter committed
444
        )
Craige McWhirter's avatar
Craige McWhirter committed
445 446 447
    MC.setBlock(
        POS.x + HOUSE_X[-1] + 1, upper_level_y + 2, POS.z + HOUSE_Z[-1] + 1,
        ROOF_CORNERS
Craige McWhirter's avatar
Craige McWhirter committed
448 449
        )
    # Build the upper panels
Craige McWhirter's avatar
Craige McWhirter committed
450 451 452 453
    MC.setBlocks(
        POS.x + HOUSE_X[2], upper_level_y + 1, POS.z + HOUSE_Z[4],
        POS.x + HOUSE_X[-3], upper_level_y + 5, POS.z + HOUSE_Z[5],
        PANELS
Craige McWhirter's avatar
Craige McWhirter committed
454
        )
Craige McWhirter's avatar
Craige McWhirter committed
455 456 457 458
    MC.setBlocks(
        POS.x + HOUSE_X[2], upper_level_y + 1, POS.z + HOUSE_Z[-6],
        POS.x + HOUSE_X[-3], upper_level_y + 5, POS.z + HOUSE_Z[-5],
        PANELS
Craige McWhirter's avatar
Craige McWhirter committed
459 460
        )
    # Build the upper posts
Craige McWhirter's avatar
Craige McWhirter committed
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484
    MC.setBlocks(
        POS.x + HOUSE_X[2], upper_level_y + 1, POS.z + HOUSE_Z[2],
        POS.x + HOUSE_X[-3], upper_level_y + 2, POS.z + HOUSE_Z[2],
        POLES
        )
    MC.setBlocks(
        POS.x + HOUSE_X[2], upper_level_y + 1, POS.z + HOUSE_Z[3],
        POS.x + HOUSE_X[-3], upper_level_y + 3, POS.z + HOUSE_Z[3],
        POLES
        )
    MC.setBlocks(
        POS.x + HOUSE_X[2], upper_level_y + 1, POS.z + HOUSE_Z[6],
        POS.x + HOUSE_X[-3], upper_level_y + 6, POS.z + HOUSE_Z[6],
        POLES
        )
    MC.setBlocks(
        POS.x + HOUSE_X[2], upper_level_y + 1, POS.z + HOUSE_Z[-4],
        POS.x + HOUSE_X[-3], upper_level_y + 3, POS.z + HOUSE_Z[-4],
        POLES
        )
    MC.setBlocks(
        POS.x + HOUSE_X[2], upper_level_y + 1, POS.z + HOUSE_Z[-3],
        POS.x + HOUSE_X[-3], upper_level_y + 2, POS.z + HOUSE_Z[-3],
        POLES
Craige McWhirter's avatar
Craige McWhirter committed
485 486
        )
    # Clear the upper floor
Craige McWhirter's avatar
Craige McWhirter committed
487 488 489
    MC.setBlocks(
        POS.x + HOUSE_X[3], upper_level_y + 1, POS.z + HOUSE_Z[2],
        POS.x + HOUSE_X[-4], upper_level_y + 6, POS.z + HOUSE_Z[-3],
Craige McWhirter's avatar
Craige McWhirter committed
490 491 492
        block.AIR.id
        )
    # Put the north roof on
Craige McWhirter's avatar
Craige McWhirter committed
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511
    MC.setBlocks(
        POS.x + HOUSE_X[1], upper_level_y + 3, POS.z + HOUSE_Z[2],
        POS.x + HOUSE_X[-2], upper_level_y + 3, POS.z + HOUSE_Z[2],
        ROOF_STAIRS_NORTH
        )
    MC.setBlocks(
        POS.x + HOUSE_X[1], upper_level_y + 4, POS.z + HOUSE_Z[3],
        POS.x + HOUSE_X[-2], upper_level_y + 4, POS.z + HOUSE_Z[3],
        ROOF_STAIRS_NORTH
        )
    MC.setBlocks(
        POS.x + HOUSE_X[1], upper_level_y + 5, POS.z + HOUSE_Z[4],
        POS.x + HOUSE_X[-2], upper_level_y + 5, POS.z + HOUSE_Z[4],
        ROOF_STAIRS_NORTH
        )
    MC.setBlocks(
        POS.x + HOUSE_X[1], upper_level_y + 6, POS.z + HOUSE_Z[5],
        POS.x + HOUSE_X[-2], upper_level_y + 6, POS.z + HOUSE_Z[5],
        ROOF_STAIRS_NORTH
Craige McWhirter's avatar
Craige McWhirter committed
512 513
        )
    # Put the South roof on
Craige McWhirter's avatar
Craige McWhirter committed
514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538
    MC.setBlocks(
        POS.x + HOUSE_X[1], upper_level_y + 3, POS.z + HOUSE_Z[-3],
        POS.x + HOUSE_X[-2], upper_level_y + 3, POS.z + HOUSE_Z[-3],
        ROOF_STAIRS_SOUTH
        )
    MC.setBlocks(
        POS.x + HOUSE_X[1], upper_level_y + 4, POS.z + HOUSE_Z[-4],
        POS.x + HOUSE_X[-2], upper_level_y + 4, POS.z + HOUSE_Z[-4],
        ROOF_STAIRS_SOUTH
        )
    MC.setBlocks(
        POS.x + HOUSE_X[1], upper_level_y + 5, POS.z + HOUSE_Z[-5],
        POS.x + HOUSE_X[-2], upper_level_y + 5, POS.z + HOUSE_Z[-5],
        ROOF_STAIRS_SOUTH
        )
    MC.setBlocks(
        POS.x + HOUSE_X[1], upper_level_y + 6, POS.z + HOUSE_Z[-6],
        POS.x + HOUSE_X[-2], upper_level_y + 6, POS.z + HOUSE_Z[-6],
        ROOF_STAIRS_SOUTH
        )
    # Set the CAPSTONE
    MC.setBlocks(
        POS.x + HOUSE_X[0], upper_level_y + 7, POS.z + HOUSE_Z[6],
        POS.x + HOUSE_X[-1], upper_level_y + 7, POS.z + HOUSE_Z[6],
        CAPSTONE
Craige McWhirter's avatar
Craige McWhirter committed
539 540 541
        )


Craige McWhirter's avatar
Craige McWhirter committed
542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589
def exterior_lights():
    ''' Build and place the exterior lights '''
    # North West corner
    # Set the light post
    MC.setBlock(
        POS.x + HOUSE_X[0] - 2, LOWER_ROOF_Y - 1, POS.z + HOUSE_Z[0] - 2,
        LIGHT_POST
        )
    # Set the light
    MC.setBlock(
        POS.x + HOUSE_X[0] - 2, LOWER_ROOF_Y - 2, POS.z + HOUSE_Z[0] - 2,
        EXTERIOR_LIGHT
        )
    # South West corner
    # Set the light post
    MC.setBlock(
        POS.x + HOUSE_X[0] - 2, LOWER_ROOF_Y - 1, POS.z + HOUSE_Z[-1] + 2,
        LIGHT_POST
        )
    # Set the light
    MC.setBlock(
        POS.x + HOUSE_X[0] - 2, LOWER_ROOF_Y - 2, POS.z + HOUSE_Z[-1] + 2,
        EXTERIOR_LIGHT
        )
    # North East corner
    # Set the light post
    MC.setBlock(
        POS.x + HOUSE_X[-1] + 2, LOWER_ROOF_Y - 1, POS.z + HOUSE_Z[0] - 2,
        LIGHT_POST
        )
    # Set the light
    MC.setBlock(
        POS.x + HOUSE_X[-1] + 2, LOWER_ROOF_Y - 2, POS.z + HOUSE_Z[0] - 2,
        EXTERIOR_LIGHT
        )
    # South East corner
    # Set the light post
    MC.setBlock(
        POS.x + HOUSE_X[-1] + 2, LOWER_ROOF_Y - 1, POS.z + HOUSE_Z[-1] + 2,
        LIGHT_POST
        )
    # Set the light
    MC.setBlock(
        POS.x + HOUSE_X[-1] + 2, LOWER_ROOF_Y - 2, POS.z + HOUSE_Z[-1] + 2,
        EXTERIOR_LIGHT
        )


Craige McWhirter's avatar
Craige McWhirter committed
590
def interior_torches():
Craige McWhirter's avatar
Craige McWhirter committed
591 592 593 594 595 596
    ''' Set the interior torches '''
    torch_y = FLOOR_Y + 3
    wall_torch_n = block.TORCH.id, 1
    MC.setBlock(
        POS.x + HOUSE_X[4] - 5, torch_y, POS.z, wall_torch_n
        )
Craige McWhirter's avatar
Craige McWhirter committed
597 598 599 600 601 602 603 604 605 606


clear_space()
build_grounds()
verandah_stairs()
build_floor()
house_posts()
wall_panels()
lower_roof()
upper_level()
Craige McWhirter's avatar
Craige McWhirter committed
607
exterior_lights()
Craige McWhirter's avatar
Craige McWhirter committed
608 609
interior_torches()
door()