Check before casting.

Fixes https://github.com/GTNewHorizons/Angelica/issues/388
This commit is contained in:
Jason Mitchell authored and Jason Mitchell committed 2024-03-16 11:24:38 -07:00
1 parent 464af945b2
commit 852bcbb38b
2 files changed
+5 -5

No files matched your search

@@ -21,10 +21,10 @@ public class AnimationsRenderUtils {
if (textureAtlasSprite != null && textureAtlasSprite.hasAnimationMetadata()) {
// null if called by anything but chunk render cache update (for example to get blocks rendered as items in
// inventory)
if (blockAccess instanceof ITexturesCache) {
((ITexturesCache) blockAccess).getRenderedTextures().add(textureAtlasSprite);
} else {
((IPatchedTextureAtlasSprite) textureAtlasSprite).markNeedsAnimationUpdate();
if (blockAccess instanceof ITexturesCache texturesCache) {
texturesCache.getRenderedTextures().add(textureAtlasSprite);
} else if(textureAtlasSprite instanceof IPatchedTextureAtlasSprite patchedSprite){
patchedSprite.markNeedsAnimationUpdate();
}
}
}