Skip to content

Commit

Permalink
Update texture on bind to fix Iris animated entities
Browse files Browse the repository at this point in the history
  • Loading branch information
soir20 committed Nov 12, 2024
1 parent d5d4f58 commit 73fb25f
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
}
}

0 comments on commit 73fb25f

Please sign in to comment.