Mojira Archive
MC-911

Sunlight in big caves and under overhangs

In bigger caves and under overhangs you get sunlight as if there were no ceiling - mobs start bruning and the floor gets lit up.

This bug is 100% reproducable and not even hard to fix once you understand it:

Chunks get split in 16x16x16 Sections.
If a Section is empty it gets deleted from the save to make the world smaller (as in how much space it takes on the Harddrive). Sections in the same chunk assume that they must be exposed to sunlight if there is an empty (and thus deleted) section above it and act as if they were, creating ugly patches of light in big caves. This bug is almost exclusive to custom maps, since the terrain generation almost never produces caves that are big enough, but it is a gamebreaker in maps (makes them too easy and look ugly).

To fix this bug you don't have to rewrite the whole lighting system - simply let the sections check the whole chunk when calculating sunlight.

To recreate the bug, make an empty chunk (create a superflat world to speed this up) and put a ceiling at least 16 blocks above the ground, big enough to block all sunlight. Then restart the game. Now there should be sunlight (if it doesn't happen, raise the ceiling a bit, maybe it's still in the same esection) [NOTE: if it doesn't happen, try going away far enough to unload the chunk, wait a few seconds and then go back to it]