diff --git a/Common/src/main/java/customskinloader/fake/FakeSkinManager.java b/Common/src/main/java/customskinloader/fake/FakeSkinManager.java index b87a1bd7..912abd81 100644 --- a/Common/src/main/java/customskinloader/fake/FakeSkinManager.java +++ b/Common/src/main/java/customskinloader/fake/FakeSkinManager.java @@ -16,7 +16,7 @@ import com.mojang.authlib.minecraft.MinecraftSessionService; import com.mojang.authlib.properties.Property; import customskinloader.CustomSkinLoader; -import customskinloader.fake.itf.IFakeSkinManagerCacheKey; +import customskinloader.fake.itf.FakeInterfaceManager; import customskinloader.loader.MojangAPILoader; import customskinloader.profile.ModelManager0; import customskinloader.profile.UserProfile; @@ -217,21 +217,17 @@ public void skinAvailable() { public static class FakeCacheKey { public static Object wrapCacheKey(Object cacheKey, GameProfile profile) { - IFakeSkinManagerCacheKey fakeCacheKey = (IFakeSkinManagerCacheKey) cacheKey; - if (fakeCacheKey.profile() != null) { - return cacheKey; // 23w31a ~ 23w41a - } else { - TextureUtil.AuthlibField.PROPERTY_SIGNATURE.set(fakeCacheKey.packedTextures(), MojangAPILoader.GSON.toJson(profile, GameProfile.class)); - return fakeCacheKey; // 23w42a+ + if (FakeInterfaceManager.SkinManagerCacheKey_profile(cacheKey) == null) { // 23w42a+ + TextureUtil.AuthlibField.PROPERTY_SIGNATURE.set(FakeInterfaceManager.SkinManagerCacheKey_packedTextures(cacheKey), MojangAPILoader.GSON.toJson(profile, GameProfile.class)); } + return cacheKey; } public static GameProfile unwrapCacheKey(Object cacheKey) { - IFakeSkinManagerCacheKey fakeCacheKey = (IFakeSkinManagerCacheKey) cacheKey; - if (fakeCacheKey.profile() != null) { - return fakeCacheKey.profile(); // 23w31a ~ 23w41a + if (FakeInterfaceManager.SkinManagerCacheKey_profile(cacheKey) != null) { + return FakeInterfaceManager.SkinManagerCacheKey_profile(cacheKey); // 23w31a ~ 23w41a } else { - return unwrapProperty(fakeCacheKey.packedTextures()); // 23w42a+ + return unwrapProperty(FakeInterfaceManager.SkinManagerCacheKey_packedTextures(cacheKey)); // 23w42a+ } } diff --git a/Common/src/main/java/customskinloader/fake/itf/FakeInterfaceManager.java b/Common/src/main/java/customskinloader/fake/itf/FakeInterfaceManager.java index fc677dcc..ab8eec6e 100644 --- a/Common/src/main/java/customskinloader/fake/itf/FakeInterfaceManager.java +++ b/Common/src/main/java/customskinloader/fake/itf/FakeInterfaceManager.java @@ -4,6 +4,8 @@ import java.io.InputStream; import java.util.Optional; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; import net.minecraft.client.resources.IResource; import net.minecraft.client.resources.IResourceManager; import net.minecraft.util.ResourceLocation; @@ -20,4 +22,16 @@ public static Optional IResourceManager_getResource(Object resourceMa public static IResourceManager Minecraft_getResourceManager(Object minecraft) { return (IResourceManager) ((IFakeMinecraft) minecraft).func_195551_G(); } + + public static int NativeImage_getPixel(Object nativeImage, int x, int y) { + return ((IFakeNativeImage) nativeImage).getPixel(x, y); + } + + public static GameProfile SkinManagerCacheKey_profile(Object skinManagerCacheKey) { + return ((IFakeSkinManagerCacheKey) skinManagerCacheKey).profile(); + } + + public static Property SkinManagerCacheKey_packedTextures(Object skinManagerCacheKey) { + return ((IFakeSkinManagerCacheKey) skinManagerCacheKey).packedTextures(); + } } diff --git a/Common/src/main/java/customskinloader/fake/itf/IFakeNativeImage.java b/Common/src/main/java/customskinloader/fake/itf/IFakeNativeImage.java new file mode 100644 index 00000000..1440c404 --- /dev/null +++ b/Common/src/main/java/customskinloader/fake/itf/IFakeNativeImage.java @@ -0,0 +1,9 @@ +package customskinloader.fake.itf; + +import net.minecraft.client.renderer.texture.NativeImage; + +public interface IFakeNativeImage { + default int getPixel(int x, int y) { + return ((NativeImage) this).func_195709_a(x, y); + } +} diff --git a/Common/src/main/java/customskinloader/fake/texture/FakeNativeImage.java b/Common/src/main/java/customskinloader/fake/texture/FakeNativeImage.java index 2adcd81e..5e03d6a7 100644 --- a/Common/src/main/java/customskinloader/fake/texture/FakeNativeImage.java +++ b/Common/src/main/java/customskinloader/fake/texture/FakeNativeImage.java @@ -2,6 +2,7 @@ import java.io.InputStream; +import customskinloader.fake.itf.FakeInterfaceManager; import net.minecraft.client.renderer.texture.NativeImage; public class FakeNativeImage implements FakeImage { @@ -36,7 +37,7 @@ public int getHeight() { } public int getRGBA(int x, int y) { - return image.func_195709_a(x, y); + return FakeInterfaceManager.NativeImage_getPixel(image, x, y); } public void setRGBA(int x, int y, int rgba) { diff --git a/Fabric/Fabric.tsrg b/Fabric/Fabric.tsrg index c7eed777..af6a7b37 100644 --- a/Fabric/Fabric.tsrg +++ b/Fabric/Fabric.tsrg @@ -7,6 +7,8 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; method_14486 customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft func_195551_G ()Lnet/minecraft/resources/IResourceManager; method_1478 +customskinloader/fake/itf/IFakeNativeImage customskinloader/fake/itf/IFakeNativeImage + getPixel (II)I method_61940 customskinloader/fake/itf/IFakeSkinManagerCacheKey customskinloader/fake/itf/IFakeSkinManagerCacheKey profile ()Lcom/mojang/authlib/GameProfile; comp_1631 packedTextures ()Lcom/mojang/authlib/properties/Property; comp_2011 diff --git a/Fabric/build.properties b/Fabric/build.properties index ec603707..6dc33ae8 100644 --- a/Fabric/build.properties +++ b/Fabric/build.properties @@ -1,5 +1,5 @@ -dependencies=Fabric|1.14,1.14.1,1.14.2,1.14.3,1.14.4,1.15,1.15.1,1.15.2,1.16,1.16.1,1.16.2,1.16.3,1.16.4,1.16.5,1.17,1.17.1,1.18,1.18.1,1.18.2,1.19,1.19.1,1.19.2,1.19.3,1.19.4,1.20,1.20.1,1.20.2,1.20.3,1.20.4,1.20.5,1.20.6,1.21,1.21.1;\ - Quilt|1.14,1.14.1,1.14.2,1.14.3,1.14.4,1.15,1.15.1,1.15.2,1.16,1.16.1,1.16.2,1.16.3,1.16.4,1.16.5,1.17,1.17.1,1.18,1.18.1,1.18.2,1.19,1.19.1,1.19.2,1.19.3,1.19.4,1.20,1.20.1,1.20.2,1.20.3,1.20.4,1.20.5,1.20.6,1.21,1.21.1 +dependencies=Fabric|1.14,1.14.1,1.14.2,1.14.3,1.14.4,1.15,1.15.1,1.15.2,1.16,1.16.1,1.16.2,1.16.3,1.16.4,1.16.5,1.17,1.17.1,1.18,1.18.1,1.18.2,1.19,1.19.1,1.19.2,1.19.3,1.19.4,1.20,1.20.1,1.20.2,1.20.3,1.20.4,1.20.5,1.20.6,1.21,1.21.1,1.21.2,1.21.3;\ + Quilt|1.14,1.14.1,1.14.2,1.14.3,1.14.4,1.15,1.15.1,1.15.2,1.16,1.16.1,1.16.2,1.16.3,1.16.4,1.16.5,1.17,1.17.1,1.18,1.18.1,1.18.2,1.19,1.19.1,1.19.2,1.19.3,1.19.4,1.20,1.20.1,1.20.2,1.20.3,1.20.4,1.20.5,1.20.6,1.21,1.21.1,1.21.2,1.21.3 java_full_versions=8,9,10,11,12,13,14,15,16,17,18,19,20,21,22 #forge gradle needs forge version forge_mc_version=1.12.2 diff --git a/Fabric/src/main/resources/customskinloader.accesswidener b/Fabric/src/main/resources/customskinloader.accesswidener index 5c55ce14..ca140798 100644 --- a/Fabric/src/main/resources/customskinloader.accesswidener +++ b/Fabric/src/main/resources/customskinloader.accesswidener @@ -1,3 +1,2 @@ accessWidener v2 intermediary accessible method net/minecraft/class_2960 (Ljava/lang/String;Ljava/lang/String;)V # 24w18a+ -accessible method net/minecraft/class_1011 method_4315 (II)I # 24w33a+ diff --git a/Fabric/src/main/resources/mixins.customskinloader.json b/Fabric/src/main/resources/mixins.customskinloader.json index 29a47ec4..6c118c33 100644 --- a/Fabric/src/main/resources/mixins.customskinloader.json +++ b/Fabric/src/main/resources/mixins.customskinloader.json @@ -9,6 +9,7 @@ "MixinIResourceManager", "MixinLayerCape", "MixinMinecraft", + "MixinNativeImage", "MixinRenderPlayer", "MixinSkinManager$1", "MixinSkinManager$CacheKey", diff --git a/Forge/V2/Forge.tsrg b/Forge/V2/Forge.tsrg index 07a77e44..95b9cd0f 100644 --- a/Forge/V2/Forge.tsrg +++ b/Forge/V2/Forge.tsrg @@ -7,6 +7,8 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; m_213713_ customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft func_195551_G ()Lnet/minecraft/resources/IResourceManager; m_91098_ +customskinloader/fake/itf/IFakeNativeImage customskinloader/fake/itf/IFakeNativeImage + getPixel (II)I getPixel customskinloader/fake/itf/IFakeSkinManagerCacheKey customskinloader/fake/itf/IFakeSkinManagerCacheKey profile ()Lcom/mojang/authlib/GameProfile; f_290972_ packedTextures ()Lcom/mojang/authlib/properties/Property; f_303729_ diff --git a/Forge/V3/Forge.tsrg b/Forge/V3/Forge.tsrg index 129c72ed..0f9ed897 100644 --- a/Forge/V3/Forge.tsrg +++ b/Forge/V3/Forge.tsrg @@ -7,6 +7,8 @@ customskinloader/fake/itf/IFakeIResourceManager customskinloader/fake/itf/IFakeI getResource (Lnet/minecraft/util/ResourceLocation;)Ljava/util/Optional; getResource customskinloader/fake/itf/IFakeMinecraft customskinloader/fake/itf/IFakeMinecraft func_195551_G ()Lnet/minecraft/resources/IResourceManager; getResourceManager +customskinloader/fake/itf/IFakeNativeImage customskinloader/fake/itf/IFakeNativeImage + getPixel (II)I getPixel customskinloader/fake/itf/IFakeSkinManagerCacheKey customskinloader/fake/itf/IFakeSkinManagerCacheKey profile ()Lcom/mojang/authlib/GameProfile; profile packedTextures ()Lcom/mojang/authlib/properties/Property; packedTextures diff --git a/Forge/V3/build.properties b/Forge/V3/build.properties index 1c222072..787aa5fd 100644 --- a/Forge/V3/build.properties +++ b/Forge/V3/build.properties @@ -1,5 +1,5 @@ -dependencies=Forge|1.20.6,1.21,1.21.1;\ - NeoForge|1.20.2,1.20.3,1.20.4,1.20.5,1.20.6,1.21,1.21.1 +dependencies=Forge|1.20.6,1.21,1.21.1,1.21.3;\ + NeoForge|1.20.2,1.20.3,1.20.4,1.20.5,1.20.6,1.21,1.21.1,1.21.2,1.21.3 java_full_versions=17,18,19,20,21,22 #forge gradle needs forge version forge_mc_version=1.12.2 diff --git a/Forge/V3/src/main/resources/META-INF/accesstransformer.cfg b/Forge/V3/src/main/resources/META-INF/accesstransformer.cfg index dada82b5..8e360011 100644 --- a/Forge/V3/src/main/resources/META-INF/accesstransformer.cfg +++ b/Forge/V3/src/main/resources/META-INF/accesstransformer.cfg @@ -1,2 +1 @@ public net.minecraft.resources.ResourceLocation (Ljava/lang/String;Ljava/lang/String;)V # 24w18a+ -public com.mojang.blaze3d.platform.NativeImage getPixelRGBA(II)I # 24w33a+ diff --git a/Forge/V3/src/main/resources/mixins.customskinloader.json b/Forge/V3/src/main/resources/mixins.customskinloader.json index de74fd3a..19c9a78b 100644 --- a/Forge/V3/src/main/resources/mixins.customskinloader.json +++ b/Forge/V3/src/main/resources/mixins.customskinloader.json @@ -8,6 +8,7 @@ "MixinIResourceManager", "MixinLayerCape", "MixinMinecraft", + "MixinNativeImage", "MixinRenderPlayer", "MixinSkinManager$1", "MixinSkinManager$CacheKey", diff --git a/Vanilla/Common/src/main/java/customskinloader/mixin/MixinNativeImage.java b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinNativeImage.java new file mode 100644 index 00000000..433a1a35 --- /dev/null +++ b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinNativeImage.java @@ -0,0 +1,10 @@ +package customskinloader.mixin; + +import customskinloader.fake.itf.IFakeNativeImage; +import net.minecraft.client.renderer.texture.NativeImage; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(NativeImage.class) +public abstract class MixinNativeImage implements IFakeNativeImage { + +}