Light update glitch after replacing water with lava
chorvus opened this issue ยท 11 comments
I'm trying to make a lava ocean overworld replacing water with lava but this happens very often, it destroyes the aesthetic I want to achieve.
Is this something BT can work around?
This bug exists in Vanilla "Customized" worlds with lava oceans on.
So it's not BT related, but since it already overrides parts of worldgen it would be nice to have the ability to recalculate light levels right after generation with a script command (per biome or in all biomes).
I've reproduced the problem and attempted a fix that resulted in really weird behavior... Chunks out on the periphery appear to generate with this weird lighting, but it slowly fades the more time you spend near it? No clue, but I'll keep trying.
Hm that's weird...
I don't know if it's relevant but I had a desync issue with Dynamic Lights and this glitch, I could make the dark spots go away flying over with a torch (it emits light around the player) but it wouldn't persist after a world restart. It means that light desync can happen, but I do not know any details... so watch out for it.
Can I have a fork with your testing code to play around?
Play around with the newest build and try out that command. Let me know how it goes.
The command can be used like any other command
biomes.relight()
I tested the build and I observed that if you stand inside a "glitched" chunk and reload the world, it recalculates lighting as it's supposed to, but if you fly around to load new ones they will not get fixed. I'm gonna look more into this behavior and see why this happens.
I also want ask why did you hook it on 'onChunkLoad'? It seems like it runs very late, and you also have to work around the nature of the event to make sure it doesn't get fired multiple times per chunk. Isn't right after the chunk generation a better place to hook? (I'm still learning about world gen, excuse my ignorance)
What I want to try is to cache the topmost lava sources of lava lakes (while they're being generated) to target them exclusively for relighting. That will help a lot with performance and it will probably help with debugging too.
(edit: words)
I hooked onChunkLoad because it is the earliest hook I could find after generation is complete. If you know of a better hook please let me know.
I got it to work by looking up lava lake surface blocks manually and updating them before calling resetRelightChecks()
. Hooking on PopulateChunkEvent.Post
events works wonders and only on world generation.
Do you think I should make a separate mod for it and drop the whole feature from BT, since it's scope is very specific (vanilla lava oceans)?
You should probably make a separate mod for that. While I can sort out justify putting it in BT, it is a vanilla "feature" so should have a small mod that can fix it.