SteamWar/BauSystem2.0
Archiviert
12
0

Update Laufbau
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2022-02-05 21:05:04 +01:00
Ursprung 38ff383023
Commit 99d007aef5
4 geänderte Dateien mit 33 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -241,7 +241,7 @@ public class BlockBoundingBox {
addPixel(endRodNorthSouth, 6, 6, 0, 4, 4, 16);
Directional endRodEastWest = (Directional) Material.END_ROD.createBlockData();
endRodNorthSouth.setFacing(BlockFace.EAST);
endRodEastWest.setFacing(BlockFace.EAST);
addPixel(endRodEastWest, 0, 6, 6, 16, 4, 4);
Waterlogged conduit = (Waterlogged) Material.CONDUIT.createBlockData();

Datei anzeigen

@ -28,6 +28,10 @@ import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
public class Laufbau {
private World world;
@ -44,6 +48,8 @@ public class Laufbau {
private CreatingInnerBlocksState creatingInnerBlocksState = null;
private CreatingOuterBlocksState creatingOuterBlocksState = null;
private List<BlockBoundingBox> elements = new ArrayList<>(BlockBoundingBox.elements);
@Getter
private EditSession editSession;
@ -57,6 +63,23 @@ public class Laufbau {
filteringTracesState = new FilteringTracesState(world, this::inRegion);
editSession = WorldEditUtils.getEditSession(world);
if (preferingBlastResistance) {
elements.sort(Comparator.comparing(blockBoundingBox -> {
double element = 1;
if (blockBoundingBox.cuboid.getDx() != 0) {
element *= blockBoundingBox.cuboid.getDx();
}
if (blockBoundingBox.cuboid.getDy() != 0) {
element *= blockBoundingBox.cuboid.getDy();
}
if (blockBoundingBox.cuboid.getDz() != 0) {
element *= blockBoundingBox.cuboid.getDz();
}
element *= blockBoundingBox.blockData.getMaterial().getBlastResistance();
return -element;
}));
}
}
private LaufbauState getActive() {
@ -90,7 +113,7 @@ public class Laufbau {
return;
}
if (shrinkingOuterPointsState != null) {
creatingInnerBlocksState = new CreatingInnerBlocksState(splittingPointsState.getInnerPoints(), world, processingTracesState.getCuboidList(), splittingPointsState.getIntersectedCuboid(), editSession, preferingBlastResistance);
creatingInnerBlocksState = new CreatingInnerBlocksState(splittingPointsState.getInnerPoints(), world, processingTracesState.getCuboidList(), splittingPointsState.getIntersectedCuboid(), editSession, elements, preferingBlastResistance);
return;
}
if (splittingPointsState != null) {

Datei anzeigen

@ -31,9 +31,7 @@ import org.bukkit.World;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
public class CreatingInnerBlocksState implements LaufbauState {
@ -44,14 +42,16 @@ public class CreatingInnerBlocksState implements LaufbauState {
private List<Cuboid> cuboidList;
private Map<Point, List<Cuboid>> intersectedCuboid;
private EditSession editSession;
private List<BlockBoundingBox> elements;
private boolean preferingBlastResistance;
public CreatingInnerBlocksState(List<Point> innerBlocks, World world, List<Cuboid> cuboidList, Map<Point, List<Cuboid>> intersectedCuboid, EditSession editSession, boolean preferingBlastResistance) {
public CreatingInnerBlocksState(List<Point> innerBlocks, World world, List<Cuboid> cuboidList, Map<Point, List<Cuboid>> intersectedCuboid, EditSession editSession, List<BlockBoundingBox> elements, boolean preferingBlastResistance) {
this.innerBlocks = innerBlocks;
this.world = world;
this.cuboidList = cuboidList;
this.intersectedCuboid = intersectedCuboid;
this.editSession = editSession;
this.elements = elements;
this.preferingBlastResistance = preferingBlastResistance;
}
@ -72,7 +72,7 @@ public class CreatingInnerBlocksState implements LaufbauState {
List<Cuboid> neededCuboids = intersectedCuboid.get(point);
List<BlockBoundingBox> blockDataWithBoundingBoxList = new ArrayList<>();
for (BlockBoundingBox blockDataWithBoundingBox : BlockBoundingBox.elements) {
for (BlockBoundingBox blockDataWithBoundingBox : elements) {
Cuboid tempCuboid = blockDataWithBoundingBox.cuboid.add(point);
List<Cuboid> extendedCuboids = null;

Datei anzeigen

@ -28,10 +28,7 @@ import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.function.BiPredicate;
public class ExpandingTracesState implements LaufbauState {
@ -70,7 +67,8 @@ public class ExpandingTracesState implements LaufbauState {
for (double z = cuboid.getZ() - 2; z < cuboid.getZ() + cuboid.getDz() + 2; z++) {
Location location = new Location(world, x, y, z);
if (inRegionCheck.test(new Vector(location.getBlockX(), location.getBlockY(), location.getBlockZ()), 0)) {
blocks.add(new Point(location.getBlockX(), location.getBlockY(), location.getBlockZ()));
Point point = new Point(location.getBlockX(), location.getBlockY(), location.getBlockZ());
blocks.add(point);
}
}
}