Add simple lighting generation for migrated chunks with missing light

This commit is contained in:
Mike Primm 2021-12-15 23:34:53 -06:00
parent 12c1a76394
commit 7307e3d734
6 changed files with 67 additions and 59 deletions

View file

@ -50,20 +50,6 @@ public class MapChunkCache118 extends GenericMapChunkCache {
init();
}
private boolean isLitChunk(NBTTagCompound nbt) {
if ((nbt != null) && nbt.e("Level")) {
nbt = nbt.p("Level");
}
if (nbt != null) {
String stat = nbt.l("Status");
ChunkStatus cs = ChunkStatus.a(stat);
if ((stat != null) && (cs.b(ChunkStatus.l) || (cs == ChunkStatus.c))) { // ChunkStatus.LIGHT OR ChunkStatus.EMPTY (migrated use this for some reason)
return true;
}
}
return false;
}
// Load generic chunk from existing and already loaded chunk
protected GenericChunk getLoadedChunk(DynmapChunk chunk) {
CraftWorld cw = (CraftWorld) w;
@ -74,9 +60,6 @@ public class MapChunkCache118 extends GenericMapChunkCache {
if ((c != null) && c.o) { // c.loaded
nbt = ChunkRegionLoader.a(cw.getHandle(), c);
}
if (!isLitChunk(nbt)) {
nbt = null;
}
if (nbt != null) {
gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
}
@ -93,9 +76,6 @@ public class MapChunkCache118 extends GenericMapChunkCache {
nbt = cw.getHandle().k().a.f(cc); // playerChunkMap
} catch (IOException iox) {
}
if (!isLitChunk(nbt)) {
nbt = null;
}
if (nbt != null) {
gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
}