From 8adaca2108e7eaae7434d9b8d1c63ca5975aab23 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 4 Feb 2022 23:57:51 +0100 Subject: [PATCH] Update Laufbau Signed-off-by: yoyosource --- .../features/slaves/laufbau/Laufbau.java | 36 ++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/Laufbau.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/Laufbau.java index 84ad3ea3..51d66fd5 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/Laufbau.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/Laufbau.java @@ -31,6 +31,7 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; +import org.bukkit.block.BlockFace; import org.bukkit.block.data.Bisected; import org.bukkit.block.data.BlockData; import org.bukkit.block.data.type.Campfire; @@ -90,11 +91,31 @@ public class Laufbau { Fence endStoneBrickWall = (Fence) Material.END_STONE_BRICK_WALL.createBlockData(); elements.add(new BlockDataWithBoundingBox(endStoneBrickWall, new Cuboid(0.25, 0, 0.25, 0.5, 1.5, 0.5))); - Fence fence = (Fence) Material.OAK_FENCE.createBlockData(); + Fence fence = (Fence) Material.NETHER_BRICK_FENCE.createBlockData(); elements.add(new BlockDataWithBoundingBox(fence, new Cuboid(0.375, 0, 0.375, 0.25, 1.5, 0.25))); - Fence ironBar = (Fence) Material.IRON_BARS.createBlockData(); - elements.add(new BlockDataWithBoundingBox(ironBar, new Cuboid(0.4375, 0, 0.4375, 0.125, 1, 0.125))); + Fence ironBars = (Fence) Material.IRON_BARS.createBlockData(); + elements.add(new BlockDataWithBoundingBox(ironBars, new Cuboid(0.4375, 0, 0.4375, 0.125, 1, 0.125))); + + TrapDoor northTrapDoor = (TrapDoor) Material.IRON_TRAPDOOR.createBlockData(); + northTrapDoor.setFacing(BlockFace.NORTH); + northTrapDoor.setOpen(true); + elements.add(new BlockDataWithBoundingBox(northTrapDoor, new Cuboid(0, 0, 0.8125, 1, 1, 0.1875))); + + TrapDoor southTrapDoor = (TrapDoor) Material.IRON_TRAPDOOR.createBlockData(); + southTrapDoor.setFacing(BlockFace.SOUTH); + southTrapDoor.setOpen(true); + elements.add(new BlockDataWithBoundingBox(southTrapDoor, new Cuboid(0, 0, 0, 1, 1, 0.1875))); + + TrapDoor westTrapDoor = (TrapDoor) Material.IRON_TRAPDOOR.createBlockData(); + westTrapDoor.setFacing(BlockFace.WEST); + westTrapDoor.setOpen(true); + elements.add(new BlockDataWithBoundingBox(westTrapDoor, new Cuboid(0.8125, 0, 0, 0.1875, 1, 1))); + + TrapDoor eastTrapDoor = (TrapDoor) Material.IRON_TRAPDOOR.createBlockData(); + eastTrapDoor.setFacing(BlockFace.EAST); + eastTrapDoor.setOpen(true); + elements.add(new BlockDataWithBoundingBox(eastTrapDoor, new Cuboid(0, 0, 0, 0.1875, 1, 1))); } private Set tntPositions = new HashSet<>(); @@ -133,7 +154,7 @@ public class Laufbau { cuboidList.add(new Cuboid(location.getX() - 0.49, location.getY(), location.getZ() - 0.49, 0.98, 0.98, 0.98)); } else { Vector movement = location.clone().subtract(previousLocation); - cuboidList.add(new Cuboid(previousLocation.getX() - 0.49, Math.min(previousLocation.getY(), location.getY()), previousLocation.getZ() - 0.49, 0.98, movement.getY() + 0.98, 0.98)); + cuboidList.add(new Cuboid(previousLocation.getX() - 0.49, Math.min(previousLocation.getY(), location.getY()), previousLocation.getZ() - 0.49, 0.98, Math.abs(movement.getY()) + 0.98, 0.98)); if (Math.abs(movement.getX()) > Math.abs(movement.getZ())) { cuboidList.add(new Cuboid(Math.min(previousLocation.getX(), location.getX()) - 0.49, location.getY(), previousLocation.getZ() - 0.49, Math.abs(movement.getX()) + 0.98, 0.98, 0.98)); cuboidList.add(new Cuboid(location.getX() - 0.49, location.getY(), Math.min(previousLocation.getZ(), location.getZ()) - 0.49, 0.98, 0.98, Math.abs(movement.getZ()) + 0.98)); @@ -218,6 +239,13 @@ public class Laufbau { currentHighest = blockDataWithBoundingBox.cuboid; highestBlockData = blockDataWithBoundingBox.blockData; } + if (highestBlockData.getMaterial().getBlastResistance() < blockDataWithBoundingBox.blockData.getMaterial().getBlastResistance() && + (currentHighest.getDx() < blockDataWithBoundingBox.cuboid.getDx() || + currentHighest.getDy() < blockDataWithBoundingBox.cuboid.getDy() || + currentHighest.getDz() < blockDataWithBoundingBox.cuboid.getDz())) { + currentHighest = blockDataWithBoundingBox.cuboid; + highestBlockData = blockDataWithBoundingBox.blockData; + } } // blockDataMap.put(point, new BlockDataWithBoundingBox(highestBlockData, currentHighest)); Location location = new Location(world, point.getX(), point.getY(), point.getZ());