fabric-1.17.1: add missing section handling

Fixes missing handling introduced in
57d02007ab.
This commit is contained in:
Kosma Moczek 2022-01-07 00:59:55 +01:00
parent 25950167ec
commit b234153a53

View File

@ -713,18 +713,21 @@ public class DynmapPlugin {
ChunkPos cp = chunk.getPos(); ChunkPos cp = chunk.getPos();
if (fw != null) { if (fw != null) {
if (!checkIfKnownChunk(fw, cp)) { if (!checkIfKnownChunk(fw, cp)) {
int ymax = 0; int ymax = Integer.MIN_VALUE;
int ymin = Integer.MAX_VALUE;
ChunkSection[] sections = chunk.getSectionArray(); ChunkSection[] sections = chunk.getSectionArray();
for (int i = 0; i < sections.length; i++) { for (int i = 0; i < sections.length; i++) {
if ((sections[i] != null) && (!sections[i].isEmpty())) { if ((sections[i] != null) && (!sections[i].isEmpty())) {
ymax = 16 * (i + 1); int sy = sections[i].getYOffset();
if (sy < ymin) ymin = sy;
if ((sy+16) > ymax) ymax = sy + 16;
} }
} }
int x = cp.x << 4; int x = cp.x << 4;
int z = cp.z << 4; int z = cp.z << 4;
// If not empty AND not initial scan // If not empty AND not initial scan
if (ymax > 0) { if (ymax != Integer.MIN_VALUE) {
mapManager.touchVolume(fw.getName(), x, 0, z, x + 15, ymax, z + 16, "chunkgenerate"); mapManager.touchVolume(fw.getName(), x, ymin, z, x + 15, ymax, z + 15, "chunkgenerate");
} }
addKnownChunk(fw, cp); addKnownChunk(fw, cp);
} }