mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-18 10:32:30 +00:00
Save structure center Y level
This commit is contained in:
parent
3d428c32d4
commit
28ebd9c31d
@ -2,6 +2,7 @@ package com.dfsek.terra.structure;
|
||||
|
||||
import com.dfsek.terra.Debug;
|
||||
import org.bukkit.block.data.MultipleFacing;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.polydev.gaea.math.Range;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
@ -51,7 +52,7 @@ public class GaeaStructure implements Serializable {
|
||||
}
|
||||
|
||||
public GaeaStructure(@NotNull Location l1, @NotNull Location l2, @NotNull String id) throws InitializationException {
|
||||
int centerX = -1, centerZ = -1;
|
||||
int centerX = -1, centerY = -1, centerZ = -1;
|
||||
this.id = id;
|
||||
this.uuid = UUID.randomUUID();
|
||||
if(l1.getX() > l2.getX() || l1.getY() > l2.getY() || l1.getZ() > l2.getZ()) throw new IllegalArgumentException("Invalid locations provided!");
|
||||
@ -71,6 +72,7 @@ public class GaeaStructure implements Serializable {
|
||||
useState = false;
|
||||
if(s.getLine(1).equals("[CENTER]")) {
|
||||
centerX = x;
|
||||
centerY = y;
|
||||
centerZ = z;
|
||||
} else if(s.getLine(1).startsWith("[SPAWN=") && s.getLine(1).endsWith("]")) {
|
||||
String og = s.getLine(1);
|
||||
@ -97,8 +99,8 @@ public class GaeaStructure implements Serializable {
|
||||
}
|
||||
}
|
||||
}
|
||||
if(centerX < 0 || centerZ < 0) throw new InitializationException("No structure center specified.");
|
||||
structureInfo = new GaeaStructureInfo(l2.getBlockX()-l1.getBlockX()+1, l2.getBlockY()-l1.getBlockY()+1, l2.getBlockZ()-l1.getBlockZ()+1, centerX, centerZ);
|
||||
if(centerX < 0 || centerY < 0 || centerZ < 0) throw new InitializationException("No structure center specified.");
|
||||
structureInfo = new GaeaStructureInfo(l2.getBlockX()-l1.getBlockX()+1, l2.getBlockY()-l1.getBlockY()+1, l2.getBlockZ()-l1.getBlockZ()+1, new Vector(centerX, centerY, centerZ));
|
||||
}
|
||||
|
||||
public ArrayList<StructureSpawnRequirement> getSpawns() {
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.dfsek.terra.structure;
|
||||
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class GaeaStructureInfo implements Serializable {
|
||||
@ -9,12 +11,14 @@ public class GaeaStructureInfo implements Serializable {
|
||||
private final int sizeZ;
|
||||
private final int centerX;
|
||||
private final int centerZ;
|
||||
public GaeaStructureInfo(int sizeX, int sizeY, int sizeZ, int centerX, int centerZ) {
|
||||
private final int centerY;
|
||||
public GaeaStructureInfo(int sizeX, int sizeY, int sizeZ, Vector center) {
|
||||
this.sizeX = sizeX;
|
||||
this.sizeY = sizeY;
|
||||
this.sizeZ = sizeZ;
|
||||
this.centerX = centerX;
|
||||
this.centerZ = centerZ;
|
||||
this.centerX = center.getBlockX();
|
||||
this.centerZ = center.getBlockZ();
|
||||
this.centerY = center.getBlockY();
|
||||
}
|
||||
|
||||
public int getSizeX() {
|
||||
@ -33,6 +37,10 @@ public class GaeaStructureInfo implements Serializable {
|
||||
return centerX;
|
||||
}
|
||||
|
||||
public int getCenterY() {
|
||||
return centerY;
|
||||
}
|
||||
|
||||
public int getCenterZ() {
|
||||
return centerZ;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user