SteamWar/BauSystem2.0
Archiviert
12
0

add generatePrototypeData

Dieser Commit ist enthalten in:
Zeanon 2021-04-18 18:20:27 +02:00
Ursprung e0bbc812c1
Commit b399ec3a3d
2 geänderte Dateien mit 30 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -32,4 +32,12 @@ public class Point {
private final int x;
private final int y;
private final int z;
public Point add(int x, int y, int z) {
return new Point(this.x + x, this.y + y, this.z + z);
}
public Point substract(int x, int y, int z) {
return new Point(this.x - x, this.y - y, this.z - z);
}
}

Datei anzeigen

@ -82,16 +82,33 @@ public class Region {
});
}
this.flagStorage = flagStorage;
generatePrototypeData(prototype);
generatePrototypeData(prototype, regionConfig.getPlainValue("minPoint"));
}
private void generatePrototypeData(Prototype prototype) {
if (prototype != null && !prototypes.contains(prototype)) {
private void generatePrototypeData(Prototype prototype, Point point) {
if (prototype == null) {
return;
}
if (!prototypes.contains(prototype)) {
return;
}
this.prototype = prototype;
// TODO: implement generation
this.minPoint = point;
this.maxPoint = point.add(prototype.getSizeX(), prototype.getSizeY(), prototype.getSizeZ());
this.minPointTestblock = point.add(prototype.getTestblock().getOffsetX(), prototype.getTestblock().getOffsetY(), prototype.getTestblock().getOffsetZ());
this.maxPointTestblock = this.minPointTestblock.add(prototype.getTestblock().getSizeX(), prototype.getTestblock().getSizeY(), prototype.getTestblock().getSizeZ());
this.minPointTestblockExtension = this.minPointTestblock.substract(prototype.getTestblock().getExtensionNegativeX(), prototype.getTestblock().getExtensionNegativeY(), prototype.getTestblock().getExtensionNegativeZ());
this.maxPointTestblockExtension = this.maxPointTestblock.add(prototype.getTestblock().getExtensionPositiveX(), prototype.getTestblock().getExtensionPositiveY(), prototype.getTestblock().getExtensionPositiveZ());
this.minPointBuild = point.add(prototype.getBuild().getOffsetX(), prototype.getBuild().getOffsetY(), prototype.getBuild().getOffsetZ());
this.maxPointBuild = this.minPointBuild.add(prototype.getBuild().getSizeX(), prototype.getBuild().getSizeY(), prototype.getBuild().getSizeZ());
this.minPointBuildExtension = this.minPointBuild.substract(prototype.getBuild().getExtensionNegativeX(), prototype.getBuild().getExtensionNegativeY(), prototype.getBuild().getExtensionNegativeZ());
this.maxPointBuildExtension = this.maxPointBuild.add(prototype.getBuild().getExtensionPositiveX(), prototype.getBuild().getExtensionPositiveY(), prototype.getBuild().getExtensionPositiveZ());
}
public boolean inRegion(Location location, RegionType regionType, RegionExtensionType regionExtensionType) {
@ -134,5 +151,4 @@ public class Region {
public String getDisplayName() {
return prototype != null ? prototype.getDisplayName() : "";
}
}
}