From 59339a46db885345a4db2e6a2c73c51f2d0bb0fe Mon Sep 17 00:00:00 2001 From: Eclairsombre Date: Sat, 15 Jun 2024 14:31:48 +0200 Subject: [PATCH] Entrance --- House.py | 481 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 318 insertions(+), 163 deletions(-) diff --git a/House.py b/House.py index a04c995..6e4e969 100644 --- a/House.py +++ b/House.py @@ -8,7 +8,7 @@ import math import matplotlib.pyplot as plt class House: - def __init__(self, editor, coordinates_min, coordinates_max, direction): + def __init__(self, editor, coordinates_min, coordinates_max, direction, list_block): self.editor = editor self.coordinates_min = coordinates_min self.coordinates_max = coordinates_max @@ -25,20 +25,31 @@ class House: self.entranceWall = None + self.blocks = list_block + + self.entranceCo = None + + + self.wall = Block(list_block["wall"]) + self.roof = Block(list_block["roof"]) + self.roof_slab = Block(list_block["roof_slab"]) + self.door = Block(list_block["door"]) + self.window = Block(list_block["window"]) + self.entrance = Block(list_block["entrance"]) + self.stairs = Block(list_block["stairs"]) + self.celling = Block(list_block["celling"]) + self.floor = Block(list_block["floor"]) + self.celling_slab = Block(list_block["celling_slab"]) + self.gardenOutline = Block(list_block["garden_outline"]) + self.garden_floor = Block(list_block["garden_floor"]) + + def createHouseSkeleton(self): self.delete() x_min, y_min, z_min = self.coordinates_min x_max, y_max, z_max = self.coordinates_max - - for i in range (x_min, x_max): - for y in range(z_min, z_max): - if i == x_min or i == x_max - 1 or y == z_min or y == z_max - 1: - self.editor.placeBlock((i, y_min, y), Block("oak_planks")) - - - - + perimeter_width = x_max - x_min perimeter_depth = z_max - z_min @@ -63,13 +74,12 @@ class House: for i in range(0, width-1): for j in range(0, depth-1): - self.editor.placeBlock((x + i, y_min, z + j), Block("stone")) + self.editor.placeBlock((x + i, y_min, z + j), self.floor) self.grid[x+i,z+j] = True,1 self.grid3d[x_plan3d+i,0,z_plan3d+j] = True,1 self.skeleton.append((x, z, width-1, depth-1, height)) print("Coordinates of the corners: ", (x, z), (x, z+depth-1), (x+width-1, z), (x+width-1, z+depth-1)) - block = ["redstone_block", "gold_block", "diamond_block"] x_min -= 1 x_max -= 1 @@ -109,7 +119,7 @@ class House: if i == 0 or i == new_width-1 or j == 0 or j == new_depth-1: continue else: - self.editor.placeBlock((new_x + i, y_min, new_z + j), Block(block[_])) + self.editor.placeBlock((new_x + i, y_min, new_z + j), self.floor) self.skeleton.append((new_x, new_z, new_width, new_depth, height)) break @@ -140,7 +150,7 @@ class House: for y in range(0, height): if i == -1 or i == width or j == -1 or j == depth: if not (self.grid[x + i, z + j]['bool']) and not (self.grid[x + i, z + j]['int'] == 1) or (self.grid[x + i, z + j]['bool'] and self.grid[x + i, z + j]['int'] == 2): - self.editor.placeBlock((x + i, self.coordinates_min[1] + y, z + j), Block("stone")) + self.editor.placeBlock((x + i, self.coordinates_min[1] + y, z + j), self.wall) self.grid3d[ x_plan3d+i, y, z_plan3d+j] = True #print( i, y, j, self.grid[x + i, z + j]['bool'],self.grid[x + i, z + j]['int']) @@ -250,26 +260,26 @@ class House: for k in range(n-1): for i in range(-1, depth+1): for y in range(-1, width//2+1): - self.editor.placeBlock((x + i, self.coordinates_max[1]+k, z+y+k+3), Block("blackstone")) - self.editor.placeBlock((x + i, self.coordinates_max[1]+k, z+depth-y-4-k), Block("blackstone")) + self.editor.placeBlock((x + i, self.coordinates_max[1]+k, z+y+k+3), self.roof) + self.editor.placeBlock((x + i, self.coordinates_max[1]+k, z+depth-y-4-k), self.roof) if width%2 == 0: for i in range(-1, depth+1): - self.editor.placeBlock((x+width//2+1, self.coordinates_max[1]+n-1, z+i), Block("blackstone")) + self.editor.placeBlock((x+width//2+1, self.coordinates_max[1]+n-1, z+i), self.roof) for i in range(-1,depth+1): - self.editor.placeBlock((x+width//2, self.coordinates_max[1]+n-1, z+i), Block("blackstone")) + self.editor.placeBlock((x+width//2, self.coordinates_max[1]+n-1, z+i), self.roof) else: if n>1: for k in range(n-1): for i in range(-1, width+1): for y in range(-1, depth//2+1): - self.editor.placeBlock((x + i, self.coordinates_max[1]+k, z+y+k+2), Block("blackstone")) - self.editor.placeBlock((x + i, self.coordinates_max[1]+k, z+depth-y-3-k), Block("blackstone")) + self.editor.placeBlock((x + i, self.coordinates_max[1]+k, z+y+k+2), self.roof) + self.editor.placeBlock((x + i, self.coordinates_max[1]+k, z+depth-y-3-k), self.roof) if depth%2 == 0: for i in range(-1, width+1): - self.editor.placeBlock((x+i, self.coordinates_max[1]+n-1, z+depth//2+1), Block("blackstone")) + self.editor.placeBlock((x+i, self.coordinates_max[1]+n-1, z+depth//2+1), self.roof) for i in range(-1,width+1): - self.editor.placeBlock((x+i, self.coordinates_max[1]+n-1, z+depth//2), Block("blackstone")) + self.editor.placeBlock((x+i, self.coordinates_max[1]+n-1, z+depth//2), self.roof) print('-----------------------------------') @@ -278,43 +288,43 @@ class House: if width