From 852bcbb38bb8bc78d6cc825023e249d5709d4b02 Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Sat, 16 Mar 2024 11:23:59 -0700 Subject: [PATCH] Check before casting. Fixes https://github.com/GTNewHorizons/Angelica/issues/388 --- settings.gradle | 2 +- .../angelica/utils/AnimationsRenderUtils.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/settings.gradle b/settings.gradle index e6d3c1f95..4d3528c2f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -16,5 +16,5 @@ pluginManagement { } plugins { - id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.14' + id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.18' } diff --git a/src/main/java/com/gtnewhorizons/angelica/utils/AnimationsRenderUtils.java b/src/main/java/com/gtnewhorizons/angelica/utils/AnimationsRenderUtils.java index 38ed419a7..cb446f19a 100644 --- a/src/main/java/com/gtnewhorizons/angelica/utils/AnimationsRenderUtils.java +++ b/src/main/java/com/gtnewhorizons/angelica/utils/AnimationsRenderUtils.java @@ -21,10 +21,10 @@ public static void markBlockTextureForUpdate(IIcon icon, IBlockAccess blockAcces 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(); } } }