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 d9ba482f..471d58d4 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 @@ -76,6 +76,14 @@ public class Laufbau { } return -Double.compare(o1.volume(), o2.volume()); }); + } else { + elements.sort((o1, o2) -> { + int compared = Double.compare(o1.volume(), o2.volume()); + if (compared != 0) { + return -compared; + } + return -Double.compare(o1.blockData.getMaterial().getBlastResistance(), o2.blockData.getMaterial().getBlastResistance()); + }); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingInnerBlocksState.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingInnerBlocksState.java index f5c1251f..0dd34d87 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingInnerBlocksState.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/states/CreatingInnerBlocksState.java @@ -76,16 +76,8 @@ public class CreatingInnerBlocksState implements LaufbauState { for (BlockBoundingBox blockDataWithBoundingBox : elements) { List cuboids = blockDataWithBoundingBox.getCuboidList().stream().map(c -> c.add(point)).collect(Collectors.toList()); - /* - List extendedCuboids = null; - if (cuboids.stream().anyMatch(cuboid -> cuboid.getDy() > 1)) { - extendedCuboids = cuboidList; - } - - */ - boolean isInCuboid = false; - for (Cuboid cuboid : /*extendedCuboids == null ? neededCuboids : extendedCuboids*/ neededCuboids) { + for (Cuboid cuboid : neededCuboids) { if (cuboids.stream().anyMatch(cuboid::intersects)) { isInCuboid = true; break; @@ -93,9 +85,7 @@ public class CreatingInnerBlocksState implements LaufbauState { } if (!isInCuboid) { blockDataWithBoundingBoxList.add(blockDataWithBoundingBox); - if (preferingBlastResistance) { - break; - } + break; } } if (blockDataWithBoundingBoxList.isEmpty()) { @@ -103,21 +93,6 @@ public class CreatingInnerBlocksState implements LaufbauState { } BlockBoundingBox highest = blockDataWithBoundingBoxList.get(0); - - if (!preferingBlastResistance) { - for (BlockBoundingBox blockDataWithBoundingBox : blockDataWithBoundingBoxList) { - if (highest.volume() < blockDataWithBoundingBox.volume()) { - highest = blockDataWithBoundingBox; - } - if (preferingBlastResistance) { - if (highest.blockData.getMaterial().getBlastResistance() < blockDataWithBoundingBox.blockData.getMaterial().getBlastResistance()) { - if (highest.volume() > blockDataWithBoundingBox.volume()) { - highest = blockDataWithBoundingBox; - } - } - } - } - } Location location = new Location(world, point.getX(), point.getY(), point.getZ()); if (!location.getBlock().getType().isAir()) { return;