Apply lighting workaround to 1.16.5+
This commit is contained in:
parent
7307e3d734
commit
61a71f8a0b
7 changed files with 24 additions and 155 deletions
|
|
@ -50,31 +50,13 @@ public class FabricMapChunkCache extends GenericMapChunkCache {
|
|||
ThreadedAnvilChunkStorage acl = cps.threadedAnvilChunkStorage;
|
||||
|
||||
ChunkPos coord = new ChunkPos(x, z);
|
||||
CompoundTag rslt = acl.getNbt(coord);
|
||||
if (!isLitChunk(rslt)) {
|
||||
rslt = null;
|
||||
}
|
||||
return rslt;
|
||||
return acl.getNbt(coord);
|
||||
} catch (Exception exc) {
|
||||
Log.severe(String.format("Error reading chunk: %s,%d,%d", dw.getName(), x, z), exc);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isLitChunk(CompoundTag nbt) {
|
||||
if ((nbt != null) && nbt.contains("Level")) {
|
||||
nbt = nbt.getCompound("Level");
|
||||
}
|
||||
if (nbt != null) {
|
||||
String stat = nbt.getString("Status");
|
||||
ChunkStatus cs = ChunkStatus.byId(stat);
|
||||
if ((stat != null) && cs.isAtLeast(ChunkStatus.LIGHT)) { // ChunkStatus.LIGHT
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Load generic chunk from existing and already loaded chunk
|
||||
protected GenericChunk getLoadedChunk(DynmapChunk chunk) {
|
||||
GenericChunk gc = null;
|
||||
|
|
@ -86,7 +68,7 @@ public class FabricMapChunkCache extends GenericMapChunkCache {
|
|||
// TODO: find out why this is happening and why it only seems to happen since 1.16.2
|
||||
Log.severe("ChunkSerializer.serialize threw a NullPointerException", e);
|
||||
}
|
||||
if (isLitChunk(nbt)) {
|
||||
if (nbt != null) {
|
||||
gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
|
||||
}
|
||||
}
|
||||
|
|
@ -98,7 +80,7 @@ public class FabricMapChunkCache extends GenericMapChunkCache {
|
|||
GenericChunk gc = null;
|
||||
CompoundTag nbt = readChunk(chunk.x, chunk.z);
|
||||
// If read was good
|
||||
if (isLitChunk(nbt)) {
|
||||
if (nbt != null) {
|
||||
gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
|
||||
}
|
||||
return gc;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue