Skip to content

Commit

Permalink
Expose texture updates to API (#805)
Browse files Browse the repository at this point in the history
* Expose texture updates to API

* Expose for blocks as well

* Fix mistake

* Fixed API
  • Loading branch information
CookieBrigade authored Dec 20, 2024
1 parent b0ceb53 commit ead4e11
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/main/java/com/gtnewhorizons/angelica/api/TextureServices.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
}

0 comments on commit ead4e11

Please sign in to comment.