Skip to content

Commit 371da30

Browse files
Fix: don't include null sprites in stitched textures map
1 parent fba4aa3 commit 371da30

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

rainbow/src/main/java/org/geysermc/rainbow/mapping/texture/StitchedTextures.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ public static StitchedTextures stitchModelTextures(TextureSlots textures, PackCo
3737

3838
Map<String, TextureAtlasSprite> sprites = new HashMap<>();
3939
for (Map.Entry<String, Material> material : materials.entrySet()) {
40-
sprites.put(material.getKey(), preparations.getSprite(material.getValue().texture()));
40+
TextureAtlasSprite sprite = preparations.getSprite(material.getValue().texture());
41+
// Sprite could be null when this material wasn't stitched, which happens when the texture simply doesn't exist within the loaded resourcepacks
42+
if (sprite != null) {
43+
sprites.put(material.getKey(), sprite);
44+
}
4145
}
4246
return new StitchedTextures(Map.copyOf(sprites), () -> stitchTextureAtlas(preparations), preparations.width(), preparations.height());
4347
}

0 commit comments

Comments
 (0)