Gif loading

This commit is contained in:
2026-03-23 20:33:10 +01:00
parent 7ce54c8561
commit d3cd883782
4 changed files with 15 additions and 8 deletions
+1 -1
Submodule common updated: ca42b00067...8398c8ce7a
@@ -3,6 +3,7 @@ package org.saturnclient.impl.cosmetics;
import java.util.Arrays;
import org.saturnclient.client.player.SaturnPlayer;
import org.saturnclient.common.ref.asset.IdentifierRef;
import org.saturnclient.config.Config;
import org.saturnclient.cosmetics.Cloaks;
import org.saturnclient.impl.cosmetics.utils.ShaderUtils;
@@ -23,7 +24,6 @@ import net.minecraft.component.type.EquippableComponent;
import net.minecraft.item.ItemStack;
import net.minecraft.item.equipment.EquipmentAsset;
import net.minecraft.registry.RegistryKey;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.RotationAxis;
import net.minecraft.util.math.Vec3d;
@@ -283,7 +283,7 @@ public class CloakFeatureRenderer extends FeatureRenderer<PlayerEntityRenderStat
return;
}
Identifier customCape = (Identifier) (Object) Cloaks.getCurrentCloakTexture(player.cloak);
IdentifierRef customCape = Cloaks.getCurrentCloakTexture(player.cloak);
if (customCape == null
|| this.hasCustomModelForLayer(playerEntityRenderState.equippedChestStack, LayerType.WINGS)) {
return;
@@ -4,6 +4,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import org.saturnclient.common.ref.asset.IdentifierRef;
import org.saturnclient.impl.cosmetics.utils.ShaderUtils;
import de.javagl.obj.*;
@@ -36,13 +37,13 @@ public class ObjRenderer {
Mtl mtl = mtlMap != null ? mtlMap.get(materialName) : null;
// Resolve texture identifier using same logic as ObjUnbakedModelModel
Identifier texture = Identifier.of("minecraft:textures/misc/white.png");
IdentifierRef texture = IdentifierRef.ofVanilla("textures/misc/white.png");
if (mtl != null) {
String mapKd = mtl.getMapKd();
if (mapKd != null) {
if (!mapKd.startsWith("#")) {
texture = Identifier.of(mapKd);
texture = IdentifierRef.of(mapKd);
}
}
}
@@ -1,5 +1,8 @@
package org.saturnclient.impl.cosmetics.utils;
import org.saturnclient.common.ref.asset.IdentifierRef;
import org.saturnclient.cosmetics.utils.GifUtils;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.RenderPhase;
import net.minecraft.client.render.VertexFormat.DrawMode;
@@ -25,11 +28,14 @@ public class ShaderUtils {
.cull(RenderPhase.DISABLE_CULLING)
.build(false));
public static RenderLayer getRenderLayer(Identifier texture) {
if (texture.getPath().endsWith("end.png")) {
public static RenderLayer getRenderLayer(IdentifierRef texture) {
String path = texture.toString();
if (path.endsWith(".gif")) {
return RenderLayer.getEntityAlpha((Identifier) (Object) GifUtils.get(texture));
} else if (path.endsWith("end.png")) {
return END_GATEWAY;
} else {
return RenderLayer.getEntityAlpha(texture);
return RenderLayer.getEntityAlpha((Identifier) (Object) texture);
}
}
}