- Added comments to help explain some of the logic of the Region/CuboidRegion filtering
This commit is contained in:
IronApollo 2020-03-28 20:49:55 -04:00
parent 8ffdd8a9e9
commit 8c7d4c0cc5
2 changed files with 7 additions and 3 deletions

View File

@ -653,7 +653,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
int chunkZ = chunk.getZ();
block = block.initChunk(chunkX, chunkZ);
//Chunk entry is an "interior chunk" in regards to the entire region, so filter the chunk whole instead of partially
if ((minX + 15) >> 4 <= chunkX && (maxX - 15) >> 4 >= chunkX && (minZ + 15) >> 4 <= chunkZ && (maxZ - 15) >> 4 >= chunkZ) {
filter(chunk, filter, block, get, set, minY, maxY, full);
return;
@ -672,12 +672,14 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
filter(chunk, filter, block, get, set, minSection, localMinX, yStart, localMinZ, localMaxX, yEnd, localMaxZ, full);
return;
}
//If the yStart is not 0, the edit is smaller than the height of a ChunkSection, so filter individually and remove section as the minSection layer entry
if (yStart != 0) {
filter(chunk, filter, block, get, set, minSection, localMinX, yStart, localMinZ, localMaxX, 15, localMaxZ, full);
minSection++;
}
//If the yEnd is not 15, the edit is smaller than the height of a ChunkSection, so filter individually and remove section as the maxSection layer entry
if (yEnd != 15) {
filter(chunk, filter, block, get, set, minSection, localMinX, 0, localMinZ, localMaxX, yEnd, localMaxZ, full);
filter(chunk, filter, block, get, set, maxSection, localMinX, 0, localMinZ, localMaxX, yEnd, localMaxZ, full);
maxSection--;
}
for (int layer = minSection; layer <= maxSection; layer++) {

View File

@ -219,12 +219,14 @@ public interface Region extends Iterable<BlockVector3>, Cloneable, IBatchProcess
filter(chunk, filter, block, get, set, minSection, yStart, yEnd, full);
return;
}
//If the yStart is not 0, the edit is smaller than the height of a ChunkSection, so filter individually and remove section as the minSection layer entry
if (yStart != 0) {
filter(chunk, filter, block, get, set, minSection, yStart, 15, full);
minSection++;
}
//If the yEnd is not 15, the edit is smaller than the height of a ChunkSection, so filter individually and remove section as the maxSection layer entry
if (yEnd != 15) {
filter(chunk, filter, block, get, set, minSection, 0, yEnd, full);
filter(chunk, filter, block, get, set, maxSection, 0, yEnd, full);
maxSection--;
}
for (int layer = minSection; layer <= maxSection; layer++) {