LambDynamicLights

LambDynamicLights

19M Downloads

Sometimes sharp difference in light level between chunk boundaries

seeruk opened this issue ยท 13 comments

commented

Hey there - fantastic plugin, couldn't live without this functionality!

The issue is pretty much just the title. It's best explained with a screenshot. This happens above ground and in caves. I am using this with Sodium as you can probably see from the screenshot. But I have also tried it with only this mod and Fabric API and the result is the same. It seems fairly easy to reproduce for me right now.

I've noticed this occur in a more subtle way in other situations too, where when you enter a new chunk the light level changes suddenly, only quite slightly. I think it's probably the same issue, just to a lesser extent.

commented

https://cdn.discordapp.com/attachments/461578336875970588/736265370528120913/unknown.png found an extreme example
http://prntscr.com/tnzzz3
it seems to happen on all right (left) chunk borders when facing north (south) and when you stand/walk on the last block of the chunk

commented

Thanks for the report!

So I figured out why, it's because of the MathHelper#fastFloor precision not being accurate enough when being in the chunk east edge in negative X-coordinates.
Now I use a much more precise value which fixes the issue :)
But something is bothering me, I can't reproduce the issue with another axis in the negative Z-coordinates.

commented

While trying to reproduce this I was face north, and was on the east edge of the chunk.
I only could reproduce it when the chunks was in a negative-X coordinate, not when in a positive-X coordinate.

commented

Here's when I'm in a negative X-coordinates, facing north (or south) on the east chunk border.
image
And now when I'm in positive X-coordinates, facing north (or south) on the east chunk border.
image
The issue doesn't happen in positive X-coordinates.

I just guess that MathHelper#fastFloor doesn't like a lot negative coordinates.

commented

http://prntscr.com/tobzi2 found extra stuff :o
http://prntscr.com/toc04c feels like only negative coords are affected
-X is east
-Z is south
-XZ is south+east+SE

commented

Oh so it also happens in that axis, thanks for checking!

The fix I applied in dev environment already works on that other axis ;)

Will be fixed in next release ^^

commented

So now that I fixed it in dev for entities, I checked for block entities, like a chest for test purposes, and it's even more cursed...
in the corner of a chunk everything is fine, but in the east chunk border it causes some weird issues
image

commented

it will probably fixed along the way: https://gyazo.com/bd5c463618ee23460f8cd2a556c55732
upon stepping on the last block facing S/E/SE (depending on the coords) of a chunk the light stops moving until you enter the next chunk

the reverse also applies; moving N/W/NW (depending on which negative coord) the light lags behind 1 block when entering a new chunk

i have the feeling the mod only tracks light in a 15x15 area of a chunk instead 16x16

commented

I can confirm that this is also fixed with the same changes.

I still have to figure out how the hell I can calculate correctly which chunks to update for Block Entities and this issue will be entirely resolved :)

commented

Successfully fixed the Block Entities issues as well in dev environment!

commented

Fixed in LambDynamicLights 1.3.0!