From ead4e1137635dae2fe379e19aeb7b9fc1611bbfb Mon Sep 17 00:00:00 2001 From: BucketBrigade <138534411+CookieBrigade@users.noreply.github.com> Date: Thu, 19 Dec 2024 21:04:24 -0600 Subject: [PATCH] Expose texture updates to API (#805) * Expose texture updates to API * Expose for blocks as well * Fix mistake * Fixed API --- .../angelica/api/TextureServices.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/main/java/com/gtnewhorizons/angelica/api/TextureServices.java diff --git a/src/main/java/com/gtnewhorizons/angelica/api/TextureServices.java b/src/main/java/com/gtnewhorizons/angelica/api/TextureServices.java new file mode 100644 index 000000000..97a35bb7f --- /dev/null +++ b/src/main/java/com/gtnewhorizons/angelica/api/TextureServices.java @@ -0,0 +1,27 @@ +package com.gtnewhorizons.angelica.api; + +import com.gtnewhorizons.angelica.mixins.interfaces.IPatchedTextureAtlasSprite; +import com.gtnewhorizons.angelica.mixins.interfaces.ITexturesCache; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.util.IIcon; + +/** + * Exposes a method to the API that allow mods to add texture update compat + */ +@SuppressWarnings("unused") +public class TextureServices { + + @SuppressWarnings("unused") + public static void updateBlockTextureAnimation(IIcon icon, RenderBlocks renderBlocks) { + if (renderBlocks instanceof ITexturesCache texturesCache) { + texturesCache.getRenderedTextures().add(icon); + } + } + + @SuppressWarnings("unused") + public static void updateTextureAnimation(IIcon icon) { + if(icon instanceof IPatchedTextureAtlasSprite patchedSprite) { + patchedSprite.markNeedsAnimationUpdate(); + } + } +}