Switch to assuming sky light data for states below 'light' are crap...

This commit is contained in:
Mike Primm 2021-12-24 09:22:32 -06:00
parent bd4a34e2ae
commit 67ab35658c

View File

@ -944,13 +944,6 @@ public abstract class GenericMapChunkCache extends MapChunkCache {
GenericChunkSection.Builder sbld = new GenericChunkSection.Builder(); GenericChunkSection.Builder sbld = new GenericChunkSection.Builder();
/* Get sections */ /* Get sections */
GenericNBTList sect = nbt.contains("sections") ? nbt.getList("sections", 10) : nbt.getList("Sections", 10); GenericNBTList sect = nbt.contains("sections") ? nbt.getList("sections", 10) : nbt.getList("Sections", 10);
// Prescan sections to see if lit
for (int i = 0; i < sect.size(); i++) {
GenericNBTCompound sec = sect.getCompound(i);
if (sec.contains("SkyLight")) { // Only consider skylight for now, since that is what we generate if needed
hasLight = true;
}
}
// And process sections // And process sections
for (int i = 0; i < sect.size(); i++) { for (int i = 0; i < sect.size(); i++) {
GenericNBTCompound sec = sect.getCompound(i); GenericNBTCompound sec = sect.getCompound(i);
@ -1063,6 +1056,7 @@ public abstract class GenericMapChunkCache extends MapChunkCache {
} }
if (sec.contains("SkyLight")) { if (sec.contains("SkyLight")) {
sbld.skyLight(sec.getByteArray("SkyLight")); sbld.skyLight(sec.getByteArray("SkyLight"));
hasLight = true;
} }
// If section biome palette // If section biome palette
if (sec.contains("biomes")) { if (sec.contains("biomes")) {
@ -1096,8 +1090,8 @@ public abstract class GenericMapChunkCache extends MapChunkCache {
bld.addSection(secnum, sbld.build()); bld.addSection(secnum, sbld.build());
sbld.reset(); sbld.reset();
} }
// If pre 1.17, assume unlit state means bad light // Assume skylight is only trustworthy in a lit state
if ((version < 2724) && (!hasLitState)) { if (!hasLitState) {
hasLight = false; hasLight = false;
} }
// If no light, do simple generate // If no light, do simple generate