Repository navigation
Conversation
LightingEngine.spreadLightFromCursor pushes a value of (source light - opacity)
to each neighbour that is brighter than it currently is. It never compares
that value with the neighbour's own emission. A neighbour that emits light
but is not itself scheduled for an update, such as lava at level 15, can
therefore receive a propagated value lower than its emission and keep it.
Observed on a client connected to a remote server, in a fresh Nether lava
lake: the lighting engine wrote lava blocks with values from 1 to 14, never
15, 2311 times in 25 seconds. The air directly above the lava stayed dark,
which appeared as dark patches on the lava surface. The patches did not
clear with F3+A, which rebuilds render sections but does not change stored
light, so the stored values themselves were wrong.
The same scenario in singleplayer did not show the problem. The cause of
this difference has not been identified; the fix does not depend on it.
The fix takes the maximum of the propagated value and the neighbour's own
block light, computed with the same LightUtil helper the initial calculation
already uses:
newLight = max(propagatedLight, ownLight)
ownLight is only used for block light. Sky light has no per-block emission
in this calculation, so its value is unchanged.
Behaviour after the fix:
- The diagnostic log no longer reports any lava block below 15 on the client.
- The dark patches are gone in game, on the remote server.
- A residual case remains: air directly above lava can settle at 13 instead of
14 when it is reached first from a lateral neighbour. It is one light level
and was not visible in game. Correcting it would need propagation to pull
from every neighbour, not only the one pushing, which is a larger change and
is not part of this commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Full disclosure : The fix was generated using automated tooling, but was manually reviewed and tested.
📝 Description
LightingEngine.spreadLightFromCursor pushes a value of (source light - opacity) to each neighbour that is brighter than it currently is. It never compares that value with the neighbour's own emission. A neighbour that emits light but is not itself scheduled for an update, such as lava at level 15, can therefore receive a propagated value lower than its emission and keep it.
Observed on a client connected to a remote server, in a fresh Nether lava lake: the lighting engine wrote lava blocks with values from 1 to 14, never 15, 2311 times in 25 seconds. The air directly above the lava stayed dark, which appeared as dark patches on the lava surface. The patches did not clear with F3+A, which rebuilds render sections but does not change stored light, so the stored values themselves were wrong.
The same scenario in singleplayer did not show the problem. The cause of this difference has not been identified; the fix does not depend on it.
The fix takes the maximum of the propagated value and the neighbour's own block light, computed with the same LightUtil helper the initial calculation already uses:
ownLight is only used for block light. Sky light has no per-block emission in this calculation, so its value is unchanged.
Behaviour after the fix:
🎯 Goals
❌ Non Goals
🚦 Testing
Tested in the same conditions as original diagnosis : nothing changes in singleplayer, while multiplayer is fixed.
⏮️ Backwards Compatibility
N/A
📚 Related Issues & Documents
N.A
🖼️ Screenshots/Recordings
This is how a freshly generated Nether looks like in multiplayer :
After the fix, it looks just like Vanilla.
📖 Added to documentation?
😄 [optional] What gif best describes this PR or how it makes you feel?