From 73fb25ff246b3d891ed6f5e58ff4e27cf4e7c740 Mon Sep 17 00:00:00 2001 From: soir20 <71418127+soir20@users.noreply.github.com> Date: Mon, 11 Nov 2024 23:15:27 -0500 Subject: [PATCH] Update texture on bind to fix Iris animated entities --- .../impl/client/mixin/GlStateManagerMixin.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/io/github/moremcmeta/moremcmeta/impl/client/mixin/GlStateManagerMixin.java b/common/src/main/java/io/github/moremcmeta/moremcmeta/impl/client/mixin/GlStateManagerMixin.java index d84b4d15..94831e9d 100644 --- a/common/src/main/java/io/github/moremcmeta/moremcmeta/impl/client/mixin/GlStateManagerMixin.java +++ b/common/src/main/java/io/github/moremcmeta/moremcmeta/impl/client/mixin/GlStateManagerMixin.java @@ -18,7 +18,9 @@ package io.github.moremcmeta.moremcmeta.impl.client.mixin; import com.mojang.blaze3d.platform.GlStateManager; +import io.github.moremcmeta.moremcmeta.impl.client.mixinaccess.NamedTexture; import io.github.moremcmeta.moremcmeta.impl.client.texture.BoundTextureState; +import net.minecraft.client.renderer.texture.TextureAtlas; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -71,8 +73,14 @@ private static void moremcmeta_onDeleteTextures(int[] textureIds, CallbackInfo c * @param textureId texture ID to bind * @param callbackInfo callback info from Mixin */ - @Inject(method = "_bindTexture(I)V", at = @At("HEAD")) + @Inject(method = "_bindTexture(I)V", at = @At("RETURN")) private static void moremcmeta_onBindTexture(int textureId, CallbackInfo callbackInfo) { BoundTextureState.BOUND_TEXTURES[activeTexture] = textureId; + + // Update non-atlas textures on bind for better compatibility with other mods + NamedTexture boundTexture = BoundTextureState.TEXTURES_BY_ID.get(textureId); + if (boundTexture != null && !(boundTexture instanceof TextureAtlas)) { + NamedTexture.uploadDependencies(boundTexture.moremcmeta_names()); + } } }