mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
Added support for non-128 worldheights
This commit is contained in:
@ -27,6 +27,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.BlockVector2D;
|
||||
import com.sk89q.worldedit.LocalWorld;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.data.ChunkStore;
|
||||
@ -43,30 +44,43 @@ public class Polygonal2DRegion implements Region {
|
||||
protected int minY;
|
||||
protected int maxY;
|
||||
protected boolean hasY = false;
|
||||
protected LocalWorld world;
|
||||
|
||||
/**
|
||||
* Construct the region.
|
||||
* Construct the region
|
||||
*/
|
||||
public Polygonal2DRegion() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct the region.
|
||||
*
|
||||
* @param world
|
||||
*/
|
||||
public Polygonal2DRegion(LocalWorld world) {
|
||||
points = new ArrayList<BlockVector2D>();
|
||||
minY = 0;
|
||||
maxY = 0;
|
||||
hasY = false;
|
||||
this.world = world;
|
||||
recalculate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct the region.
|
||||
*
|
||||
* @param world
|
||||
* @param points
|
||||
* @param minY
|
||||
* @param maxY
|
||||
*/
|
||||
public Polygonal2DRegion(List<BlockVector2D> points, int minY, int maxY) {
|
||||
public Polygonal2DRegion(LocalWorld world, List<BlockVector2D> points, int minY, int maxY) {
|
||||
this.points = points;
|
||||
this.minY = minY;
|
||||
this.maxY = maxY;
|
||||
hasY = true;
|
||||
this.world = world;
|
||||
recalculate();
|
||||
}
|
||||
|
||||
@ -109,6 +123,9 @@ public class Polygonal2DRegion implements Region {
|
||||
minY = Math.min(oldMinY, oldMaxY);
|
||||
maxY = Math.max(oldMinY, oldMaxY);
|
||||
|
||||
minY = Math.min(Math.max(0, minY), world == null ? 127 : world.getMaxY());
|
||||
maxY = Math.min(Math.max(0, maxY), world == null ? 127 : world.getMaxY());
|
||||
|
||||
min = new BlockVector(minX, minY, minZ);
|
||||
max = new BlockVector(maxX, maxY, maxZ);
|
||||
}
|
||||
@ -567,4 +584,12 @@ public class Polygonal2DRegion implements Region {
|
||||
throw new UnsupportedOperationException("Not supported");
|
||||
}
|
||||
}
|
||||
|
||||
public LocalWorld getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
public void setWorld(LocalWorld world) {
|
||||
this.world = world;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user