Sodium

Sodium

44M Downloads

Sodium throws when adding a quad with a `null` sprite to a vertex consumer

Technici4n opened this issue ยท 2 comments

commented

The following mixin needs a null check for the sprite: https://github.com/CaffeineMC/sodium-fabric/blob/404712572ac0106c2e8792deb12029fb71c755e3/src/main/java/me/jellysquid/mods/sodium/mixin/features/render/immediate/buffer_builder/intrinsics/BufferBuilderMixin.java#L26.

See the following stack trace from Modern Industrialization:
image

These quads don't have a texture, so passing a null sprite sounds reasonable to me. Sodium should handle that case. I can send a patch.

commented

With Java, any object type can be a null value... it's not like we can really know looking at the decompiled sources whether it was originally annotated to not return null values. And it isn't outrageous that someone might want to use a null value either, even if it's not clear to me how exactly that is supposed to work.

The fix is trivial enough on our side... so let's just fix it.

commented

The sprite and the sprite getter method are not null in vanilla, so mods should try to make sure this is the case with non-vanilla BakedQuads too. The sprite vertex data array still stores UVs, so the quad cannot have no texture. Is it possible to use the missing sprite instead of null?