Magma block emmisivity
kvverti opened this issue ยท 4 comments
To add to this:
Vanilla MC 1.14.4 or MC/Fabric without Fabric API:
MC/Fabric with fabric-api-0.3.0+build.207 (Indigo renderer)
Video showing some block interactions:
I'm having no luck reproducing this. Could you please post your indigo-renderer.properties file and also log file?
Never mind - has to be dark. The problem is limited to block light. Very strange.
Well, I found the cause, and it hurts me deeply.
Magma block is the only block in all of Minecraft that overrides Block.getBlockBrightness() such that the result depends on the block state instead of just the position.
Every other single block simply relies on world lighting state for this value, which depends only on the position.
The fix is simple enough: clear the brightness cache whenever the block changes. Obviously that has a negative consequence for performance, but I see no way around it.
Vanilla employs the same fix, though it wasn't obvious there was a specific reason vs just lack of performance consideration. It a large price to pay for a single block, but nothing stops modded blocks from having the same behavior.
Edit: see next post
After more investigation, it is both not as bad and worse than I thought.
Brightness lookup only depends on the block being lit for flat lighting. Magma blocks use flat lighting, and they substitute their own brightness for all neighbor brightness lookups. This can't be cached effectively across multiple blocks because all other blocks simply look up world brightness.
The normal brightness lookup logic does account for block luminance, which is how glowstone reports a non-zero brightness. But magma blocks only have a luminance of 3, and presumably Mojang wanted them to render at full brightness, and so overriding Block.getBlockBrightness() is how they did that. But that would not be sufficient unless flat lighting uses the block state of the block being lit for neighbor blocks.
Ao brightness lookups always use the block state of the block position where brightness is being queried.
So the fix I had before is not complete, because you still see crap like this: