Fabric API

Fabric API

106M Downloads

Magma block emmisivity

kvverti opened this issue ยท 4 comments

commented

Magma blocks' faces are not emissive when adjacent to a solid block.

Fabric API: 0.3.0+build.200 fat jar

Screenshot:
2019-07-30_19 09 00

commented

To add to this:

Vanilla MC 1.14.4 or MC/Fabric without Fabric API:

2019-07-30_20 34 01

MC/Fabric with fabric-api-0.3.0+build.207 (Indigo renderer)

2019-07-30_20 35 46

Video showing some block interactions:

https://www.youtube.com/watch?v=5NC7LeRhFqY

commented

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.

commented

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

commented

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:

image