Improve notes on getting the stored section range/refactor method name

This commit is contained in:
dordsor21
2021-09-11 12:40:39 +01:00
parent 37998ec598
commit 6cbd9631a0
13 changed files with 57 additions and 53 deletions

View File

@ -744,7 +744,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
if (bx >= minX && tx <= maxX && bz >= minZ && tz <= maxZ) {
// contains all X/Z
if (minY <= set.getMinSectionIndex() << 4 && maxY >= (set.getMaxSectionIndex() << 4) + 15) {
if (minY <= set.getMinSectionPosition() << 4 && maxY >= (set.getMaxSectionPosition() << 4) + 15) {
return set;
}
trimY(set, minY, maxY);
@ -752,7 +752,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
return set;
}
if (tx >= minX && bx <= maxX && tz >= minZ && bz <= maxZ) {
if (minY > set.getMinSectionIndex() << 4 || maxY < (set.getMaxSectionIndex() << 4) + 15) {
if (minY > set.getMinSectionPosition() << 4 || maxY < (set.getMaxSectionPosition() << 4) + 15) {
trimY(set, minY, maxY);
}
final int lowerX = Math.max(0, minX - bx);
@ -767,7 +767,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
boolean trimX = lowerX != 0 || upperX != 15;
boolean trimZ = lowerZ != 0 || upperZ != 15;
for (int layer = get.getMinSectionIndex(); layer < get.getMaxSectionIndex(); layer++) {
for (int layer = get.getMinSectionPosition(); layer < get.getMaxSectionPosition(); layer++) {
if (set.hasSection(layer)) {
char[] arr = set.load(layer);
if (trimX || trimZ) {

View File

@ -244,8 +244,8 @@ public interface Region extends Iterable<BlockVector3>, Cloneable, IBatchProcess
final IChunkSet set,
boolean full
) {
int minSection = Math.max(get.getMinSectionIndex(), getMinimumY() >> 4);
int maxSection = Math.min(get.getMaxSectionIndex(), getMaximumY() >> 4);
int minSection = Math.max(get.getMinSectionPosition(), getMinimumY() >> 4);
int maxSection = Math.min(get.getMaxSectionPosition(), getMaximumY() >> 4);
block = block.initChunk(chunk.getX(), chunk.getZ());
for (int layer = minSection; layer <= maxSection; layer++) {
if ((!full && !set.hasSection(layer)) || !filter.appliesLayer(chunk, layer)) {