From 7cb5e9ef04da044adaed4834397c574fb31c1300 Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Mon, 24 Oct 2022 20:32:08 +0200 Subject: build house accurately --- BerryClient/addons/blockworld.py | 2 +- BerryClient/models/House.py | 2 +- BerryClient/models/Wall.py | 19 +++++++++---------- BerryClient/models/WallWithDoor.py | 18 +++++++++--------- BerryClient/models/WallWithWindow.py | 6 ++++-- 5 files changed, 24 insertions(+), 23 deletions(-) diff --git a/BerryClient/addons/blockworld.py b/BerryClient/addons/blockworld.py index 0de9f2c..2de6fd5 100644 --- a/BerryClient/addons/blockworld.py +++ b/BerryClient/addons/blockworld.py @@ -5,7 +5,7 @@ from BerryClient.models.House import House MATERIAL_MAPPING = { "air": mcpi.block.AIR, - "stone": mcpi.block.STONE, + "stone": mcpi.block.STONE_SLAB_DOUBLE, "brick": mcpi.block.BRICK_BLOCK, } diff --git a/BerryClient/models/House.py b/BerryClient/models/House.py index 72ae549..ce4d2e8 100644 --- a/BerryClient/models/House.py +++ b/BerryClient/models/House.py @@ -35,7 +35,7 @@ class House: self.wallBack = Wall(corner_top_left, bw) - roof_corner = (x, y + Wall.height, z) + roof_corner = (x, y + Wall.height-1, z) self.roof = Roof(roof_corner, bw) def build(self): diff --git a/BerryClient/models/Wall.py b/BerryClient/models/Wall.py index cbd761a..9904ebb 100644 --- a/BerryClient/models/Wall.py +++ b/BerryClient/models/Wall.py @@ -12,17 +12,16 @@ class Wall: self._bw = bw def build(self): - for h in range(self.height): - x, y, z = self.pos - y += h + x, y, z = self.pos - from_pos = (x,y,z) + from_pos = (x,y,z) - if self.rotated: - z += self.width - 1 - else: - x += self.width - 1 + if self.rotated: + z += self.width - 1 + else: + x += self.width - 1 + y += self.height-1 - to_pos = (x,y,z) + to_pos = (x,y,z) - self._bw.set_blocks(*from_pos, *to_pos, self.material_id) + self._bw.set_blocks(*from_pos, *to_pos, self.material_id) diff --git a/BerryClient/models/WallWithDoor.py b/BerryClient/models/WallWithDoor.py index 3205ca8..7eb8ead 100644 --- a/BerryClient/models/WallWithDoor.py +++ b/BerryClient/models/WallWithDoor.py @@ -13,14 +13,14 @@ class WallWithDoor(Wall): else: x += (self.width / 2)-1 - for i in range(2): - if i: - if self.rotated: - z += 1 - else: - x += 1 + from_pos = (x, y, z) - from_pos = (x, y, z) - to_pos = (x, y+1, z) + if self.rotated: + z += 1 + else: + x += 1 + y += 2 + + to_pos = (x, y, z) - self._bw.set_blocks(*from_pos, *to_pos, self.door_material_id) + self._bw.set_blocks(*from_pos, *to_pos, self.door_material_id) diff --git a/BerryClient/models/WallWithWindow.py b/BerryClient/models/WallWithWindow.py index bde405b..38f2f1f 100644 --- a/BerryClient/models/WallWithWindow.py +++ b/BerryClient/models/WallWithWindow.py @@ -11,14 +11,16 @@ class WallWithWindow(Wall): z += (self.width / 2) else: x += (self.width / 2) + y += 1 - from_pos = (x, y+1, z) + from_pos = (x, y, z) if self.rotated: z -= 1 else: x -= 1 + y += 1 - to_pos = (x, y+1, z) + to_pos = (x, y, z) self._bw.set_blocks(*from_pos, *to_pos, self.window_material_id) \ No newline at end of file -- cgit v1.2.3