-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose texture updates to API (#805)
* Expose texture updates to API * Expose for blocks as well * Fix mistake * Fixed API
- Loading branch information
1 parent
b0ceb53
commit ead4e11
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/main/java/com/gtnewhorizons/angelica/api/TextureServices.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |