33import me .cortex .voxy .client .core .IVoxyRenderSystemHolder ;
44import me .cortex .voxy .commonImpl .VoxyCommon ;
55import net .caffeinemc .mods .sodium .client .render .SodiumWorldRenderer ;
6+ import net .caffeinemc .mods .sodium .client .render .chunk .LocalSectionIndex ;
7+ import net .caffeinemc .mods .sodium .client .render .chunk .RenderSectionFlags ;
68import net .caffeinemc .mods .sodium .client .render .chunk .lists .VisibleChunkCollector ;
79import net .caffeinemc .mods .sodium .client .render .chunk .region .RenderRegion ;
810import net .caffeinemc .mods .sodium .client .render .chunk .region .RenderRegionManager ;
911import net .minecraft .core .SectionPos ;
1012import org .spongepowered .asm .mixin .Mixin ;
13+ import org .spongepowered .asm .mixin .Unique ;
1114import org .spongepowered .asm .mixin .injection .At ;
1215import org .spongepowered .asm .mixin .injection .Inject ;
1316import org .spongepowered .asm .mixin .injection .Redirect ;
@@ -28,9 +31,15 @@ public class MixinVisibleChunkCollector {
2831 private RenderRegion voxy$injectVisibleSectionGather (RenderRegionManager instance , int x , int y , int z ) {
2932 var region = instance .getForChunk (x ,y ,z );
3033 var vrs = IVoxyRenderSystemHolder .getNullable ();
31- if (vrs != null && region != null ) {
34+ if (vrs != null && voxy$shouldUseForChunkBound ( region , LocalSectionIndex . pack ( x , y , z )) ) {
3235 vrs .visbleSectionStream .put (SectionPos .asLong (x ,y ,z ));
3336 }
3437 return region ;
3538 }
39+
40+ @ Unique
41+ private static boolean voxy$shouldUseForChunkBound (RenderRegion region , int localIndex ) {
42+ if (region == null ) return false ;
43+ return (region .getSectionFlags (localIndex )&RenderSectionFlags .MASK_IS_BUILT )!=0 ;
44+ }
3645}
0 commit comments