mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
cache min/max for cuboid region
This commit is contained in:
parent
b224457464
commit
6142f30715
@ -51,6 +51,8 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
|||||||
|
|
||||||
private boolean useOldIterator;
|
private boolean useOldIterator;
|
||||||
private int minX, minY, minZ, maxX, maxY, maxZ;
|
private int minX, minY, minZ, maxX, maxY, maxZ;
|
||||||
|
private BlockVector3 min;
|
||||||
|
private BlockVector3 max;
|
||||||
private BlockVector3 pos1;
|
private BlockVector3 pos1;
|
||||||
private BlockVector3 pos2;
|
private BlockVector3 pos2;
|
||||||
|
|
||||||
@ -139,6 +141,8 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
|||||||
maxX = max.getBlockX();
|
maxX = max.getBlockX();
|
||||||
maxY = max.getBlockY();
|
maxY = max.getBlockY();
|
||||||
maxZ = max.getBlockZ();
|
maxZ = max.getBlockZ();
|
||||||
|
min = BlockVector3.at(minX, minY, minZ);
|
||||||
|
max = BlockVector3.at(maxX, maxY, maxZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -186,22 +190,22 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockVector3 getMinimumPoint() {
|
public BlockVector3 getMinimumPoint() {
|
||||||
return pos1.getMinimum(pos2);
|
return min;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockVector3 getMaximumPoint() {
|
public BlockVector3 getMaximumPoint() {
|
||||||
return pos1.getMaximum(pos2);
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMinimumY() {
|
public int getMinimumY() {
|
||||||
return Math.min(pos1.getBlockY(), pos2.getBlockY());
|
return minY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaximumY() {
|
public int getMaximumY() {
|
||||||
return Math.max(pos1.getBlockY(), pos2.getBlockY());
|
return maxY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user