1
0
mirror of https://github.com/GeyserMC/Rainbow.git synced 2025-12-19 14:59:16 +00:00

Fix: don't include null sprites in stitched textures map

This commit is contained in:
Eclipse
2025-10-23 11:05:27 +00:00
parent fba4aa31ab
commit 371da30f10

View File

@@ -37,7 +37,11 @@ public record StitchedTextures(Map<String, TextureAtlasSprite> sprites, Supplier
Map<String, TextureAtlasSprite> sprites = new HashMap<>(); Map<String, TextureAtlasSprite> sprites = new HashMap<>();
for (Map.Entry<String, Material> material : materials.entrySet()) { for (Map.Entry<String, Material> material : materials.entrySet()) {
sprites.put(material.getKey(), preparations.getSprite(material.getValue().texture())); TextureAtlasSprite sprite = preparations.getSprite(material.getValue().texture());
// Sprite could be null when this material wasn't stitched, which happens when the texture simply doesn't exist within the loaded resourcepacks
if (sprite != null) {
sprites.put(material.getKey(), sprite);
}
} }
return new StitchedTextures(Map.copyOf(sprites), () -> stitchTextureAtlas(preparations), preparations.width(), preparations.height()); return new StitchedTextures(Map.copyOf(sprites), () -> stitchTextureAtlas(preparations), preparations.width(), preparations.height());
} }