Refactoed 1.21.5 to work with new gif api
This commit is contained in:
+1
-1
Submodule common updated: eb40ece9f6...2b6194223a
+7
-9
@@ -42,11 +42,10 @@ public class IdentifierUtils {
|
||||
|
||||
}
|
||||
|
||||
NativeImageBackedTexture texture = new NativeImageBackedTexture(nativeImage);
|
||||
|
||||
SaturnClient.client.execute(() ->
|
||||
SaturnClient.client.getTextureManager().registerTexture(identifier, texture)
|
||||
);
|
||||
SaturnClient.client.execute(() -> {
|
||||
NativeImageBackedTexture texture = new NativeImageBackedTexture(nativeImage);
|
||||
SaturnClient.client.getTextureManager().registerTexture(identifier, texture);
|
||||
});
|
||||
|
||||
} catch (Exception e) {
|
||||
SaturnClient.LOGGER.error("Failed to register texture: {}", identifierRef, e);
|
||||
@@ -62,9 +61,8 @@ public class IdentifierUtils {
|
||||
long end = System.currentTimeMillis();
|
||||
|
||||
SaturnClient.LOGGER.info(
|
||||
"Registered {} textures in {}ms",
|
||||
textures.size(),
|
||||
(end - start)
|
||||
);
|
||||
"Registered {} textures in {}ms",
|
||||
textures.size(),
|
||||
(end - start));
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-9
@@ -42,11 +42,13 @@ public class IdentifierUtils {
|
||||
|
||||
}
|
||||
|
||||
NativeImageBackedTexture texture = new NativeImageBackedTexture(() -> identifier.toString(), nativeImage);
|
||||
|
||||
SaturnClient.client.execute(() ->
|
||||
SaturnClient.client.getTextureManager().registerTexture(identifier, texture)
|
||||
);
|
||||
SaturnClient.client.execute(() -> {
|
||||
NativeImageBackedTexture texture = new NativeImageBackedTexture(
|
||||
() -> identifier.toString(),
|
||||
nativeImage);
|
||||
|
||||
SaturnClient.client.getTextureManager().registerTexture(identifier, texture);
|
||||
});
|
||||
|
||||
} catch (Exception e) {
|
||||
SaturnClient.LOGGER.error("Failed to register texture: {}", identifierRef, e);
|
||||
@@ -62,9 +64,8 @@ public class IdentifierUtils {
|
||||
long end = System.currentTimeMillis();
|
||||
|
||||
SaturnClient.LOGGER.info(
|
||||
"Registered {} textures in {}ms",
|
||||
textures.size(),
|
||||
(end - start)
|
||||
);
|
||||
"Registered {} textures in {}ms",
|
||||
textures.size(),
|
||||
(end - start));
|
||||
}
|
||||
}
|
||||
+9
-3
@@ -1,5 +1,8 @@
|
||||
package org.saturnclient.impl.cosmetics.utils;
|
||||
|
||||
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||
import org.saturnclient.cosmetics.utils.GifUtils;
|
||||
|
||||
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||
|
||||
import net.minecraft.client.gl.RenderPipelines;
|
||||
@@ -23,11 +26,14 @@ public class ShaderUtils {
|
||||
.add(EndPortalBlockEntityRenderer.PORTAL_TEXTURE, false, false).build())
|
||||
.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
package org.saturnclient.impl.mixins;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Quaternionfc;
|
||||
import org.saturnclient.common.ref.render.MatrixStackRef;
|
||||
import org.saturnclient.common.ref.render.QuaternionfRef;
|
||||
|
||||
Reference in New Issue
Block a user