chunksfadein
chunksfadein copied to clipboard
Make Sodium DefaultChunkRenderer mixin less fragile
Currently, your mod injects into the Sodium DefaultChunkRenderer
mixin class to run custom fading functionality, and captures necessary information using Mixin's LocalCapture
mechanism. Unfortunately, that is very fragile, because it breaks as soon as a local variable is added anywhere but at the end of the original set of variables. This is exactly what happens with Embeddium 0.3.19+, as I had to add an extra variable to implement a renderer feature needed for translucency sorting.
Fortunately, there is a rather simple solution: the MixinExtras @Local
annotation allows capturing specific variables that are needed, rather than needing to hardcode a list. Using this in combination with capturing variables by name allows the mixin to be refactored so that it will not be affected by any additions/removals of variables that Chunks Fade In doesn't need.
I tested and the new mixin works fine with both Sodium 0.5.1 and Embeddium 0.3.19, even though the latter has an extra variable. Fabric Loom & Loader were bumped to enable using MixinExtras as shipped by Loader without needing to jar-in-jar it within the mod itself.
A similar (or the same) change should be applied for 1.20.2+.