SteamWar/BauSystem2.0
Archiviert
12
0

Update CreatingInnerBlocksState
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2022-02-08 10:41:06 +01:00
Ursprung 7675e464a7
Commit b87f708c28
2 geänderte Dateien mit 10 neuen und 27 gelöschten Zeilen

Datei anzeigen

@ -76,6 +76,14 @@ public class Laufbau {
} }
return -Double.compare(o1.volume(), o2.volume()); 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());
});
} }
} }

Datei anzeigen

@ -76,16 +76,8 @@ public class CreatingInnerBlocksState implements LaufbauState {
for (BlockBoundingBox blockDataWithBoundingBox : elements) { for (BlockBoundingBox blockDataWithBoundingBox : elements) {
List<Cuboid> cuboids = blockDataWithBoundingBox.getCuboidList().stream().map(c -> c.add(point)).collect(Collectors.toList()); List<Cuboid> cuboids = blockDataWithBoundingBox.getCuboidList().stream().map(c -> c.add(point)).collect(Collectors.toList());
/*
List<Cuboid> extendedCuboids = null;
if (cuboids.stream().anyMatch(cuboid -> cuboid.getDy() > 1)) {
extendedCuboids = cuboidList;
}
*/
boolean isInCuboid = false; boolean isInCuboid = false;
for (Cuboid cuboid : /*extendedCuboids == null ? neededCuboids : extendedCuboids*/ neededCuboids) { for (Cuboid cuboid : neededCuboids) {
if (cuboids.stream().anyMatch(cuboid::intersects)) { if (cuboids.stream().anyMatch(cuboid::intersects)) {
isInCuboid = true; isInCuboid = true;
break; break;
@ -93,9 +85,7 @@ public class CreatingInnerBlocksState implements LaufbauState {
} }
if (!isInCuboid) { if (!isInCuboid) {
blockDataWithBoundingBoxList.add(blockDataWithBoundingBox); blockDataWithBoundingBoxList.add(blockDataWithBoundingBox);
if (preferingBlastResistance) { break;
break;
}
} }
} }
if (blockDataWithBoundingBoxList.isEmpty()) { if (blockDataWithBoundingBoxList.isEmpty()) {
@ -103,21 +93,6 @@ public class CreatingInnerBlocksState implements LaufbauState {
} }
BlockBoundingBox highest = blockDataWithBoundingBoxList.get(0); 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()); Location location = new Location(world, point.getX(), point.getY(), point.getZ());
if (!location.getBlock().getType().isAir()) { if (!location.getBlock().getType().isAir()) {
return; return;