aboutsummaryrefslogtreecommitdiff
path: root/defaults
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2022-12-29 10:11:52 +0200
committerSHsuperCM <shsupercm@gmail.com>2022-12-29 10:11:52 +0200
commit9c28f947a88506c3183dadc921f66590a9925a66 (patch)
treeafb0cd8aa51f5062a262e5f1e348c5417cd62b62 /defaults
parent81212be85afae09bc578980e0676e5ba31ac9ece (diff)
downloadCITResewn-9c28f947a88506c3183dadc921f66590a9925a66.tar.gz
CITResewn-9c28f947a88506c3183dadc921f66590a9925a66.tar.bz2
CITResewn-9c28f947a88506c3183dadc921f66590a9925a66.zip
Fixed cit models not loading from normal atlases
Diffstat (limited to 'defaults')
-rw-r--r--defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/common/AtlasPreparationMixin.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/common/AtlasPreparationMixin.java b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/common/AtlasPreparationMixin.java
new file mode 100644
index 0000000..cfbc4d3
--- /dev/null
+++ b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/mixin/common/AtlasPreparationMixin.java
@@ -0,0 +1,22 @@
+package shcm.shsupercm.fabric.citresewn.defaults.mixin.common;
+
+import net.minecraft.client.render.model.SpriteAtlasManager;
+import net.minecraft.client.texture.Sprite;
+import net.minecraft.util.Identifier;
+import org.jetbrains.annotations.Nullable;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+
+@Mixin(SpriteAtlasManager.AtlasPreparation.class)
+public abstract class AtlasPreparationMixin {
+ @Shadow public @Nullable abstract Sprite getSprite(Identifier id);
+
+ @Inject(method = "getSprite", cancellable = true, at = @At("HEAD"))
+ private void citresewn$unwrapTexturePaths(Identifier id, CallbackInfoReturnable<Sprite> cir) {
+ if (id.getPath().startsWith("textures/") && id.getPath().endsWith(".png"))
+ cir.setReturnValue(getSprite(new Identifier(id.getNamespace(), id.getPath().substring(9, id.getPath().length() - 4))));
+ }
+}