mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
Added getChunkCubes() to Region to get 16^3 chunks a region overlaps with
This commit is contained in:
@ -269,7 +269,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion {
|
||||
/**
|
||||
* Expand the region.
|
||||
*
|
||||
* @param change
|
||||
* @param changes
|
||||
*/
|
||||
public void expand(Vector... changes) throws RegionOperationException {
|
||||
for (Vector change : changes) {
|
||||
@ -292,7 +292,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion {
|
||||
/**
|
||||
* Contract the region.
|
||||
*
|
||||
* @param change
|
||||
* @param changes
|
||||
*/
|
||||
public void contract(Vector... changes) throws RegionOperationException {
|
||||
for (Vector change : changes) {
|
||||
@ -415,12 +415,31 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion {
|
||||
Vector min = getMinimumPoint();
|
||||
Vector max = getMaximumPoint();
|
||||
|
||||
for (int x = min.getBlockX(); x <= max.getBlockX(); ++x) {
|
||||
for (int z = min.getBlockZ(); z <= max.getBlockZ(); ++z) {
|
||||
if (contains(new BlockVector(x, minY, z))) { // Not the best
|
||||
chunks.add(new BlockVector2D(x >> ChunkStore.CHUNK_SHIFTS,
|
||||
z >> ChunkStore.CHUNK_SHIFTS));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return chunks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Vector> getChunkCubes() {
|
||||
Set<Vector> chunks = new HashSet<Vector>();
|
||||
|
||||
Vector min = getMinimumPoint();
|
||||
Vector max = getMaximumPoint();
|
||||
|
||||
for (int x = min.getBlockX(); x <= max.getBlockX(); ++x) {
|
||||
for (int y = min.getBlockY(); y <= max.getBlockY(); ++y) {
|
||||
for (int z = min.getBlockZ(); z <= max.getBlockZ(); ++z) {
|
||||
Vector pt = new Vector(x, y, z);
|
||||
if (contains(pt)) { // Not the best
|
||||
chunks.add(ChunkStore.toChunk(pt));
|
||||
if (contains(new BlockVector(x, y, z))) { // Not the best
|
||||
chunks.add(new BlockVector(x >> ChunkStore.CHUNK_SHIFTS,
|
||||
y >> ChunkStore.CHUNK_SHIFTS, z >> ChunkStore.CHUNK_SHIFTS));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user