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

@ -71,7 +71,7 @@ public abstract class ChunkFilterBlock extends AbstractExtentFilterBlock {
*/
public final IChunkSet filter(IChunk chunk, IChunkGet get, IChunkSet set, Filter filter) {
initChunk(chunk.getX(), chunk.getZ());
for (int layer = get.getMinSectionIndex(); layer <= get.getMaxSectionIndex(); layer++) {
for (int layer = get.getMinSectionPosition(); layer <= get.getMaxSectionPosition(); layer++) {
if (set.hasSection(layer)) {
initLayer(get, set, layer);
filter(filter);
@ -87,7 +87,7 @@ public abstract class ChunkFilterBlock extends AbstractExtentFilterBlock {
if (region != null) {
region.filter(chunk, filter, this, get, set, full);
} else {
for (int layer = get.getMinSectionIndex(); layer <= get.getMaxSectionIndex(); layer++) {
for (int layer = get.getMinSectionPosition(); layer <= get.getMaxSectionPosition(); layer++) {
if ((!full && !get.hasSection(layer)) || !filter.appliesLayer(chunk, layer)) {
continue;
}

View File

@ -37,7 +37,7 @@ public class HeightmapProcessor implements IBatchProcessor {
int skip = 0;
int allSkipped = (1 << TYPES.length) - 1; // lowest types.length bits are set
layer:
for (int layer = set.getMaxSectionIndex(); layer >= set.getMinSectionIndex(); layer--) {
for (int layer = set.getMaxSectionPosition(); layer >= set.getMinSectionPosition() >> 4; layer--) {
boolean hasSectionSet = set.hasSection(layer);
boolean hasSectionGet = get.hasSection(layer);
if (!(hasSectionSet || hasSectionGet)) {
@ -94,7 +94,7 @@ public class HeightmapProcessor implements IBatchProcessor {
// ignore if that position was already set
if (!updated[i][j] && type.includes(block)) {
// mc requires + 1, heightmaps are normalized internally
heightmaps[i][j] = ((layer - set.getMinSectionIndex()) << 4) + y + 1;
heightmaps[i][j] = ((layer - get.getMinSectionPosition()) << 4) + y + 1;
updated[i][j] = true; // mark as updated
}
}

View File

@ -30,10 +30,10 @@ public class RelightProcessor implements IBatchProcessor {
} else if (Settings.IMP.LIGHTING.MODE == 1) {
byte[] fix = new byte[get.getSectionCount()];
boolean relight = false;
for (int i = get.getMaxSectionIndex(); i >= get.getMinSectionIndex(); i--) {
for (int i = get.getMaxSectionPosition(); i >= get.getMinSectionPosition(); i--) {
if (!set.hasSection(i)) {
// Array index cannot be < 0 so "add" the min
fix[i - get.getMinSectionIndex()] = Relighter.SkipReason.AIR;
fix[i - get.getMinSectionPosition()] = Relighter.SkipReason.AIR;
continue;
}
relight = true;