As requested, this is a copy of this comment on MC-170012, posted as a separate report.
Upon loading from disk, lightmaps are only loaded for chunks that were already lighted and discarded otherwise, although they are always saved to disk.
net.minecraft.world.ChunkSerializer.java
public static ProtoChunk deserialize(...) {
...
boolean bl = compoundTag.getBoolean("isLightOn");
...
if (bl) {
if (compoundTag2.contains("BlockLight", 7)) {
lightingProvider.enqueueSectionData(LightType.BLOCK, ChunkSectionPos.from(pos, k), new ChunkNibbleArray(compoundTag2.getByteArray("BlockLight")), true);
}
if (bl2 && compoundTag2.contains("SkyLight", 7)) {
lightingProvider.enqueueSectionData(LightType.SKY, ChunkSectionPos.from(pos, k), new ChunkNibbleArray(compoundTag2.getByteArray("SkyLight")), true);
}
}
...
}
This basically erases any light propagations to chunks in pre_light
stage when unloading them before the light
stage and hence causes lighting glitches.
The Vanilla code currently uses this mechanism to erase cached data
, which only removes the isLightOn
field but not the lightmaps themselves.
As a concrete example I use the setup of MC-199952, which I suppose to be an instance of this:
Create a new world with seed
1122583309043747515
Set the render distance to 2
/tp -616 77 200
Reload the world
Fly to
-669 80 207
and observe the lighting glitch
Also note that the issue doesn't occur if omitting the reloading step, as expected.
Linked issues
Comments


Can confirm in 1.18 Pre-release 1.

Cannot reproduce in 23w18a
Can confirm in 1.17.1.