From 1a159517912dd8c02ffc18c44dd1283e464c6724 Mon Sep 17 00:00:00 2001 From: ZekerZhayard Date: Sat, 21 Jun 2025 21:54:07 +0800 Subject: [PATCH] Support 1.21.6. (#341) --- CONTRIBUTING.md | 36 +++++++++++-------- .../customskinloader/CustomSkinLoader.java | 5 +-- .../fake/FakeSkinManager.java | 20 +++++++++++ .../profile/DynamicSkullManager.java | 4 +-- .../profile/ModelManager0.java | 5 +-- .../client/resources/SkinManager.java | 6 ++-- Fabric/build.properties | 4 +-- Fabric/mixin.tsrg | 3 ++ .../resources/mixins.customskinloader.json | 1 + Forge/V3/build.properties | 4 +-- Forge/V3/mixin.tsrg | 3 ++ .../resources/mixins.customskinloader.json | 1 + .../mixin/MixinSkinManager.java | 23 ++++++++++++ .../mixin/MixinSkinTextureDownloader.java | 5 ++- .../mixin/core/MixinConfigPlugin.java | 2 ++ 15 files changed, 95 insertions(+), 27 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fd173df..0f7356c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,30 +27,42 @@ There are the available versions in different environments below: ``` 1. Create these folders in the new project directory, then copy the built jar and source jar into it: ``` - Forge 1.8 ~ 1.16.5: ./local-repo/mods/CustomSkinLoader_ForgeLegacy/${version} - Forge 1.17.1 ~ latest: ./local-repo/mods/CustomSkinLoader_ForgeActive/${version} - Fabric: ./local-repo/mods/CustomSkinLoader_Fabric/${version} + Forge 1.8 ~ 1.16.5: ./local-repo/mods/CustomSkinLoader_ForgeV1/${version} + Forge 1.17.1 ~ 1.20.4 / NeoForge 1.20.1: ./local-repo/mods/CustomSkinLoader_ForgeV2/${version} + Forge 1.20.6 ~ latest / NeoForge 1.20.2 ~ latest: ./local-repo/mods/CustomSkinLoader_ForgeV3/${version} + Fabric: ./local-repo/mods/CustomSkinLoader_Fabric/${version} ``` *`${version}` should be repalced with something like `15.0-SNAPSHOT-00` manually* 1. Create a pom file in the same folder: - - Forge 1.8 ~ 1.16.5: `CustomSkinLoader_ForgeLegacy-${version}.pom` + - Forge 1.8 ~ 1.16.5: `CustomSkinLoader_ForgeV1-${version}.pom` ```xml 4.0.0 mods - CustomSkinLoader_ForgeLegacy + CustomSkinLoader_ForgeV1 ${version} ``` - - Forge 1.17.1 ~ latest: `CustomSkinLoader_ForgeActive-${version}.pom` + - Forge 1.17.1 ~ 1.20.4 / NeoForge 1.20.1: `CustomSkinLoader_ForgeV2-${version}.pom` ```xml 4.0.0 mods - CustomSkinLoader_ForgeActive + CustomSkinLoader_ForgeV2 + + ${version} + + ``` + - Forge 1.20.6 ~ latest / NeoForge 1.20.2 ~ latest: `CustomSkinLoader_ForgeV3-${version}.pom` + ```xml + + + 4.0.0 + mods + CustomSkinLoader_ForgeV3 ${version} @@ -81,7 +93,7 @@ There are the available versions in different environments below: 1. Run `./gradlew setupDecompWorkspace` command. 1. Then you can debug the mod in IDE or through `./gradlew runClient` command. -### For ForgeGradle 3.x ~ 5.x ( forge-1.12.2-14.23.5.2851 ~ latest ) +### For ForgeGradle 3.x ~ latest ( forge-1.12.2-14.23.5.2851 ~ latest ) 1. Add below contents to `build.gradle`: ```gradle dependencies { @@ -107,12 +119,9 @@ There are the available versions in different environments below: modImplementation "mods:CustomSkinLoader_Fabric:15.0-SNAPSHOT-00" } - tasks.runClient { - args += ["--username", ""] - } + loom.runs.client.programArgs "--username", "" ``` -1. Add `--username ` to CLI arguments in `Run/Debug Configurations` dialog. -1. Run the game in IDE or through `./gradlew runClient` command.. +1. Setup the development environment and run the game as usual. ## Depend on release builds 1. Check the latest version in https://littlesk.in/csl-latest . @@ -145,5 +154,4 @@ There are the available versions in different environments below: ## Developing - CustomSkinLoader is based on forge-1.12.2-14.23.5.2768 currently, including Fabric edition. We use custom reobfuscation mappings such as [Fabric.tsrg](Fabric/Fabric.tsrg) and [mixin.tsrg](Fabric/mixin.tsrg) to generate different editions jar and Mixin reference jsons. -- The source codes are all in `${projectDir}/sources` and resource files are in `${projectDir}/resources` instead of `src/main/java` and `src/main/resources`. - Do not add other required mods. diff --git a/Common/src/main/java/customskinloader/CustomSkinLoader.java b/Common/src/main/java/customskinloader/CustomSkinLoader.java index 17c3f5d..7c7bc29 100644 --- a/Common/src/main/java/customskinloader/CustomSkinLoader.java +++ b/Common/src/main/java/customskinloader/CustomSkinLoader.java @@ -10,7 +10,7 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.function.Function; -import com.google.common.collect.Maps; +import com.google.common.collect.ImmutableMap; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.mojang.authlib.GameProfile; @@ -194,6 +194,7 @@ public class CustomSkinLoader { return null; } + public final static Map INCOMPLETED = ImmutableMap.of(); //For Skull public static Map loadProfileFromCache(final GameProfile gameProfile) { String username = gameProfile.getName(); @@ -222,7 +223,7 @@ public class CustomSkinLoader { threadPool.execute(loadThread); } } - return Maps.newHashMap(); + return INCOMPLETED; } private static Logger initLogger() { diff --git a/Common/src/main/java/customskinloader/fake/FakeSkinManager.java b/Common/src/main/java/customskinloader/fake/FakeSkinManager.java index 492cca2..abcf814 100644 --- a/Common/src/main/java/customskinloader/fake/FakeSkinManager.java +++ b/Common/src/main/java/customskinloader/fake/FakeSkinManager.java @@ -4,6 +4,7 @@ import java.awt.image.BufferedImage; import java.io.File; import java.nio.file.Path; import java.util.Map; +import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.function.Supplier; @@ -238,6 +239,18 @@ public class FakeSkinManager { return FakeCacheKey.createMinecraftProfileTextures(loadSkinFromCache(sessionService, FakeCacheKey.unwrapProperty(property), false)); } + private final static CompletableFuture INCOMPLETED = new CompletableFuture<>(); + /** + * 1.21.6-pre1+ + * Invoked from {@link SkinManager#registerTextures(UUID, MinecraftProfileTextures)} + */ + public static CompletableFuture checkIncompleted(MinecraftProfileTextures textures, CompletableFuture future) { + if (textures == FakeCacheKey.IncompletedContainer.INCOMPLETED) { + return INCOMPLETED; + } + return future; + } + private static boolean shouldJudgeType(MinecraftProfileTexture texture) { return texture != null && "auto".equals(texture.getMetadata("model")); } @@ -305,7 +318,14 @@ public class FakeSkinManager { return MojangAPILoader.GSON.fromJson((String) TextureUtil.AuthlibField.PROPERTY_SIGNATURE.get(property), GameProfile.class); // 23w42a+ } + public static class IncompletedContainer { + public final static Object INCOMPLETED = new MinecraftProfileTextures(null, null, null, SignatureState.SIGNED); + } + public static Object createMinecraftProfileTextures(Map textures) { + if (textures == CustomSkinLoader.INCOMPLETED) { + return IncompletedContainer.INCOMPLETED; + } return new MinecraftProfileTextures(textures.get(MinecraftProfileTexture.Type.SKIN), textures.get(MinecraftProfileTexture.Type.CAPE), textures.get(MinecraftProfileTexture.Type.ELYTRA), SignatureState.SIGNED); } } diff --git a/Common/src/main/java/customskinloader/profile/DynamicSkullManager.java b/Common/src/main/java/customskinloader/profile/DynamicSkullManager.java index 5583479..0e2ec4f 100644 --- a/Common/src/main/java/customskinloader/profile/DynamicSkullManager.java +++ b/Common/src/main/java/customskinloader/profile/DynamicSkullManager.java @@ -136,7 +136,7 @@ public class DynamicSkullManager { if (staticTextures.get(profile) != null) return staticTextures.get(profile); if (loadingList.contains(profile)) - return Maps.newHashMap(); + return CustomSkinLoader.INCOMPLETED; if (dynamicTextures.containsKey(profile)) { SkullTexture texture = dynamicTextures.get(profile); long time = System.currentTimeMillis() - texture.startTime; @@ -153,6 +153,6 @@ public class DynamicSkullManager { }); loadThread.setName("Skull " + profile.hashCode()); loadThread.start(); - return Maps.newHashMap(); + return CustomSkinLoader.INCOMPLETED; } } diff --git a/Common/src/main/java/customskinloader/profile/ModelManager0.java b/Common/src/main/java/customskinloader/profile/ModelManager0.java index 66a2897..75965d6 100644 --- a/Common/src/main/java/customskinloader/profile/ModelManager0.java +++ b/Common/src/main/java/customskinloader/profile/ModelManager0.java @@ -5,6 +5,7 @@ import java.util.Map; import com.google.common.collect.Maps; import com.mojang.authlib.minecraft.MinecraftProfileTexture; +import customskinloader.CustomSkinLoader; import customskinloader.fake.FakeMinecraftProfileTexture; import org.apache.commons.lang3.StringUtils; @@ -98,9 +99,9 @@ public class ModelManager0 { * @since 13.1 */ public static Map fromUserProfile(UserProfile profile) { - Map map = Maps.newHashMap(); if (profile == null) - return map; + return CustomSkinLoader.INCOMPLETED; + Map map = Maps.newHashMap(); if (profile.skinUrl != null) { Map metadata = null; if ("slim".equals(profile.model) || "auto".equals(profile.model)) { diff --git a/Dummy/src/main/java/net/minecraft/client/resources/SkinManager.java b/Dummy/src/main/java/net/minecraft/client/resources/SkinManager.java index 0723ceb..c289201 100644 --- a/Dummy/src/main/java/net/minecraft/client/resources/SkinManager.java +++ b/Dummy/src/main/java/net/minecraft/client/resources/SkinManager.java @@ -2,6 +2,7 @@ package net.minecraft.client.resources; import java.io.File; import java.util.Map; +import java.util.UUID; import java.util.concurrent.CompletableFuture; import com.mojang.authlib.GameProfile; @@ -13,11 +14,12 @@ import net.minecraft.util.ResourceLocation; public class SkinManager { public SkinManager(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService) { } - public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final MinecraftProfileTexture.Type textureType, final SkinManager$SkinAvailableCallback skinAvailableCallback) { return null; } - public void loadProfileTextures(final GameProfile profile, final SkinManager$SkinAvailableCallback skinAvailableCallback, final boolean requireSecure) { } + public ResourceLocation loadSkin(MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager$SkinAvailableCallback skinAvailableCallback) { return null; } + public void loadProfileTextures(GameProfile profile, SkinManager$SkinAvailableCallback skinAvailableCallback, boolean requireSecure) { } public Map loadSkinFromCache(GameProfile profile) { return null; } public CompletableFuture getOrLoad(GameProfile profile) { return null; } public PlayerSkin getInsecureSkin(GameProfile profile) { return null; } + public CompletableFuture registerTextures(UUID uuid, MinecraftProfileTextures textures) { return null; } public void /* lambda$loadProfileTextures$1 */ func_210275_a(GameProfile profile, boolean b, SkinManager$SkinAvailableCallback callback) {} public void /* lambda$null$0 */ func_210276_a(Map map, SkinManager$SkinAvailableCallback callback) {} public static PlayerSkin lambda$registerTextures$1(CompletableFuture skin, String url, CompletableFuture cape, CompletableFuture elytra, PlayerSkin$Model model, MinecraftProfileTextures textures, Void _void) { return null; } diff --git a/Fabric/build.properties b/Fabric/build.properties index 0dd06ce..ccb9b0e 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,1.21.2,1.21.3,1.21.4,1.21.5;\ - 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,1.21.4,1.21.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,1.21.2,1.21.3,1.21.4,1.21.5,1.21.6;\ + 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,1.21.4,1.21.5,1.21.6 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/mixin.tsrg b/Fabric/mixin.tsrg index ef014fd..b8f751c 100644 --- a/Fabric/mixin.tsrg +++ b/Fabric/mixin.tsrg @@ -29,6 +29,7 @@ net/minecraft/client/renderer/texture/NativeImage net/minecraft/class_1011 net/minecraft/client/renderer/texture/SkinTextureDownloader net/minecraft/class_10538 downloadAndRegisterSkin (Lnet/minecraft/util/ResourceLocation;Ljava/nio/file/Path;Ljava/lang/String;Z)Ljava/util/concurrent/CompletableFuture; method_65861 lambda$registerTextureInManager$2 (Lnet/minecraft/client/Minecraft;Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/util/ResourceLocation; method_65864 + lambda$registerTextureInManager$2 (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/NativeImage;Lnet/minecraft/client/Minecraft;)Lnet/minecraft/util/ResourceLocation; method_65864 net/minecraft/client/renderer/texture/TextureManager net/minecraft/class_1060 loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/AbstractTexture;)V method_4616 net/minecraft/client/resources/PlayerSkin net/minecraft/class_8685 @@ -37,11 +38,13 @@ net/minecraft/client/resources/SkinManager net/minecraft/class_1071 func_210275_a (Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V method_4653 func_210276_a (Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V method_4655 getInsecureSkin (Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/PlayerSkin; method_52862 + getInsecureSkin (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/PlayerSkin;)Lnet/minecraft/client/resources/PlayerSkin; method_72180 getOrLoad (Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture; method_52863 lambda$registerTextures$1 (Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Ljava/util/concurrent/CompletableFuture;Ljava/util/concurrent/CompletableFuture;Lnet/minecraft/client/resources/PlayerSkin$Model;Lcom/mojang/authlib/minecraft/MinecraftProfileTextures;Ljava/lang/Void;)Lnet/minecraft/client/resources/PlayerSkin; method_52861 loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V method_4652 loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; method_4651 loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; method_4654 + registerTextures (Ljava/util/UUID;Lcom/mojang/authlib/minecraft/MinecraftProfileTextures;)Ljava/util/concurrent/CompletableFuture; method_52859 net/minecraft/client/resources/SkinManager$1 net/minecraft/class_1071$1 lambda$load$0 (Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/SkinManager$TextureInfo; method_52867 lambda$load$0 (Lnet/minecraft/client/resources/SkinManager$CacheKey;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)Lcom/mojang/authlib/minecraft/MinecraftProfileTextures; method_54647 diff --git a/Fabric/src/main/resources/mixins.customskinloader.json b/Fabric/src/main/resources/mixins.customskinloader.json index e0ff762..07bddf7 100644 --- a/Fabric/src/main/resources/mixins.customskinloader.json +++ b/Fabric/src/main/resources/mixins.customskinloader.json @@ -21,6 +21,7 @@ "MixinSkinManager$V3", "MixinSkinManager$V4", "MixinSkinManager$V5", + "MixinSkinManager$V6", "MixinSkinTextureDownloader", "MixinThreadDownloadImageData$V1", "MixinThreadDownloadImageData$V2" diff --git a/Forge/V3/build.properties b/Forge/V3/build.properties index 3adf265..9751f62 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,1.21.3,1.21.4,1.21.5;\ - 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,1.21.4,1.21.5 +dependencies=Forge|1.20.6,1.21,1.21.1,1.21.3,1.21.4,1.21.5,1.21.6;\ + 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,1.21.4,1.21.5,1.21.6 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/mixin.tsrg b/Forge/V3/mixin.tsrg index c8223df..f5d08eb 100644 --- a/Forge/V3/mixin.tsrg +++ b/Forge/V3/mixin.tsrg @@ -29,6 +29,7 @@ net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/Na net/minecraft/client/renderer/texture/SkinTextureDownloader net/minecraft/client/renderer/texture/SkinTextureDownloader downloadAndRegisterSkin (Lnet/minecraft/util/ResourceLocation;Ljava/nio/file/Path;Ljava/lang/String;Z)Ljava/util/concurrent/CompletableFuture; downloadAndRegisterSkin lambda$registerTextureInManager$2 (Lnet/minecraft/client/Minecraft;Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/util/ResourceLocation; lambda$registerTextureInManager$2 + lambda$registerTextureInManager$2 (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/NativeImage;Lnet/minecraft/client/Minecraft;)Lnet/minecraft/util/ResourceLocation; lambda$registerTextureInManager$2 net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/renderer/texture/TextureManager loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/AbstractTexture;)V register net/minecraft/client/resources/PlayerSkin net/minecraft/client/resources/PlayerSkin @@ -37,11 +38,13 @@ net/minecraft/client/resources/SkinManager net/minecraft/client/resources/SkinMa func_210275_a (Lcom/mojang/authlib/GameProfile;ZLnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V lambda$registerSkins$4 func_210276_a (Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V lambda$registerSkins$2 getInsecureSkin (Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/PlayerSkin; getInsecureSkin + getInsecureSkin (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/PlayerSkin;)Lnet/minecraft/client/resources/PlayerSkin; getInsecureSkin getOrLoad (Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture; getOrLoad lambda$registerTextures$1 (Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Ljava/util/concurrent/CompletableFuture;Ljava/util/concurrent/CompletableFuture;Lnet/minecraft/client/resources/PlayerSkin$Model;Lcom/mojang/authlib/minecraft/MinecraftProfileTextures;Ljava/lang/Void;)Lnet/minecraft/client/resources/PlayerSkin; lambda$registerTextures$1 loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V registerSkins loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; registerTexture loadSkinFromCache (Lcom/mojang/authlib/GameProfile;)Ljava/util/Map; getInsecureSkinInformation + registerTextures (Ljava/util/UUID;Lcom/mojang/authlib/minecraft/MinecraftProfileTextures;)Ljava/util/concurrent/CompletableFuture; registerTextures net/minecraft/client/resources/SkinManager$1 net/minecraft/client/resources/SkinManager$1 lambda$load$0 (Lcom/mojang/authlib/minecraft/MinecraftSessionService;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/SkinManager$TextureInfo; lambda$load$0 lambda$load$0 (Lnet/minecraft/client/resources/SkinManager$CacheKey;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)Lcom/mojang/authlib/minecraft/MinecraftProfileTextures; lambda$load$0 diff --git a/Forge/V3/src/main/resources/mixins.customskinloader.json b/Forge/V3/src/main/resources/mixins.customskinloader.json index 9ff2da5..a5d19de 100644 --- a/Forge/V3/src/main/resources/mixins.customskinloader.json +++ b/Forge/V3/src/main/resources/mixins.customskinloader.json @@ -19,6 +19,7 @@ "MixinSkinManager$V3", "MixinSkinManager$V4", "MixinSkinManager$V5", + "MixinSkinManager$V6", "MixinSkinTextureDownloader", "MixinThreadDownloadImageData$V2" ], diff --git a/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinManager.java b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinManager.java index 430ad09..b59f0b8 100644 --- a/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinManager.java +++ b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinManager.java @@ -3,6 +3,7 @@ package customskinloader.mixin; import java.io.File; import java.nio.file.Path; import java.util.Map; +import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; @@ -18,6 +19,7 @@ import com.mojang.authlib.minecraft.MinecraftSessionService; import com.mojang.authlib.properties.Property; import customskinloader.fake.FakeSkinManager; import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.resources.PlayerSkin; import net.minecraft.client.resources.PlayerSkin$Model; import net.minecraft.client.resources.SkinManager; import net.minecraft.client.resources.SkinManager$SkinAvailableCallback; @@ -287,4 +289,25 @@ public abstract class MixinSkinManager { return FakeSkinManager.loadSkinModel(model, textures); } } + + // 1.21.6-pre1+ + @Mixin(SkinManager.class) + public abstract static class V6 { + @Inject( + method = "Lnet/minecraft/client/resources/SkinManager;getInsecureSkin(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/PlayerSkin;)Lnet/minecraft/client/resources/PlayerSkin;", + at = @At("HEAD") + ) + private void inject_getInsecureSkin(GameProfile profile, PlayerSkin skin, CallbackInfoReturnable callbackInfoReturnable) { + FakeSkinManager.setSkullType(profile); + } + + @Inject( + method = "Lnet/minecraft/client/resources/SkinManager;registerTextures(Ljava/util/UUID;Lcom/mojang/authlib/minecraft/MinecraftProfileTextures;)Ljava/util/concurrent/CompletableFuture;", + at = @At("RETURN"), + cancellable = true + ) + private void inject_registerTextures(UUID uuid, MinecraftProfileTextures textures, CallbackInfoReturnable> callbackInfoReturnable) { + callbackInfoReturnable.setReturnValue(FakeSkinManager.checkIncompleted(textures, callbackInfoReturnable.getReturnValue())); + } + } } diff --git a/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinTextureDownloader.java b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinTextureDownloader.java index 9958318..43b691a 100644 --- a/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinTextureDownloader.java +++ b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinTextureDownloader.java @@ -13,7 +13,10 @@ import org.spongepowered.asm.mixin.injection.Redirect; @SuppressWarnings("target") public abstract class MixinSkinTextureDownloader { @Redirect( - method = "Lnet/minecraft/client/renderer/texture/SkinTextureDownloader;lambda$registerTextureInManager$2(Lnet/minecraft/client/Minecraft;Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/util/ResourceLocation;", + method = { + "Lnet/minecraft/client/renderer/texture/SkinTextureDownloader;lambda$registerTextureInManager$2(Lnet/minecraft/client/Minecraft;Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/NativeImage;)Lnet/minecraft/util/ResourceLocation;", // 23w46a ~ 1.21.5 + "Lnet/minecraft/client/renderer/texture/SkinTextureDownloader;lambda$registerTextureInManager$2(Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/NativeImage;Lnet/minecraft/client/Minecraft;)Lnet/minecraft/util/ResourceLocation;" // 25w15a+ + }, at = @At( value = "INVOKE", target = "Lnet/minecraft/client/renderer/texture/TextureManager;loadTexture(Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/AbstractTexture;)V" diff --git a/Vanilla/Common/src/main/java/customskinloader/mixin/core/MixinConfigPlugin.java b/Vanilla/Common/src/main/java/customskinloader/mixin/core/MixinConfigPlugin.java index 204eadf..1aa846e 100644 --- a/Vanilla/Common/src/main/java/customskinloader/mixin/core/MixinConfigPlugin.java +++ b/Vanilla/Common/src/main/java/customskinloader/mixin/core/MixinConfigPlugin.java @@ -66,6 +66,8 @@ public class MixinConfigPlugin implements IMixinConfigPlugin { result = this.world_version >= 3684 && ((this.protocol_version >= 765 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x4000009D); // 23w42a+ } else if (mixinClassName.endsWith(".MixinSkinManager$V5") || mixinClassName.endsWith(".MixinSkinManager$TextureCache$V2") || mixinClassName.endsWith(".MixinSkinTextureDownloader") || mixinClassName.endsWith(".MixinResourceLocation")) { result = this.world_version >= 4178 && ((this.protocol_version >= 769 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x400000DE); // 23w46a+ + } else if (mixinClassName.endsWith(".MixinSkinManager$V6")) { + result = this.world_version >= 4430 && ((this.protocol_version >= 771 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x400000FC); // 1.21.6-pre1+ } else if (mixinClassName.endsWith(".MixinThreadDownloadImageData$V1")) { result = (this.world_version >= 2205 && this.world_version <= 2722) && ((this.protocol_version >= 554 && this.protocol_version <= 754) || (this.protocol_version >= 801 && this.protocol_version <= 803) || (this.protocol_version >= 0x40000001 && this.protocol_version <= 0x40000022)); // 19w38a ~ 1.17-rc1 } else if (mixinClassName.endsWith(".MixinThreadDownloadImageData$V2")) {