From 1cb4cf40b0ff864c4c692fd2deb77b30ad8017c6 Mon Sep 17 00:00:00 2001 From: ZekerZhayard Date: Mon, 23 Dec 2024 21:43:38 +0800 Subject: [PATCH] 1.21.4 (#321) * 1.21.4 * Disable making the source jar. --- Common/build.gradle | 5 ++ .../customskinloader/fake/FakeCapeBuffer.java | 12 ++- .../fake/FakeClientPlayer.java | 9 +-- .../customskinloader/fake/FakeSkinBuffer.java | 17 ++++- .../fake/FakeSkinManager.java | 75 +++++++++++++++---- .../fake/itf/FakeInterfaceManager.java | 10 ++- .../fake/itf/IFakeIResourceManager.java | 5 +- .../fake/itf/IFakeResourceLocation.java | 6 ++ .../fake/itf/IFakeSkinManagerCacheKey.java | 5 +- .../texture/FakeThreadDownloadImageData.java | 38 ++++++++++ .../customskinloader/utils/TextureUtil.java | 14 +++- Dummy/Dummy.srg | 0 Dummy/build.gradle | 7 ++ Dummy/build.properties | 5 ++ .../com/mojang/authlib/SignatureState.java | 2 - .../minecraft/MinecraftProfileTextures.java | 5 +- .../java/net/minecraft/client/Minecraft.java | 17 +++++ .../client/gui/GuiPlayerTabOverlay.java | 5 ++ .../client/multiplayer/ServerData.java | 5 ++ .../minecraft/client/renderer/RenderType.java | 0 .../renderer/ThreadDownloadImageData.java | 10 +++ .../client/renderer/entity/RenderPlayer.java | 5 ++ .../renderer/entity/layers/LayerCape.java | 5 ++ .../renderer/texture/AbstractTexture.java | 5 ++ .../renderer/texture/ITextureObject.java | 5 ++ .../client/renderer/texture/NativeImage.java | 0 .../renderer/texture/ReloadableTexture.java | 5 ++ .../renderer/texture/SimpleTexture.java | 9 +++ .../texture/SkinTextureDownloader.java | 12 +++ .../client/renderer/texture/Texture.java | 0 .../renderer/texture/TextureContents.java | 7 ++ .../renderer/texture/TextureManager.java | 9 +++ .../client/resources/DefaultPlayerSkin.java | 9 +++ .../minecraft/client/resources/IResource.java | 7 ++ .../client/resources/IResourceManager.java | 7 ++ .../client/resources/PlayerSkin$Model.java | 5 ++ .../client/resources/PlayerSkin.java | 3 +- .../client/resources/SkinManager$1.java | 13 ++++ .../resources/SkinManager$CacheKey.java | 7 ++ .../SkinManager$ISkinAvailableCallback.java | 8 ++ .../SkinManager$SkinAvailableCallback.java | 15 ++++ .../resources/SkinManager$TextureCache.java | 10 +++ .../resources/SkinManager$TextureInfo.java | 5 ++ .../client/resources/SkinManager.java | 24 ++++++ .../data/TextureMetadataSection.java | 5 ++ .../net/minecraft/resources/IResource.java | 0 .../minecraft/resources/IResourceManager.java | 0 .../net/minecraft/util/ResourceLocation.java | 6 ++ .../java/net/minecraft/util/StringUtils.java | 5 ++ Fabric/Fabric.tsrg | 12 +++ Fabric/build.gradle | 1 + Fabric/build.properties | 4 +- Fabric/mixin.tsrg | 9 +++ .../resources/customskinloader.accesswidener | 2 + .../resources/mixins.customskinloader.json | 7 +- Forge/Common/build.gradle | 5 ++ .../deobf/FMLDeobfuscatingRemapper.java | 7 ++ .../fml/relauncher/CoreModManager.java | 7 ++ .../fml/relauncher/FMLLaunchHandler.java | 5 ++ .../fml/relauncher/IFMLLoadingPlugin.java | 19 +++++ .../minecraftforge/fml/relauncher/Side.java | 5 ++ Forge/V1/build.gradle | 4 +- .../minecraft/client/resources/IResource.java | 0 .../client/resources/IResourceManager.java | 4 +- .../SkinManager$SkinAvailableCallback.java | 15 ++++ .../client/resources/SkinManager.java | 35 --------- .../V1/src/main/resources/META-INF/mods.toml | 2 +- Forge/V2/Forge.tsrg | 12 +++ Forge/V2/build.gradle | 1 + .../V2/src/main/resources/META-INF/mods.toml | 2 +- Forge/V3/Forge.tsrg | 12 +++ Forge/V3/build.gradle | 1 + Forge/V3/build.properties | 4 +- Forge/V3/mixin.tsrg | 9 +++ .../forge/MixinConfigPlugin.java | 14 +++- .../resources/META-INF/accesstransformer.cfg | 2 + .../V3/src/main/resources/META-INF/mods.toml | 2 +- .../resources/mixins.customskinloader.json | 7 +- Vanilla/Common/build.gradle | 1 + .../mixin/MixinLayerCape.java | 5 +- .../mixin/MixinResourceLocation.java | 22 ++++++ .../mixin/MixinSkinManager$1.java | 4 +- .../mixin/MixinSkinManager$CacheKey.java | 4 +- .../mixin/MixinSkinManager$TextureCache.java | 58 ++++++++++---- .../mixin/MixinSkinManager.java | 62 ++++++++++++--- .../mixin/MixinSkinTextureDownloader.java | 26 +++++++ .../mixin/MixinThreadDownloadImageData.java | 2 +- .../mixin/core/MixinConfigPlugin.java | 12 ++- .../client/resources/SkinManager.java | 32 -------- build.gradle | 12 ++- build.properties | 2 +- .../gradle/util/RemapUtil.java | 48 +++++++++--- settings.gradle | 1 + 93 files changed, 762 insertions(+), 181 deletions(-) create mode 100644 Common/build.gradle create mode 100644 Common/src/main/java/customskinloader/fake/itf/IFakeResourceLocation.java create mode 100644 Common/src/main/java/customskinloader/fake/texture/FakeThreadDownloadImageData.java create mode 100644 Dummy/Dummy.srg create mode 100644 Dummy/build.gradle create mode 100644 Dummy/build.properties rename {Common => Dummy}/src/main/java/com/mojang/authlib/SignatureState.java (72%) rename {Common => Dummy}/src/main/java/com/mojang/authlib/minecraft/MinecraftProfileTextures.java (73%) create mode 100644 Dummy/src/main/java/net/minecraft/client/Minecraft.java create mode 100644 Dummy/src/main/java/net/minecraft/client/gui/GuiPlayerTabOverlay.java create mode 100644 Dummy/src/main/java/net/minecraft/client/multiplayer/ServerData.java rename {Common => Dummy}/src/main/java/net/minecraft/client/renderer/RenderType.java (100%) create mode 100644 Dummy/src/main/java/net/minecraft/client/renderer/ThreadDownloadImageData.java create mode 100644 Dummy/src/main/java/net/minecraft/client/renderer/entity/RenderPlayer.java create mode 100644 Dummy/src/main/java/net/minecraft/client/renderer/entity/layers/LayerCape.java create mode 100644 Dummy/src/main/java/net/minecraft/client/renderer/texture/AbstractTexture.java create mode 100644 Dummy/src/main/java/net/minecraft/client/renderer/texture/ITextureObject.java rename {Common => Dummy}/src/main/java/net/minecraft/client/renderer/texture/NativeImage.java (100%) create mode 100644 Dummy/src/main/java/net/minecraft/client/renderer/texture/ReloadableTexture.java create mode 100644 Dummy/src/main/java/net/minecraft/client/renderer/texture/SimpleTexture.java create mode 100644 Dummy/src/main/java/net/minecraft/client/renderer/texture/SkinTextureDownloader.java rename {Common => Dummy}/src/main/java/net/minecraft/client/renderer/texture/Texture.java (100%) create mode 100644 Dummy/src/main/java/net/minecraft/client/renderer/texture/TextureContents.java create mode 100644 Dummy/src/main/java/net/minecraft/client/renderer/texture/TextureManager.java create mode 100644 Dummy/src/main/java/net/minecraft/client/resources/DefaultPlayerSkin.java create mode 100644 Dummy/src/main/java/net/minecraft/client/resources/IResource.java create mode 100644 Dummy/src/main/java/net/minecraft/client/resources/IResourceManager.java create mode 100644 Dummy/src/main/java/net/minecraft/client/resources/PlayerSkin$Model.java rename Vanilla/Common/src/main/java/net/minecraft/client/resources/SkinManager$1.java => Dummy/src/main/java/net/minecraft/client/resources/PlayerSkin.java (59%) create mode 100644 Dummy/src/main/java/net/minecraft/client/resources/SkinManager$1.java create mode 100644 Dummy/src/main/java/net/minecraft/client/resources/SkinManager$CacheKey.java create mode 100644 Dummy/src/main/java/net/minecraft/client/resources/SkinManager$ISkinAvailableCallback.java create mode 100644 Dummy/src/main/java/net/minecraft/client/resources/SkinManager$SkinAvailableCallback.java create mode 100644 Dummy/src/main/java/net/minecraft/client/resources/SkinManager$TextureCache.java create mode 100644 Dummy/src/main/java/net/minecraft/client/resources/SkinManager$TextureInfo.java create mode 100644 Dummy/src/main/java/net/minecraft/client/resources/SkinManager.java create mode 100644 Dummy/src/main/java/net/minecraft/client/resources/data/TextureMetadataSection.java rename {Common => Dummy}/src/main/java/net/minecraft/resources/IResource.java (100%) rename {Common => Dummy}/src/main/java/net/minecraft/resources/IResourceManager.java (100%) create mode 100644 Dummy/src/main/java/net/minecraft/util/ResourceLocation.java create mode 100644 Dummy/src/main/java/net/minecraft/util/StringUtils.java create mode 100644 Forge/Common/build.gradle create mode 100644 Forge/Common/src/main/java/net/minecraftforge/fml/common/asm/transformers/deobf/FMLDeobfuscatingRemapper.java create mode 100644 Forge/Common/src/main/java/net/minecraftforge/fml/relauncher/CoreModManager.java create mode 100644 Forge/Common/src/main/java/net/minecraftforge/fml/relauncher/FMLLaunchHandler.java create mode 100644 Forge/Common/src/main/java/net/minecraftforge/fml/relauncher/IFMLLoadingPlugin.java create mode 100644 Forge/Common/src/main/java/net/minecraftforge/fml/relauncher/Side.java rename {Common => Forge/V1}/src/main/java/net/minecraft/client/resources/IResource.java (100%) rename {Common => Forge/V1}/src/main/java/net/minecraft/client/resources/IResourceManager.java (65%) create mode 100644 Forge/V1/src/main/java/net/minecraft/client/resources/SkinManager$SkinAvailableCallback.java delete mode 100644 Forge/V1/src/main/java/net/minecraft/client/resources/SkinManager.java create mode 100644 Vanilla/Common/src/main/java/customskinloader/mixin/MixinResourceLocation.java create mode 100644 Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinTextureDownloader.java delete mode 100644 Vanilla/Common/src/main/java/net/minecraft/client/resources/SkinManager.java diff --git a/Common/build.gradle b/Common/build.gradle new file mode 100644 index 00000000..e7056bf8 --- /dev/null +++ b/Common/build.gradle @@ -0,0 +1,5 @@ +// This subproject is only to provide dependency for other subprojects. + +dependencies { + implementation project(':Dummy') +} diff --git a/Common/src/main/java/customskinloader/fake/FakeCapeBuffer.java b/Common/src/main/java/customskinloader/fake/FakeCapeBuffer.java index 9da9e239..b6b7e5e5 100644 --- a/Common/src/main/java/customskinloader/fake/FakeCapeBuffer.java +++ b/Common/src/main/java/customskinloader/fake/FakeCapeBuffer.java @@ -2,24 +2,27 @@ import java.io.IOException; import java.io.InputStream; -import java.util.NoSuchElementException; import java.util.function.BiPredicate; import java.util.function.Predicate; +import customskinloader.CustomSkinLoader; import customskinloader.fake.itf.FakeInterfaceManager; import customskinloader.fake.texture.FakeImage; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; public class FakeCapeBuffer extends FakeSkinBuffer { - private static final ResourceLocation TEXTURE_ELYTRA = new ResourceLocation("minecraft", "textures/entity/elytra.png"); + private static final ResourceLocation TEXTURE_ELYTRA_V1 = new ResourceLocation("minecraft", "textures/entity/elytra.png"); + private static final ResourceLocation TEXTURE_ELYTRA_V2 = new ResourceLocation("minecraft", "textures/entity/equipment/wings/elytra.png"); private static int loadedGlobal = 0; private static FakeImage elytraImage; private static FakeImage loadElytra(FakeImage originalImage) { loadedGlobal++; try { - InputStream is = FakeInterfaceManager.IResource_getInputStream(FakeInterfaceManager.IResourceManager_getResource(FakeInterfaceManager.Minecraft_getResourceManager(Minecraft.getMinecraft()), TEXTURE_ELYTRA).get()); + Object resourceManager = FakeInterfaceManager.Minecraft_getResourceManager(Minecraft.getMinecraft()); + InputStream is = FakeInterfaceManager.IResource_getInputStream(FakeInterfaceManager.IResourceManager_getResource(resourceManager, TEXTURE_ELYTRA_V1) + .orElseGet(() -> FakeInterfaceManager.IResourceManager_getResource(resourceManager, TEXTURE_ELYTRA_V2).orElse(null))); if (is != null) { FakeImage image = originalImage.createImage(is); if (image.getWidth() % 64 != 0 || image.getHeight() % 32 != 0) { // wtf? @@ -28,7 +31,8 @@ private static FakeImage loadElytra(FakeImage originalImage) { image = resetImageFormat(image, 22, 0, 46, 22); return image; } - } catch (IOException | NoSuchElementException ignored) { + } catch (IOException e) { + CustomSkinLoader.logger.warning(e); } return null; } diff --git a/Common/src/main/java/customskinloader/fake/FakeClientPlayer.java b/Common/src/main/java/customskinloader/fake/FakeClientPlayer.java index 1a768001..f4ff77b5 100644 --- a/Common/src/main/java/customskinloader/fake/FakeClientPlayer.java +++ b/Common/src/main/java/customskinloader/fake/FakeClientPlayer.java @@ -7,7 +7,6 @@ import com.mojang.authlib.GameProfile; import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; - import customskinloader.CustomSkinLoader; import customskinloader.utils.MinecraftUtil; import net.minecraft.client.renderer.ThreadDownloadImageData; @@ -16,15 +15,15 @@ import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.resources.DefaultPlayerSkin; import net.minecraft.client.resources.SkinManager; -import net.minecraft.client.resources.SkinManager.SkinAvailableCallback; +import net.minecraft.client.resources.SkinManager$SkinAvailableCallback; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StringUtils; public class FakeClientPlayer { /** - * Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinManager.SkinAvailableCallback)} + * Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinManager$SkinAvailableCallback)} */ - public static ThreadDownloadImageData putCache(ThreadDownloadImageData threaddownloadimagedata, SkinManager.SkinAvailableCallback skinAvailableCallback, ResourceLocation resourcelocation) { + public static ThreadDownloadImageData putCache(ThreadDownloadImageData threaddownloadimagedata, SkinManager$SkinAvailableCallback skinAvailableCallback, ResourceLocation resourcelocation) { if (skinAvailableCallback instanceof FakeClientPlayer.LegacyBuffer) {//Cache for client player textureCache.put(resourcelocation, threaddownloadimagedata); } @@ -69,7 +68,7 @@ public static UUID getOfflineUUID(String username) { public static Map textureCache = Maps.newHashMap(); - public static class LegacyBuffer implements SkinAvailableCallback { + public static class LegacyBuffer implements SkinManager$SkinAvailableCallback { ResourceLocation resourceLocationIn; boolean loaded = false; diff --git a/Common/src/main/java/customskinloader/fake/FakeSkinBuffer.java b/Common/src/main/java/customskinloader/fake/FakeSkinBuffer.java index d3f04f5d..52825822 100644 --- a/Common/src/main/java/customskinloader/fake/FakeSkinBuffer.java +++ b/Common/src/main/java/customskinloader/fake/FakeSkinBuffer.java @@ -1,6 +1,7 @@ package customskinloader.fake; import java.awt.image.BufferedImage; +import java.io.InputStream; import java.util.function.Function; import java.util.function.Predicate; @@ -8,19 +9,31 @@ import customskinloader.fake.texture.FakeBufferedImage; import customskinloader.fake.texture.FakeImage; import customskinloader.fake.texture.FakeNativeImage; +import customskinloader.fake.texture.FakeThreadDownloadImageData; import net.minecraft.client.renderer.IImageBuffer; +import net.minecraft.client.renderer.ThreadDownloadImageData; import net.minecraft.client.renderer.texture.NativeImage; +import net.minecraft.client.resources.IResourceManager; public class FakeSkinBuffer implements IImageBuffer { private int ratio = 1; FakeImage image = null; - //parseUserSkin for 1.15+ + /** + * 19w38a ~ 24w45a + * Invoked from {@link ThreadDownloadImageData#loadTexture(InputStream)} + * + * 24w46a+ + * Invoked from {@link FakeThreadDownloadImageData#loadContents(IResourceManager)} + */ public static NativeImage processLegacySkin(NativeImage image, Runnable processTask, Function processLegacySkin) { if (processTask instanceof IImageBuffer) { return ((IImageBuffer) processTask).func_195786_a(image); + } else if (processLegacySkin != null) { + return processLegacySkin.apply(image); + } else { + return image; } - return processLegacySkin.apply(image); } //parseUserSkin for 1.13+ diff --git a/Common/src/main/java/customskinloader/fake/FakeSkinManager.java b/Common/src/main/java/customskinloader/fake/FakeSkinManager.java index 912abd81..78a1d732 100644 --- a/Common/src/main/java/customskinloader/fake/FakeSkinManager.java +++ b/Common/src/main/java/customskinloader/fake/FakeSkinManager.java @@ -4,6 +4,8 @@ import java.io.File; import java.nio.file.Path; import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; import java.util.function.Supplier; import com.google.common.cache.CacheLoader; @@ -17,6 +19,7 @@ import com.mojang.authlib.properties.Property; import customskinloader.CustomSkinLoader; import customskinloader.fake.itf.FakeInterfaceManager; +import customskinloader.fake.texture.FakeThreadDownloadImageData; import customskinloader.loader.MojangAPILoader; import customskinloader.profile.ModelManager0; import customskinloader.profile.UserProfile; @@ -25,18 +28,26 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IImageBuffer; import net.minecraft.client.renderer.texture.NativeImage; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.resources.PlayerSkin$Model; import net.minecraft.client.resources.SkinManager; +import net.minecraft.client.resources.SkinManager$1; +import net.minecraft.client.resources.SkinManager$CacheKey; +import net.minecraft.client.resources.SkinManager$SkinAvailableCallback; +import net.minecraft.client.resources.SkinManager$TextureCache; public class FakeSkinManager { /** - * Invoked from {@link SkinManager(net.minecraft.client.renderer.texture.TextureManager, File, MinecraftSessionService)} + * 1.20.1- + * Invoked from {@link SkinManager(TextureManager , File, MinecraftSessionService)} */ public static void setSkinCacheDir(File skinCacheDirectory) { HttpTextureUtil.defaultCacheDir = skinCacheDirectory; } /** - * Invoked from {@link SkinManager(net.minecraft.client.renderer.texture.TextureManager, Path, MinecraftSessionService, java.util.concurrent.Executor)} + * 23w31a+ + * Invoked from {@link SkinManager(TextureManager, Path, MinecraftSessionService, Executor)} */ public static void setSkinCacheDir(Path skinCacheDirectory) { HttpTextureUtil.defaultCacheDir = skinCacheDirectory.toFile(); @@ -44,13 +55,15 @@ public static void setSkinCacheDir(Path skinCacheDirectory) { private static CacheLoader cacheLoader; /** - * Invoked from {@link SkinManager(net.minecraft.client.renderer.texture.TextureManager, Path, MinecraftSessionService, java.util.concurrent.Executor)} + * 23w31a+ + * Invoked from {@link SkinManager(TextureManager, Path, MinecraftSessionService, Executor)} */ public static CacheLoader setCacheLoader(CacheLoader loader) { return cacheLoader = loader; } /** + * 23w42a+ * Invoked from {@link SkinManager#getOrLoad(GameProfile)} */ public static Property createProperty(Property property) { @@ -58,6 +71,7 @@ public static Property createProperty(Property property) { } /** + * 23w31a+ * Invoked from {@link SkinManager#getOrLoad(GameProfile)} */ public static Object loadCache(LoadingCache loadingCache, Object cacheKey, GameProfile profile) throws Exception { @@ -65,17 +79,31 @@ public static Object loadCache(LoadingCache loadingCache, Object cacheKey, } /** - * Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinManager.SkinAvailableCallback)} + * 1.20.1- + * Invoked from {@link SkinManager#loadSkin(MinecraftProfileTexture, MinecraftProfileTexture.Type, SkinManager$SkinAvailableCallback)} + * + * 23w31a+ + * Invoked from {@link SkinManager$TextureCache#registerTexture(MinecraftProfileTexture)} */ public static Object[] createThreadDownloadImageData(ImmutableList list, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType) { Object[] params = list.toArray(); - if (profileTexture instanceof FakeMinecraftProfileTexture && params.length > 1) { + if (profileTexture instanceof FakeMinecraftProfileTexture) { FakeMinecraftProfileTexture fakeProfileTexture = (FakeMinecraftProfileTexture) profileTexture; - params[0] = fakeProfileTexture.getCacheFile(); - if (params[params.length - 2] instanceof Boolean) { - params[params.length - 2] = true; + File cacheFile = fakeProfileTexture.getCacheFile(); + if (params.length == 4) { + if (params[3] instanceof Boolean) { // 24w46a+ + FakeInterfaceManager.ResourceLocation_setTexture(params[0], FakeThreadDownloadImageData.createTexture(params[0], cacheFile.toPath(), params[2], false, new BaseBuffer(null, textureType, fakeProfileTexture))); + params[1] = cacheFile.toPath(); + params[3] = false; + } else { // 19w37a- + params[0] = cacheFile; + params[3] = new BaseBuffer((Runnable) params[3], textureType, fakeProfileTexture); + } + } else if (params.length == 5) { // 19w38a ~ 24w45a + params[0] = cacheFile; + params[3] = true; + params[4] = new BaseBuffer((Runnable) params[4], textureType, fakeProfileTexture); } - params[params.length - 1] = new BaseBuffer((Runnable) params[params.length - 1], textureType, fakeProfileTexture); } return params; } @@ -83,7 +111,8 @@ public static Object[] createThreadDownloadImageData(ImmutableList list, private final static String KEY = "CustomSkinLoaderInfo"; /** - * Invoked from {@link SkinManager#loadProfileTextures(GameProfile, SkinManager.SkinAvailableCallback, boolean)} + * 1.20.1- + * Invoked from {@link SkinManager#loadProfileTextures(GameProfile, SkinManager$SkinAvailableCallback, boolean)} */ public static void loadProfileTextures(Runnable runnable, GameProfile profile) { CustomSkinLoader.loadProfileTextures(() -> CustomSkinLoader.loadProfileLazily(profile, p -> { @@ -95,7 +124,7 @@ public static void loadProfileTextures(Runnable runnable, GameProfile profile) { /** * 23w31a+ - * Invoked from net.minecraft.client.resources.SkinManager$1#load(net.minecraft.client.resources.SkinManager$CacheKey) + * Invoked from {@link SkinManager$1#load(SkinManager$CacheKey)} */ public static Object[] loadProfileTextures(ImmutableList list, Object cacheKey) { Object[] params = list.toArray(); @@ -115,16 +144,18 @@ public static Object[] loadProfileTextures(ImmutableList list, Object ca } /** - * Invoked from {@link SkinManager#lambda$loadProfileTextures$1(GameProfile, boolean, SkinAvailableCallback)} + * 1.20.1- + * Invoked from {@link SkinManager#func_210275_a(GameProfile, boolean, SkinManager$SkinAvailableCallback)} */ public static Map getUserProfile(MinecraftSessionService sessionService, GameProfile profile, boolean requireSecure) { return ModelManager0.fromUserProfile(UserProfile.fromProperties(profile.getProperties().values())); } /** - * Invoked from {@link SkinManager#lambda$null$0(Map, SkinAvailableCallback)} + * 1.20.1- + * Invoked from {@link SkinManager#func_210276_a(Map, SkinManager$SkinAvailableCallback)} */ - public static void loadElytraTexture(SkinManager skinManager, Map map, SkinManager.SkinAvailableCallback skinAvailableCallback) { + public static void loadElytraTexture(SkinManager skinManager, Map map, SkinManager$SkinAvailableCallback skinAvailableCallback) { for (int i = 2; i < MinecraftProfileTexture.Type.values().length; i++) { MinecraftProfileTexture.Type type = MinecraftProfileTexture.Type.values()[i]; if (map.containsKey(type)) { @@ -133,6 +164,18 @@ public static void loadElytraTexture(SkinManager skinManager, Map loadSki /** * 23w31a ~ 23w41a - * Invoked from net.minecraft.client.resources.SkinManager$1#lambda$load$0(GameProfile) + * Invoked from {@link SkinManager$1#lambda$load$0(MinecraftSessionService, GameProfile)} */ public static Map loadSkinFromCache(MinecraftSessionService sessionService, GameProfile profile, boolean requireSecure) { if (profile.getProperties().containsKey(SKULL_KEY)) { @@ -162,7 +205,7 @@ public static Map loadSki /** * 23w42a+ - * Invoked from net.minecraft.client.resources.SkinManager$1#lambda$load$0(SkinManager.CacheKey, MinecraftSessionService) + * Invoked from {@link SkinManager$1#lambda$load$0(SkinManager$CacheKey, MinecraftSessionService)} */ public static Object loadSkinFromCache(MinecraftSessionService sessionService, Property property) { return FakeCacheKey.createMinecraftProfileTextures(loadSkinFromCache(sessionService, FakeCacheKey.unwrapProperty(property), false)); diff --git a/Common/src/main/java/customskinloader/fake/itf/FakeInterfaceManager.java b/Common/src/main/java/customskinloader/fake/itf/FakeInterfaceManager.java index c0494b27..78015327 100644 --- a/Common/src/main/java/customskinloader/fake/itf/FakeInterfaceManager.java +++ b/Common/src/main/java/customskinloader/fake/itf/FakeInterfaceManager.java @@ -15,7 +15,7 @@ public static InputStream IResource_getInputStream(Object resource) { return ((IFakeIResource.V2) resource).open(); } - public static Optional IResourceManager_getResource(Object resourceManager, ResourceLocation location) throws IOException { + public static Optional IResourceManager_getResource(Object resourceManager, ResourceLocation location) { return ((IFakeIResourceManager) resourceManager).getResource(location); } @@ -31,6 +31,14 @@ public static void NativeImage_setPixel(Object nativeImage, int x, int y, int co ((IFakeNativeImage) nativeImage).setPixel(x, y, color); } + public static Object ResourceLocation_getTexture(Object location) { + return ((IFakeResourceLocation) location).customskinloader$getTexture(); + } + + public static void ResourceLocation_setTexture(Object location, Object texture) { + ((IFakeResourceLocation) location).customskinloader$setTexture(texture); + } + public static GameProfile SkinManagerCacheKey_profile(Object skinManagerCacheKey) { return ((IFakeSkinManagerCacheKey) skinManagerCacheKey).profile(); } diff --git a/Common/src/main/java/customskinloader/fake/itf/IFakeIResourceManager.java b/Common/src/main/java/customskinloader/fake/itf/IFakeIResourceManager.java index 865f0959..b552ccf6 100644 --- a/Common/src/main/java/customskinloader/fake/itf/IFakeIResourceManager.java +++ b/Common/src/main/java/customskinloader/fake/itf/IFakeIResourceManager.java @@ -1,6 +1,5 @@ package customskinloader.fake.itf; -import java.io.IOException; import java.util.Optional; import net.minecraft.client.resources.IResourceManager; @@ -9,12 +8,12 @@ public interface IFakeIResourceManager { // 1.13.2 ~ 22w13a - default IResource func_199002_a(ResourceLocation location) throws IOException { + default IResource func_199002_a(ResourceLocation location) { return (IResource) ((IResourceManager) this).getResource(location); } // 22w14a+ - default Optional getResource(ResourceLocation location) throws IOException { + default Optional getResource(ResourceLocation location) { return Optional.ofNullable(this.func_199002_a(location)); } } diff --git a/Common/src/main/java/customskinloader/fake/itf/IFakeResourceLocation.java b/Common/src/main/java/customskinloader/fake/itf/IFakeResourceLocation.java new file mode 100644 index 00000000..11bc126a --- /dev/null +++ b/Common/src/main/java/customskinloader/fake/itf/IFakeResourceLocation.java @@ -0,0 +1,6 @@ +package customskinloader.fake.itf; + +public interface IFakeResourceLocation { + Object customskinloader$getTexture(); + void customskinloader$setTexture(Object texture); +} diff --git a/Common/src/main/java/customskinloader/fake/itf/IFakeSkinManagerCacheKey.java b/Common/src/main/java/customskinloader/fake/itf/IFakeSkinManagerCacheKey.java index dbdcecc7..9e952128 100644 --- a/Common/src/main/java/customskinloader/fake/itf/IFakeSkinManagerCacheKey.java +++ b/Common/src/main/java/customskinloader/fake/itf/IFakeSkinManagerCacheKey.java @@ -4,9 +4,6 @@ import com.mojang.authlib.properties.Property; public interface IFakeSkinManagerCacheKey { - default GameProfile profile() { - return null; - } - + default GameProfile profile() { return null; } Property packedTextures(); } diff --git a/Common/src/main/java/customskinloader/fake/texture/FakeThreadDownloadImageData.java b/Common/src/main/java/customskinloader/fake/texture/FakeThreadDownloadImageData.java new file mode 100644 index 00000000..18c8c5d4 --- /dev/null +++ b/Common/src/main/java/customskinloader/fake/texture/FakeThreadDownloadImageData.java @@ -0,0 +1,38 @@ +package customskinloader.fake.texture; + +import java.nio.file.Path; + +import customskinloader.fake.FakeSkinBuffer; +import net.minecraft.client.renderer.texture.NativeImage; +import net.minecraft.client.renderer.texture.SimpleTexture; +import net.minecraft.client.renderer.texture.SkinTextureDownloader; +import net.minecraft.client.renderer.texture.TextureContents; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.util.ResourceLocation; + +// 24w46a+ +public class FakeThreadDownloadImageData extends SimpleTexture { + private final Path cacheFile; + private final String imageUrl; + private final boolean legacySkin; + private final Runnable processTask; + + public static Object createTexture(Object location, Object cacheFile, Object imageUrl, Object legacySkin, Object processTask) { + return new FakeThreadDownloadImageData((ResourceLocation) location, (Path) cacheFile, (String) imageUrl, (boolean) legacySkin, (Runnable) processTask); + } + + public FakeThreadDownloadImageData(ResourceLocation location, Path cacheFile, String imageUrl, boolean legacySkin, Runnable processTask) { + super(location); + this.cacheFile = cacheFile; + this.imageUrl = imageUrl; + this.legacySkin = legacySkin; + this.processTask = processTask; + } + + @Override + public TextureContents loadContents(IResourceManager resourceManager) { + NativeImage image = FakeSkinBuffer.processLegacySkin(SkinTextureDownloader.lambda$downloadAndRegisterSkin$0(this.cacheFile, this.imageUrl, this.legacySkin), this.processTask, i -> SkinTextureDownloader.processLegacySkin(i, this.imageUrl)); + this.processTask.run(); + return new TextureContents(image, null); + } +} diff --git a/Common/src/main/java/customskinloader/utils/TextureUtil.java b/Common/src/main/java/customskinloader/utils/TextureUtil.java index 80d83530..dc976e12 100644 --- a/Common/src/main/java/customskinloader/utils/TextureUtil.java +++ b/Common/src/main/java/customskinloader/utils/TextureUtil.java @@ -4,6 +4,7 @@ import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.reflect.Field; +import java.lang.reflect.Method; import java.util.Map; import java.util.UUID; import java.util.function.Supplier; @@ -15,7 +16,6 @@ import customskinloader.CustomSkinLoader; import org.apache.commons.codec.binary.Base64; import org.apache.commons.io.FileUtils; -import sun.misc.Unsafe; public class TextureUtil { /** @@ -44,11 +44,17 @@ public static String parseBase64Texture(String base64) { private final static MethodHandles.Lookup IMPL_LOOKUP = ((Supplier) () -> { try { - Field theUnsafeField = Unsafe.class.getDeclaredField("theUnsafe"); + Class unsafeClass = Class.forName("sun.misc.Unsafe"); + Field theUnsafeField = unsafeClass.getDeclaredField("theUnsafe"); theUnsafeField.setAccessible(true); - Unsafe theUnsafe = (Unsafe) theUnsafeField.get(null); + Object theUnsafe = theUnsafeField.get(null); + + Method getObjectMethod = unsafeClass.getMethod("getObject", Object.class, long.class); + Method staticFieldBaseMethod = unsafeClass.getMethod("staticFieldBase", Field.class); + Method staticFieldOffsetMethod = unsafeClass.getMethod("staticFieldOffset", Field.class); + Field implLookupField = MethodHandles.Lookup.class.getDeclaredField("IMPL_LOOKUP"); - return (MethodHandles.Lookup) theUnsafe.getObject(theUnsafe.staticFieldBase(implLookupField), theUnsafe.staticFieldOffset(implLookupField)); + return (MethodHandles.Lookup) getObjectMethod.invoke(theUnsafe, staticFieldBaseMethod.invoke(theUnsafe, implLookupField), staticFieldOffsetMethod.invoke(theUnsafe, implLookupField)); } catch (Throwable t) { throw new RuntimeException(t); } diff --git a/Dummy/Dummy.srg b/Dummy/Dummy.srg new file mode 100644 index 00000000..e69de29b diff --git a/Dummy/build.gradle b/Dummy/build.gradle new file mode 100644 index 00000000..825c4a80 --- /dev/null +++ b/Dummy/build.gradle @@ -0,0 +1,7 @@ +// This subproject is only to provide dependency for other subprojects. + +reobf { + jar { + mappings = file("Dummy.srg") + } +} diff --git a/Dummy/build.properties b/Dummy/build.properties new file mode 100644 index 00000000..2c5a53ad --- /dev/null +++ b/Dummy/build.properties @@ -0,0 +1,5 @@ +forge_mc_version=1.12.2 +forge_version=14.23.5.2768 +mappings_version=stable_39 +# this subproject is only to provide dependency for other subprojects. +is_real_project=false diff --git a/Common/src/main/java/com/mojang/authlib/SignatureState.java b/Dummy/src/main/java/com/mojang/authlib/SignatureState.java similarity index 72% rename from Common/src/main/java/com/mojang/authlib/SignatureState.java rename to Dummy/src/main/java/com/mojang/authlib/SignatureState.java index 8cde735c..1809bc72 100644 --- a/Common/src/main/java/com/mojang/authlib/SignatureState.java +++ b/Dummy/src/main/java/com/mojang/authlib/SignatureState.java @@ -1,7 +1,5 @@ package com.mojang.authlib; public enum SignatureState { - UNSIGNED, - INVALID, SIGNED } diff --git a/Common/src/main/java/com/mojang/authlib/minecraft/MinecraftProfileTextures.java b/Dummy/src/main/java/com/mojang/authlib/minecraft/MinecraftProfileTextures.java similarity index 73% rename from Common/src/main/java/com/mojang/authlib/minecraft/MinecraftProfileTextures.java rename to Dummy/src/main/java/com/mojang/authlib/minecraft/MinecraftProfileTextures.java index 89d8b38d..b9c3e222 100644 --- a/Common/src/main/java/com/mojang/authlib/minecraft/MinecraftProfileTextures.java +++ b/Dummy/src/main/java/com/mojang/authlib/minecraft/MinecraftProfileTextures.java @@ -3,7 +3,6 @@ import com.mojang.authlib.SignatureState; public class MinecraftProfileTextures { - public MinecraftProfileTextures(MinecraftProfileTexture skin, MinecraftProfileTexture cape, MinecraftProfileTexture elytra, SignatureState signatureState) { - - } + public MinecraftProfileTextures(MinecraftProfileTexture skin, MinecraftProfileTexture cape, MinecraftProfileTexture elytra, SignatureState signatureState) {} + public MinecraftProfileTexture skin() { return null; } } diff --git a/Dummy/src/main/java/net/minecraft/client/Minecraft.java b/Dummy/src/main/java/net/minecraft/client/Minecraft.java new file mode 100644 index 00000000..24d16b14 --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/Minecraft.java @@ -0,0 +1,17 @@ +package net.minecraft.client; + +import java.io.File; + +import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.SkinManager; + +public class Minecraft { + public File gameDir; + public static Minecraft getMinecraft() { return null; } + public ServerData getCurrentServerData() { return null; } + public IResourceManager getResourceManager() { return null; } + public SkinManager getSkinManager() { return null; } + public TextureManager getTextureManager() { return null; } +} diff --git a/Dummy/src/main/java/net/minecraft/client/gui/GuiPlayerTabOverlay.java b/Dummy/src/main/java/net/minecraft/client/gui/GuiPlayerTabOverlay.java new file mode 100644 index 00000000..3c18df2b --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/gui/GuiPlayerTabOverlay.java @@ -0,0 +1,5 @@ +package net.minecraft.client.gui; + +public class GuiPlayerTabOverlay { + +} diff --git a/Dummy/src/main/java/net/minecraft/client/multiplayer/ServerData.java b/Dummy/src/main/java/net/minecraft/client/multiplayer/ServerData.java new file mode 100644 index 00000000..7975be06 --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/multiplayer/ServerData.java @@ -0,0 +1,5 @@ +package net.minecraft.client.multiplayer; + +public class ServerData { + public String serverIP; +} diff --git a/Common/src/main/java/net/minecraft/client/renderer/RenderType.java b/Dummy/src/main/java/net/minecraft/client/renderer/RenderType.java similarity index 100% rename from Common/src/main/java/net/minecraft/client/renderer/RenderType.java rename to Dummy/src/main/java/net/minecraft/client/renderer/RenderType.java diff --git a/Dummy/src/main/java/net/minecraft/client/renderer/ThreadDownloadImageData.java b/Dummy/src/main/java/net/minecraft/client/renderer/ThreadDownloadImageData.java new file mode 100644 index 00000000..e3b461b7 --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/renderer/ThreadDownloadImageData.java @@ -0,0 +1,10 @@ +package net.minecraft.client.renderer; + +import java.io.InputStream; + +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.client.renderer.texture.NativeImage; + +public class ThreadDownloadImageData implements ITextureObject { + public NativeImage loadTexture(InputStream stream) { return null; } +} diff --git a/Dummy/src/main/java/net/minecraft/client/renderer/entity/RenderPlayer.java b/Dummy/src/main/java/net/minecraft/client/renderer/entity/RenderPlayer.java new file mode 100644 index 00000000..e828cef5 --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/renderer/entity/RenderPlayer.java @@ -0,0 +1,5 @@ +package net.minecraft.client.renderer.entity; + +public class RenderPlayer { + +} diff --git a/Dummy/src/main/java/net/minecraft/client/renderer/entity/layers/LayerCape.java b/Dummy/src/main/java/net/minecraft/client/renderer/entity/layers/LayerCape.java new file mode 100644 index 00000000..f3e8c9a6 --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/renderer/entity/layers/LayerCape.java @@ -0,0 +1,5 @@ +package net.minecraft.client.renderer.entity.layers; + +public class LayerCape { + +} diff --git a/Dummy/src/main/java/net/minecraft/client/renderer/texture/AbstractTexture.java b/Dummy/src/main/java/net/minecraft/client/renderer/texture/AbstractTexture.java new file mode 100644 index 00000000..aecd393f --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/renderer/texture/AbstractTexture.java @@ -0,0 +1,5 @@ +package net.minecraft.client.renderer.texture; + +public abstract class AbstractTexture { + +} diff --git a/Dummy/src/main/java/net/minecraft/client/renderer/texture/ITextureObject.java b/Dummy/src/main/java/net/minecraft/client/renderer/texture/ITextureObject.java new file mode 100644 index 00000000..146d766c --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/renderer/texture/ITextureObject.java @@ -0,0 +1,5 @@ +package net.minecraft.client.renderer.texture; + +public interface ITextureObject { + +} diff --git a/Common/src/main/java/net/minecraft/client/renderer/texture/NativeImage.java b/Dummy/src/main/java/net/minecraft/client/renderer/texture/NativeImage.java similarity index 100% rename from Common/src/main/java/net/minecraft/client/renderer/texture/NativeImage.java rename to Dummy/src/main/java/net/minecraft/client/renderer/texture/NativeImage.java diff --git a/Dummy/src/main/java/net/minecraft/client/renderer/texture/ReloadableTexture.java b/Dummy/src/main/java/net/minecraft/client/renderer/texture/ReloadableTexture.java new file mode 100644 index 00000000..ede43d4c --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/renderer/texture/ReloadableTexture.java @@ -0,0 +1,5 @@ +package net.minecraft.client.renderer.texture; + +public abstract class ReloadableTexture extends AbstractTexture { + +} diff --git a/Dummy/src/main/java/net/minecraft/client/renderer/texture/SimpleTexture.java b/Dummy/src/main/java/net/minecraft/client/renderer/texture/SimpleTexture.java new file mode 100644 index 00000000..9386a935 --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/renderer/texture/SimpleTexture.java @@ -0,0 +1,9 @@ +package net.minecraft.client.renderer.texture; + +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.util.ResourceLocation; + +public class SimpleTexture implements ITextureObject { + public SimpleTexture(ResourceLocation location) {} + public TextureContents loadContents(IResourceManager resourceManager) { return null; } +} diff --git a/Dummy/src/main/java/net/minecraft/client/renderer/texture/SkinTextureDownloader.java b/Dummy/src/main/java/net/minecraft/client/renderer/texture/SkinTextureDownloader.java new file mode 100644 index 00000000..11dd19eb --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/renderer/texture/SkinTextureDownloader.java @@ -0,0 +1,12 @@ +package net.minecraft.client.renderer.texture; + +import java.nio.file.Path; +import java.util.concurrent.CompletableFuture; + +import net.minecraft.util.ResourceLocation; + +public class SkinTextureDownloader { + public static CompletableFuture downloadAndRegisterSkin(ResourceLocation location, Path path, String string, boolean b) { return null; } + public static NativeImage processLegacySkin(NativeImage nativeImage, String url) { return null; } + public static NativeImage lambda$downloadAndRegisterSkin$0(Path path, String url, boolean b) { return null; } +} diff --git a/Common/src/main/java/net/minecraft/client/renderer/texture/Texture.java b/Dummy/src/main/java/net/minecraft/client/renderer/texture/Texture.java similarity index 100% rename from Common/src/main/java/net/minecraft/client/renderer/texture/Texture.java rename to Dummy/src/main/java/net/minecraft/client/renderer/texture/Texture.java diff --git a/Dummy/src/main/java/net/minecraft/client/renderer/texture/TextureContents.java b/Dummy/src/main/java/net/minecraft/client/renderer/texture/TextureContents.java new file mode 100644 index 00000000..36835d6f --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/renderer/texture/TextureContents.java @@ -0,0 +1,7 @@ +package net.minecraft.client.renderer.texture; + +import net.minecraft.client.resources.data.TextureMetadataSection; + +public class TextureContents { + public TextureContents(NativeImage image, TextureMetadataSection metadata) {} +} diff --git a/Dummy/src/main/java/net/minecraft/client/renderer/texture/TextureManager.java b/Dummy/src/main/java/net/minecraft/client/renderer/texture/TextureManager.java new file mode 100644 index 00000000..bf43aedf --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/renderer/texture/TextureManager.java @@ -0,0 +1,9 @@ +package net.minecraft.client.renderer.texture; + +import net.minecraft.util.ResourceLocation; + +public class TextureManager { + public ITextureObject getTexture(ResourceLocation location) { return null; } + public boolean loadTexture(ResourceLocation location, ITextureObject object) { return false; } + public void registerAndLoad(ResourceLocation resourceLocation, ReloadableTexture reloadableTexture) {} +} diff --git a/Dummy/src/main/java/net/minecraft/client/resources/DefaultPlayerSkin.java b/Dummy/src/main/java/net/minecraft/client/resources/DefaultPlayerSkin.java new file mode 100644 index 00000000..081e50b8 --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/resources/DefaultPlayerSkin.java @@ -0,0 +1,9 @@ +package net.minecraft.client.resources; + +import java.util.UUID; + +import net.minecraft.util.ResourceLocation; + +public class DefaultPlayerSkin { + public static ResourceLocation getDefaultSkin(UUID uuid) { return null; } +} diff --git a/Dummy/src/main/java/net/minecraft/client/resources/IResource.java b/Dummy/src/main/java/net/minecraft/client/resources/IResource.java new file mode 100644 index 00000000..0f0239a0 --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/resources/IResource.java @@ -0,0 +1,7 @@ +package net.minecraft.client.resources; + +import java.io.InputStream; + +public interface IResource { + InputStream getInputStream(); +} diff --git a/Dummy/src/main/java/net/minecraft/client/resources/IResourceManager.java b/Dummy/src/main/java/net/minecraft/client/resources/IResourceManager.java new file mode 100644 index 00000000..a514431e --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/resources/IResourceManager.java @@ -0,0 +1,7 @@ +package net.minecraft.client.resources; + +import net.minecraft.util.ResourceLocation; + +public interface IResourceManager { + IResource getResource(ResourceLocation location); +} diff --git a/Dummy/src/main/java/net/minecraft/client/resources/PlayerSkin$Model.java b/Dummy/src/main/java/net/minecraft/client/resources/PlayerSkin$Model.java new file mode 100644 index 00000000..7dad77aa --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/resources/PlayerSkin$Model.java @@ -0,0 +1,5 @@ +package net.minecraft.client.resources; + +public class PlayerSkin$Model { + public static PlayerSkin$Model byName(String string) { return null; } +} diff --git a/Vanilla/Common/src/main/java/net/minecraft/client/resources/SkinManager$1.java b/Dummy/src/main/java/net/minecraft/client/resources/PlayerSkin.java similarity index 59% rename from Vanilla/Common/src/main/java/net/minecraft/client/resources/SkinManager$1.java rename to Dummy/src/main/java/net/minecraft/client/resources/PlayerSkin.java index 4d278a73..1032deaa 100644 --- a/Vanilla/Common/src/main/java/net/minecraft/client/resources/SkinManager$1.java +++ b/Dummy/src/main/java/net/minecraft/client/resources/PlayerSkin.java @@ -1,4 +1,5 @@ package net.minecraft.client.resources; -public class SkinManager$1 { +public class PlayerSkin { + } diff --git a/Dummy/src/main/java/net/minecraft/client/resources/SkinManager$1.java b/Dummy/src/main/java/net/minecraft/client/resources/SkinManager$1.java new file mode 100644 index 00000000..9f3c18e2 --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/resources/SkinManager$1.java @@ -0,0 +1,13 @@ +package net.minecraft.client.resources; + +import java.util.concurrent.CompletableFuture; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.minecraft.MinecraftProfileTextures; +import com.mojang.authlib.minecraft.MinecraftSessionService; + +public class SkinManager$1 { + public CompletableFuture load(SkinManager$CacheKey cacheKey) { return null; } + public static SkinManager$TextureInfo lambda$load$0(MinecraftSessionService sessionService, GameProfile profile) { return null; } + public static MinecraftProfileTextures lambda$load$0(SkinManager$CacheKey cacheKey, MinecraftSessionService sessionService) { return null; } +} diff --git a/Dummy/src/main/java/net/minecraft/client/resources/SkinManager$CacheKey.java b/Dummy/src/main/java/net/minecraft/client/resources/SkinManager$CacheKey.java new file mode 100644 index 00000000..6027e8d9 --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/resources/SkinManager$CacheKey.java @@ -0,0 +1,7 @@ +package net.minecraft.client.resources; + +import com.mojang.authlib.GameProfile; + +public class SkinManager$CacheKey { + public GameProfile profile() { return null; } +} diff --git a/Dummy/src/main/java/net/minecraft/client/resources/SkinManager$ISkinAvailableCallback.java b/Dummy/src/main/java/net/minecraft/client/resources/SkinManager$ISkinAvailableCallback.java new file mode 100644 index 00000000..641af6a2 --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/resources/SkinManager$ISkinAvailableCallback.java @@ -0,0 +1,8 @@ +package net.minecraft.client.resources; + +import com.mojang.authlib.minecraft.MinecraftProfileTexture; +import net.minecraft.util.ResourceLocation; + +public interface SkinManager$ISkinAvailableCallback { + void onSkinTextureAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture); +} diff --git a/Dummy/src/main/java/net/minecraft/client/resources/SkinManager$SkinAvailableCallback.java b/Dummy/src/main/java/net/minecraft/client/resources/SkinManager$SkinAvailableCallback.java new file mode 100644 index 00000000..bebaea23 --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/resources/SkinManager$SkinAvailableCallback.java @@ -0,0 +1,15 @@ +package net.minecraft.client.resources; + +import com.mojang.authlib.minecraft.MinecraftProfileTexture; +import net.minecraft.util.ResourceLocation; + +// put into mod jar to prevent https://github.com/cpw/modlauncher/issues/39 +public interface SkinManager$SkinAvailableCallback { + default void skinAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture) { + this.onSkinTextureAvailable(typeIn, location, profileTexture); + } + + default void onSkinTextureAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture) { + ((SkinManager$ISkinAvailableCallback) this).onSkinTextureAvailable(typeIn, location, profileTexture); + } +} diff --git a/Dummy/src/main/java/net/minecraft/client/resources/SkinManager$TextureCache.java b/Dummy/src/main/java/net/minecraft/client/resources/SkinManager$TextureCache.java new file mode 100644 index 00000000..36118455 --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/resources/SkinManager$TextureCache.java @@ -0,0 +1,10 @@ +package net.minecraft.client.resources; + +import java.util.concurrent.CompletableFuture; + +import com.mojang.authlib.minecraft.MinecraftProfileTexture; + +public class SkinManager$TextureCache { + private MinecraftProfileTexture.Type type; + public CompletableFuture registerTexture(MinecraftProfileTexture texture) { return null; } +} diff --git a/Dummy/src/main/java/net/minecraft/client/resources/SkinManager$TextureInfo.java b/Dummy/src/main/java/net/minecraft/client/resources/SkinManager$TextureInfo.java new file mode 100644 index 00000000..0aee0a5b --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/resources/SkinManager$TextureInfo.java @@ -0,0 +1,5 @@ +package net.minecraft.client.resources; + +public class SkinManager$TextureInfo { + +} diff --git a/Dummy/src/main/java/net/minecraft/client/resources/SkinManager.java b/Dummy/src/main/java/net/minecraft/client/resources/SkinManager.java new file mode 100644 index 00000000..0723ceb5 --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/resources/SkinManager.java @@ -0,0 +1,24 @@ +package net.minecraft.client.resources; + +import java.io.File; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.minecraft.MinecraftProfileTexture; +import com.mojang.authlib.minecraft.MinecraftProfileTextures; +import com.mojang.authlib.minecraft.MinecraftSessionService; +import net.minecraft.client.renderer.texture.TextureManager; +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 Map loadSkinFromCache(GameProfile profile) { return null; } + public CompletableFuture getOrLoad(GameProfile profile) { return null; } + public PlayerSkin getInsecureSkin(GameProfile profile) { 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/Dummy/src/main/java/net/minecraft/client/resources/data/TextureMetadataSection.java b/Dummy/src/main/java/net/minecraft/client/resources/data/TextureMetadataSection.java new file mode 100644 index 00000000..2a60b17f --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/client/resources/data/TextureMetadataSection.java @@ -0,0 +1,5 @@ +package net.minecraft.client.resources.data; + +public class TextureMetadataSection { + +} diff --git a/Common/src/main/java/net/minecraft/resources/IResource.java b/Dummy/src/main/java/net/minecraft/resources/IResource.java similarity index 100% rename from Common/src/main/java/net/minecraft/resources/IResource.java rename to Dummy/src/main/java/net/minecraft/resources/IResource.java diff --git a/Common/src/main/java/net/minecraft/resources/IResourceManager.java b/Dummy/src/main/java/net/minecraft/resources/IResourceManager.java similarity index 100% rename from Common/src/main/java/net/minecraft/resources/IResourceManager.java rename to Dummy/src/main/java/net/minecraft/resources/IResourceManager.java diff --git a/Dummy/src/main/java/net/minecraft/util/ResourceLocation.java b/Dummy/src/main/java/net/minecraft/util/ResourceLocation.java new file mode 100644 index 00000000..7d40c6f8 --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/util/ResourceLocation.java @@ -0,0 +1,6 @@ +package net.minecraft.util; + +public class ResourceLocation { + public ResourceLocation(String path) {} + public ResourceLocation(String domain, String path) {} +} diff --git a/Dummy/src/main/java/net/minecraft/util/StringUtils.java b/Dummy/src/main/java/net/minecraft/util/StringUtils.java new file mode 100644 index 00000000..6db0f733 --- /dev/null +++ b/Dummy/src/main/java/net/minecraft/util/StringUtils.java @@ -0,0 +1,5 @@ +package net.minecraft.util; + +public class StringUtils { + public static String stripControlCodes(String string) { return null; } +} diff --git a/Fabric/Fabric.tsrg b/Fabric/Fabric.tsrg index 7e5998b3..87a904a2 100644 --- a/Fabric/Fabric.tsrg +++ b/Fabric/Fabric.tsrg @@ -32,6 +32,7 @@ net/minecraft/client/renderer/IImageBuffer net/minecraft/class_760 net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/class_1046 net/minecraft/client/renderer/entity/RenderPlayer net/minecraft/class_1007 net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/class_972 +net/minecraft/client/renderer/texture/AbstractTexture net/minecraft/class_1044 net/minecraft/client/renderer/texture/ITextureObject net/minecraft/class_1062 net/minecraft/client/renderer/texture/NativeImage net/minecraft/class_1011 func_195699_a (IIIIIIZZ)V method_4304 @@ -42,16 +43,26 @@ net/minecraft/client/renderer/texture/NativeImage net/minecraft/class_1011 func_195713_a (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; method_4309 func_195714_b ()I method_4323 func_195715_a (IIIII)V method_4326 +net/minecraft/client/renderer/texture/ReloadableTexture net/minecraft/class_10537 +net/minecraft/client/renderer/texture/SkinTextureDownloader net/minecraft/class_10538 + lambda$downloadAndRegisterSkin$0 (Ljava/nio/file/Path;Ljava/lang/String;Z)Lnet/minecraft/client/renderer/texture/NativeImage; method_65866 + processLegacySkin (Lnet/minecraft/client/renderer/texture/NativeImage;Ljava/lang/String;)Lnet/minecraft/client/renderer/texture/NativeImage; method_65863 net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/class_1049 + loadContents (Lnet/minecraft/client/resources/IResourceManager;)Lnet/minecraft/client/renderer/texture/TextureContents; method_65809 +net/minecraft/client/renderer/texture/TextureContents net/minecraft/class_10539 net/minecraft/client/renderer/texture/TextureManager net/minecraft/class_1060 getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; method_4619 loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z method_4616 + registerAndLoad (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ReloadableTexture;)V method_65876 net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/class_1068 getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; method_4648 net/minecraft/client/resources/IResource net/minecraft/class_3298 getInputStream ()Ljava/io/InputStream; method_14482 net/minecraft/client/resources/IResourceManager net/minecraft/class_3300 getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; method_14486 +net/minecraft/client/resources/PlayerSkin net/minecraft/class_8685 +net/minecraft/client/resources/PlayerSkin$Model net/minecraft/class_8685$class_7920 + byName (Ljava/lang/String;)Lnet/minecraft/client/resources/PlayerSkin$Model; method_52857 net/minecraft/client/resources/SkinManager net/minecraft/class_1071 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/util/ResourceLocation; method_4656 @@ -60,6 +71,7 @@ net/minecraft/client/resources/SkinManager$CacheKey net/minecraft/class_1071$cla net/minecraft/client/resources/SkinManager$SkinAvailableCallback net/minecraft/class_1071$class_1072 skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V onSkinTextureAvailable net/minecraft/client/resources/SkinManager$TextureCache net/minecraft/class_1071$class_8687 +net/minecraft/client/resources/data/TextureMetadataSection net/minecraft/class_1084 net/minecraft/resources/IResource net/minecraft/class_3298 net/minecraft/resources/IResourceManager net/minecraft/class_3300 net/minecraft/util/ResourceLocation net/minecraft/class_2960 diff --git a/Fabric/build.gradle b/Fabric/build.gradle index 6a5f4cc2..19112a77 100644 --- a/Fabric/build.gradle +++ b/Fabric/build.gradle @@ -18,6 +18,7 @@ repositories { } dependencies { + implementation project(':Dummy') // This is the minimum version number that the mod should dependent in the development environment. implementation "net.fabricmc:fabric-loader:0.12.0" } diff --git a/Fabric/build.properties b/Fabric/build.properties index 6dc33ae8..3500289c 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;\ - 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 +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;\ + 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 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 aee3c90c..ef014fda 100644 --- a/Fabric/mixin.tsrg +++ b/Fabric/mixin.tsrg @@ -22,14 +22,23 @@ net/minecraft/client/renderer/entity/RenderPlayer net/minecraft/class_1007 net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/class_972 doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFF)V method_4177 doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFFF)V method_4177 + doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/renderer/entity/state/PlayerRenderState;FF)V method_4177 +net/minecraft/client/renderer/entity/state/PlayerRenderState net/minecraft/class_10055 +net/minecraft/client/renderer/texture/AbstractTexture net/minecraft/class_1044 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 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 +net/minecraft/client/resources/PlayerSkin$Model net/minecraft/class_8685$class_7920 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 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 diff --git a/Fabric/src/main/resources/customskinloader.accesswidener b/Fabric/src/main/resources/customskinloader.accesswidener index ca140798..b1c2b367 100644 --- a/Fabric/src/main/resources/customskinloader.accesswidener +++ b/Fabric/src/main/resources/customskinloader.accesswidener @@ -1,2 +1,4 @@ accessWidener v2 intermediary accessible method net/minecraft/class_2960 (Ljava/lang/String;Ljava/lang/String;)V # 24w18a+ +accessible method net/minecraft/class_10538 method_65863 (Lnet/minecraft/class_1011;Ljava/lang/String;)Lnet/minecraft/class_1011; # 24w46a+ +accessible method net/minecraft/class_10538 method_65866 (Ljava/nio/file/Path;Ljava/lang/String;Z)Lnet/minecraft/class_1011; # 24w46a+ diff --git a/Fabric/src/main/resources/mixins.customskinloader.json b/Fabric/src/main/resources/mixins.customskinloader.json index 6c118c33..e0ff762f 100644 --- a/Fabric/src/main/resources/mixins.customskinloader.json +++ b/Fabric/src/main/resources/mixins.customskinloader.json @@ -11,12 +11,17 @@ "MixinMinecraft", "MixinNativeImage", "MixinRenderPlayer", + "MixinResourceLocation", "MixinSkinManager$1", "MixinSkinManager$CacheKey", - "MixinSkinManager$TextureCache", + "MixinSkinManager$TextureCache$V1", + "MixinSkinManager$TextureCache$V2", "MixinSkinManager$V1", "MixinSkinManager$V2", "MixinSkinManager$V3", + "MixinSkinManager$V4", + "MixinSkinManager$V5", + "MixinSkinTextureDownloader", "MixinThreadDownloadImageData$V1", "MixinThreadDownloadImageData$V2" ], diff --git a/Forge/Common/build.gradle b/Forge/Common/build.gradle new file mode 100644 index 00000000..e7056bf8 --- /dev/null +++ b/Forge/Common/build.gradle @@ -0,0 +1,5 @@ +// This subproject is only to provide dependency for other subprojects. + +dependencies { + implementation project(':Dummy') +} diff --git a/Forge/Common/src/main/java/net/minecraftforge/fml/common/asm/transformers/deobf/FMLDeobfuscatingRemapper.java b/Forge/Common/src/main/java/net/minecraftforge/fml/common/asm/transformers/deobf/FMLDeobfuscatingRemapper.java new file mode 100644 index 00000000..4cd5ec71 --- /dev/null +++ b/Forge/Common/src/main/java/net/minecraftforge/fml/common/asm/transformers/deobf/FMLDeobfuscatingRemapper.java @@ -0,0 +1,7 @@ +package net.minecraftforge.fml.common.asm.transformers.deobf; + +import org.objectweb.asm.commons.Remapper; + +public class FMLDeobfuscatingRemapper extends Remapper { + public static FMLDeobfuscatingRemapper INSTANCE; +} diff --git a/Forge/Common/src/main/java/net/minecraftforge/fml/relauncher/CoreModManager.java b/Forge/Common/src/main/java/net/minecraftforge/fml/relauncher/CoreModManager.java new file mode 100644 index 00000000..919b628f --- /dev/null +++ b/Forge/Common/src/main/java/net/minecraftforge/fml/relauncher/CoreModManager.java @@ -0,0 +1,7 @@ +package net.minecraftforge.fml.relauncher; + +import java.util.List; + +public class CoreModManager { + public static List getIgnoredMods() { return null; } +} diff --git a/Forge/Common/src/main/java/net/minecraftforge/fml/relauncher/FMLLaunchHandler.java b/Forge/Common/src/main/java/net/minecraftforge/fml/relauncher/FMLLaunchHandler.java new file mode 100644 index 00000000..f469e6f8 --- /dev/null +++ b/Forge/Common/src/main/java/net/minecraftforge/fml/relauncher/FMLLaunchHandler.java @@ -0,0 +1,5 @@ +package net.minecraftforge.fml.relauncher; + +public class FMLLaunchHandler { + public static Side side() { return null; } +} diff --git a/Forge/Common/src/main/java/net/minecraftforge/fml/relauncher/IFMLLoadingPlugin.java b/Forge/Common/src/main/java/net/minecraftforge/fml/relauncher/IFMLLoadingPlugin.java new file mode 100644 index 00000000..529d68e3 --- /dev/null +++ b/Forge/Common/src/main/java/net/minecraftforge/fml/relauncher/IFMLLoadingPlugin.java @@ -0,0 +1,19 @@ +package net.minecraftforge.fml.relauncher; + +import java.util.Map; + +public interface IFMLLoadingPlugin { + String[] getASMTransformerClass(); + String getModContainerClass(); + String getSetupClass(); + void injectData(Map data); + String getAccessTransformerClass(); + + @interface Name { + String value(); + } + + @interface SortingIndex { + int value(); + } +} diff --git a/Forge/Common/src/main/java/net/minecraftforge/fml/relauncher/Side.java b/Forge/Common/src/main/java/net/minecraftforge/fml/relauncher/Side.java new file mode 100644 index 00000000..a97d1c4c --- /dev/null +++ b/Forge/Common/src/main/java/net/minecraftforge/fml/relauncher/Side.java @@ -0,0 +1,5 @@ +package net.minecraftforge.fml.relauncher; + +public enum Side { + +} diff --git a/Forge/V1/build.gradle b/Forge/V1/build.gradle index 3d8265a4..f428770e 100644 --- a/Forge/V1/build.gradle +++ b/Forge/V1/build.gradle @@ -6,9 +6,6 @@ jar { "TweakOrder": -10 ]) } - - exclude 'net/minecraft/client/resources/SkinManager.class' - exclude 'net/minecraft/client/resources/SkinManager$ISkinAvailableCallback.class' } sourceJar { exclude 'net/**' @@ -20,6 +17,7 @@ tasks.signJar { } dependencies { + implementation project(':Dummy') implementation project(":Forge/Common") } diff --git a/Common/src/main/java/net/minecraft/client/resources/IResource.java b/Forge/V1/src/main/java/net/minecraft/client/resources/IResource.java similarity index 100% rename from Common/src/main/java/net/minecraft/client/resources/IResource.java rename to Forge/V1/src/main/java/net/minecraft/client/resources/IResource.java diff --git a/Common/src/main/java/net/minecraft/client/resources/IResourceManager.java b/Forge/V1/src/main/java/net/minecraft/client/resources/IResourceManager.java similarity index 65% rename from Common/src/main/java/net/minecraft/client/resources/IResourceManager.java rename to Forge/V1/src/main/java/net/minecraft/client/resources/IResourceManager.java index dd198cb3..98b0fb41 100644 --- a/Common/src/main/java/net/minecraft/client/resources/IResourceManager.java +++ b/Forge/V1/src/main/java/net/minecraft/client/resources/IResourceManager.java @@ -1,10 +1,8 @@ package net.minecraft.client.resources; -import java.io.IOException; - import net.minecraft.util.ResourceLocation; // this class shouldn't be created by ASM because of modlauncher issue. public interface IResourceManager { - IResource getResource(ResourceLocation location) throws IOException; + IResource getResource(ResourceLocation location); } diff --git a/Forge/V1/src/main/java/net/minecraft/client/resources/SkinManager$SkinAvailableCallback.java b/Forge/V1/src/main/java/net/minecraft/client/resources/SkinManager$SkinAvailableCallback.java new file mode 100644 index 00000000..bebaea23 --- /dev/null +++ b/Forge/V1/src/main/java/net/minecraft/client/resources/SkinManager$SkinAvailableCallback.java @@ -0,0 +1,15 @@ +package net.minecraft.client.resources; + +import com.mojang.authlib.minecraft.MinecraftProfileTexture; +import net.minecraft.util.ResourceLocation; + +// put into mod jar to prevent https://github.com/cpw/modlauncher/issues/39 +public interface SkinManager$SkinAvailableCallback { + default void skinAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture) { + this.onSkinTextureAvailable(typeIn, location, profileTexture); + } + + default void onSkinTextureAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture) { + ((SkinManager$ISkinAvailableCallback) this).onSkinTextureAvailable(typeIn, location, profileTexture); + } +} diff --git a/Forge/V1/src/main/java/net/minecraft/client/resources/SkinManager.java b/Forge/V1/src/main/java/net/minecraft/client/resources/SkinManager.java deleted file mode 100644 index 2819f8a9..00000000 --- a/Forge/V1/src/main/java/net/minecraft/client/resources/SkinManager.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.minecraft.client.resources; - -import java.io.File; -import java.util.Map; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.minecraft.MinecraftProfileTexture; -import com.mojang.authlib.minecraft.MinecraftSessionService; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.util.ResourceLocation; - -// exclude -public class SkinManager { - public SkinManager(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService) { } - public ResourceLocation loadSkin(MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType) { return null; } - 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 Map loadSkinFromCache(GameProfile profile) { return null; } - - // put into mod jar to prevent https://github.com/cpw/modlauncher/issues/39 - public interface SkinAvailableCallback { - default void skinAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture) { - this.onSkinTextureAvailable(typeIn, location, profileTexture); - } - - default void onSkinTextureAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture) { - ((SkinManager.ISkinAvailableCallback) this).onSkinTextureAvailable(typeIn, location, profileTexture); - } - } - - // exclude - public interface ISkinAvailableCallback { - void onSkinTextureAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture); - } -} diff --git a/Forge/V1/src/main/resources/META-INF/mods.toml b/Forge/V1/src/main/resources/META-INF/mods.toml index 616b55ea..e153a7c2 100644 --- a/Forge/V1/src/main/resources/META-INF/mods.toml +++ b/Forge/V1/src/main/resources/META-INF/mods.toml @@ -10,7 +10,7 @@ description=''' Custom Skin Loader for Minecraft ''' displayURL="https://github.com/xfl03/MCCustomSkinLoader" -authors=["xfl03", "JLChnToZ", "ZekerZhayard"] +authors="xfl03, JLChnToZ, ZekerZhayard" [[dependencies.customskinloader]] modId="forge" mandatory=true diff --git a/Forge/V2/Forge.tsrg b/Forge/V2/Forge.tsrg index 2473b218..da19af19 100644 --- a/Forge/V2/Forge.tsrg +++ b/Forge/V2/Forge.tsrg @@ -32,6 +32,7 @@ net/minecraft/client/renderer/IImageBuffer customskinloader/fake/IFakeImageBuffe net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/client/renderer/texture/HttpTexture net/minecraft/client/renderer/entity/RenderPlayer net/minecraft/client/renderer/entity/player/PlayerRenderer net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/client/renderer/entity/layers/CapeLayer +net/minecraft/client/renderer/texture/AbstractTexture net/minecraft/client/renderer/texture/AbstractTexture net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage func_195699_a (IIIIIIZZ)V m_85025_ @@ -42,16 +43,26 @@ net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/Na func_195713_a (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; m_85058_ func_195714_b ()I m_85084_ func_195715_a (IIIII)V m_84997_ +net/minecraft/client/renderer/texture/ReloadableTexture net/minecraft/client/renderer/texture/ReloadableTexture +net/minecraft/client/renderer/texture/SkinTextureDownloader net/minecraft/client/renderer/texture/SkinTextureDownloader + lambda$downloadAndRegisterSkin$0 (Ljava/nio/file/Path;Ljava/lang/String;Z)Lnet/minecraft/client/renderer/texture/NativeImage; lambda$downloadAndRegisterSkin$0 + processLegacySkin (Lnet/minecraft/client/renderer/texture/NativeImage;Ljava/lang/String;)Lnet/minecraft/client/renderer/texture/NativeImage; processLegacySkin net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/client/renderer/texture/SimpleTexture + loadContents (Lnet/minecraft/client/resources/IResourceManager;)Lnet/minecraft/client/renderer/texture/TextureContents; loadContents +net/minecraft/client/renderer/texture/TextureContents net/minecraft/client/renderer/texture/TextureContents net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/renderer/texture/TextureManager getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; func_110581_b loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z func_110579_a + registerAndLoad (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ReloadableTexture;)V registerAndLoad net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/client/resources/DefaultPlayerSkin getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; m_118627_ net/minecraft/client/resources/IResource net/minecraft/server/packs/resources/Resource getInputStream ()Ljava/io/InputStream; m_6679_ net/minecraft/client/resources/IResourceManager net/minecraft/server/packs/resources/ResourceManager getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; m_142591_ +net/minecraft/client/resources/PlayerSkin net/minecraft/client/resources/PlayerSkin +net/minecraft/client/resources/PlayerSkin$Model net/minecraft/client/resources/PlayerSkin$Model + byName (Ljava/lang/String;)Lnet/minecraft/client/resources/PlayerSkin$Model; byName net/minecraft/client/resources/SkinManager net/minecraft/client/resources/SkinManager loadProfileTextures (Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V m_118817_ loadSkin (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)Lnet/minecraft/util/ResourceLocation; m_118825_ @@ -60,6 +71,7 @@ net/minecraft/client/resources/SkinManager$CacheKey net/minecraft/client/resourc net/minecraft/client/resources/SkinManager$SkinAvailableCallback net/minecraft/client/resources/SkinManager$SkinTextureCallback skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V m_118856_ net/minecraft/client/resources/SkinManager$TextureCache net/minecraft/client/resources/SkinManager$TextureCache +net/minecraft/client/resources/data/TextureMetadataSection net/minecraft/client/resources/metadata/texture/TextureMetadataSection net/minecraft/resources/IResource net/minecraft/server/packs/resources/Resource net/minecraft/resources/IResourceManager net/minecraft/server/packs/resources/ResourceManager net/minecraft/util/ResourceLocation net/minecraft/resources/ResourceLocation diff --git a/Forge/V2/build.gradle b/Forge/V2/build.gradle index 817dfd5f..fec2c337 100644 --- a/Forge/V2/build.gradle +++ b/Forge/V2/build.gradle @@ -14,6 +14,7 @@ sourceJar { } dependencies { + implementation project(':Dummy') implementation project(":Forge/Common") } diff --git a/Forge/V2/src/main/resources/META-INF/mods.toml b/Forge/V2/src/main/resources/META-INF/mods.toml index 1eb0d7d9..9b9165cd 100644 --- a/Forge/V2/src/main/resources/META-INF/mods.toml +++ b/Forge/V2/src/main/resources/META-INF/mods.toml @@ -10,7 +10,7 @@ description=''' Custom Skin Loader for Minecraft ''' displayURL="https://github.com/xfl03/MCCustomSkinLoader" -authors=["xfl03", "JLChnToZ", "ZekerZhayard"] +authors="xfl03, JLChnToZ, ZekerZhayard" [[dependencies.customskinloader]] modId="forge" mandatory=true diff --git a/Forge/V3/Forge.tsrg b/Forge/V3/Forge.tsrg index f336773f..f7987133 100644 --- a/Forge/V3/Forge.tsrg +++ b/Forge/V3/Forge.tsrg @@ -32,6 +32,7 @@ net/minecraft/client/renderer/IImageBuffer customskinloader/fake/IFakeImageBuffe net/minecraft/client/renderer/ThreadDownloadImageData net/minecraft/client/renderer/texture/HttpTexture net/minecraft/client/renderer/entity/RenderPlayer net/minecraft/client/renderer/entity/player/PlayerRenderer net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/client/renderer/entity/layers/CapeLayer +net/minecraft/client/renderer/texture/AbstractTexture net/minecraft/client/renderer/texture/AbstractTexture net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/ITextureObject net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage func_195699_a (IIIIIIZZ)V copyRect @@ -42,16 +43,26 @@ net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/Na func_195713_a (Ljava/io/InputStream;)Lnet/minecraft/client/renderer/texture/NativeImage; read func_195714_b ()I getHeight func_195715_a (IIIII)V fillRect +net/minecraft/client/renderer/texture/ReloadableTexture net/minecraft/client/renderer/texture/ReloadableTexture +net/minecraft/client/renderer/texture/SkinTextureDownloader net/minecraft/client/renderer/texture/SkinTextureDownloader + lambda$downloadAndRegisterSkin$0 (Ljava/nio/file/Path;Ljava/lang/String;Z)Lnet/minecraft/client/renderer/texture/NativeImage; lambda$downloadAndRegisterSkin$0 + processLegacySkin (Lnet/minecraft/client/renderer/texture/NativeImage;Ljava/lang/String;)Lnet/minecraft/client/renderer/texture/NativeImage; processLegacySkin net/minecraft/client/renderer/texture/SimpleTexture net/minecraft/client/renderer/texture/SimpleTexture + loadContents (Lnet/minecraft/client/resources/IResourceManager;)Lnet/minecraft/client/renderer/texture/TextureContents; loadContents +net/minecraft/client/renderer/texture/TextureContents net/minecraft/client/renderer/texture/TextureContents net/minecraft/client/renderer/texture/TextureManager net/minecraft/client/renderer/texture/TextureManager getTexture (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/texture/ITextureObject; getTexture loadTexture (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ITextureObject;)Z register + registerAndLoad (Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/ReloadableTexture;)V registerAndLoad net/minecraft/client/resources/DefaultPlayerSkin net/minecraft/client/resources/DefaultPlayerSkin getDefaultSkin (Ljava/util/UUID;)Lnet/minecraft/util/ResourceLocation; getDefaultSkin net/minecraft/client/resources/IResource net/minecraft/server/packs/resources/Resource getInputStream ()Ljava/io/InputStream; getInputStream net/minecraft/client/resources/IResourceManager net/minecraft/server/packs/resources/ResourceManager getResource (Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/resources/IResource; getResource +net/minecraft/client/resources/PlayerSkin net/minecraft/client/resources/PlayerSkin +net/minecraft/client/resources/PlayerSkin$Model net/minecraft/client/resources/PlayerSkin$Model + byName (Ljava/lang/String;)Lnet/minecraft/client/resources/PlayerSkin$Model; byName net/minecraft/client/resources/SkinManager net/minecraft/client/resources/SkinManager 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/util/ResourceLocation; registerTexture @@ -60,6 +71,7 @@ net/minecraft/client/resources/SkinManager$CacheKey net/minecraft/client/resourc net/minecraft/client/resources/SkinManager$SkinAvailableCallback net/minecraft/client/resources/SkinManager$SkinTextureCallback skinAvailable (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)V onSkinTextureAvailable net/minecraft/client/resources/SkinManager$TextureCache net/minecraft/client/resources/SkinManager$TextureCache +net/minecraft/client/resources/data/TextureMetadataSection net/minecraft/client/resources/metadata/texture/TextureMetadataSection net/minecraft/resources/IResource net/minecraft/server/packs/resources/Resource net/minecraft/resources/IResourceManager net/minecraft/server/packs/resources/ResourceManager net/minecraft/util/ResourceLocation net/minecraft/resources/ResourceLocation diff --git a/Forge/V3/build.gradle b/Forge/V3/build.gradle index 54da7e51..221c88de 100644 --- a/Forge/V3/build.gradle +++ b/Forge/V3/build.gradle @@ -15,6 +15,7 @@ sourceJar { } dependencies { + implementation project(':Dummy') implementation project(":Forge/Common") } diff --git a/Forge/V3/build.properties b/Forge/V3/build.properties index 787aa5fd..bb5aeb85 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;\ - 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 +dependencies=Forge|1.20.6,1.21,1.21.1,1.21.3,1.21.4;\ + 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 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 fbc4fbea..c8223dff 100644 --- a/Forge/V3/mixin.tsrg +++ b/Forge/V3/mixin.tsrg @@ -22,14 +22,23 @@ net/minecraft/client/renderer/entity/RenderPlayer net/minecraft/client/renderer/ net/minecraft/client/renderer/entity/layers/LayerCape net/minecraft/client/renderer/entity/layers/CapeLayer doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFF)V render doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFFF)V render + doRenderLayer (Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/renderer/entity/state/PlayerRenderState;FF)V render +net/minecraft/client/renderer/entity/state/PlayerRenderState net/minecraft/client/renderer/entity/state/PlayerRenderState +net/minecraft/client/renderer/texture/AbstractTexture net/minecraft/client/renderer/texture/AbstractTexture net/minecraft/client/renderer/texture/NativeImage com/mojang/blaze3d/platform/NativeImage +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 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 +net/minecraft/client/resources/PlayerSkin$Model net/minecraft/client/resources/PlayerSkin$Model net/minecraft/client/resources/SkinManager net/minecraft/client/resources/SkinManager 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 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 diff --git a/Forge/V3/src/main/java/customskinloader/forge/MixinConfigPlugin.java b/Forge/V3/src/main/java/customskinloader/forge/MixinConfigPlugin.java index 8ce51f05..e3d5224d 100644 --- a/Forge/V3/src/main/java/customskinloader/forge/MixinConfigPlugin.java +++ b/Forge/V3/src/main/java/customskinloader/forge/MixinConfigPlugin.java @@ -6,6 +6,7 @@ import java.lang.module.ModuleReference; import java.lang.module.ResolvedModule; import java.lang.reflect.Field; +import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.nio.file.Files; @@ -19,16 +20,21 @@ import com.google.common.collect.ImmutableList; import cpw.mods.cl.JarModuleFinder; import cpw.mods.jarhandling.SecureJar; -import sun.misc.Unsafe; public class MixinConfigPlugin extends customskinloader.mixin.core.MixinConfigPlugin { private final static MethodHandles.Lookup IMPL_LOOKUP = ((Supplier) () -> { try { - Field theUnsafeField = Unsafe.class.getDeclaredField("theUnsafe"); + Class unsafeClass = Class.forName("sun.misc.Unsafe"); + Field theUnsafeField = unsafeClass.getDeclaredField("theUnsafe"); theUnsafeField.setAccessible(true); - Unsafe theUnsafe = (Unsafe) theUnsafeField.get(null); + Object theUnsafe = theUnsafeField.get(null); + + Method getObjectMethod = unsafeClass.getMethod("getObject", Object.class, long.class); + Method staticFieldBaseMethod = unsafeClass.getMethod("staticFieldBase", Field.class); + Method staticFieldOffsetMethod = unsafeClass.getMethod("staticFieldOffset", Field.class); + Field implLookupField = MethodHandles.Lookup.class.getDeclaredField("IMPL_LOOKUP"); - return (MethodHandles.Lookup) theUnsafe.getObject(theUnsafe.staticFieldBase(implLookupField), theUnsafe.staticFieldOffset(implLookupField)); + return (MethodHandles.Lookup) getObjectMethod.invoke(theUnsafe, staticFieldBaseMethod.invoke(theUnsafe, implLookupField), staticFieldOffsetMethod.invoke(theUnsafe, implLookupField)); } catch (Throwable t) { throw new RuntimeException(t); } diff --git a/Forge/V3/src/main/resources/META-INF/accesstransformer.cfg b/Forge/V3/src/main/resources/META-INF/accesstransformer.cfg index 8e360011..31a8be0e 100644 --- a/Forge/V3/src/main/resources/META-INF/accesstransformer.cfg +++ b/Forge/V3/src/main/resources/META-INF/accesstransformer.cfg @@ -1 +1,3 @@ public net.minecraft.resources.ResourceLocation (Ljava/lang/String;Ljava/lang/String;)V # 24w18a+ +public net.minecraft.client.renderer.texture.SkinTextureDownloader processLegacySkin(Lcom/mojang/blaze3d/platform/NativeImage;Ljava/lang/String;)Lcom/mojang/blaze3d/platform/NativeImage; # 24w46a+ +public net.minecraft.client.renderer.texture.SkinTextureDownloader lambda$downloadAndRegisterSkin$0(Ljava/nio/file/Path;Ljava/lang/String;Z)Lcom/mojang/blaze3d/platform/NativeImage; # 24w46a+ diff --git a/Forge/V3/src/main/resources/META-INF/mods.toml b/Forge/V3/src/main/resources/META-INF/mods.toml index 09d4054e..21051d74 100644 --- a/Forge/V3/src/main/resources/META-INF/mods.toml +++ b/Forge/V3/src/main/resources/META-INF/mods.toml @@ -12,7 +12,7 @@ description=''' Custom Skin Loader for Minecraft ''' displayURL="https://github.com/xfl03/MCCustomSkinLoader" -authors=["xfl03", "JLChnToZ", "ZekerZhayard"] +authors="xfl03, JLChnToZ, ZekerZhayard" [[dependencies.customskinloader]] modId="forge" mandatory=false diff --git a/Forge/V3/src/main/resources/mixins.customskinloader.json b/Forge/V3/src/main/resources/mixins.customskinloader.json index 19c9a78b..9ff2da5c 100644 --- a/Forge/V3/src/main/resources/mixins.customskinloader.json +++ b/Forge/V3/src/main/resources/mixins.customskinloader.json @@ -10,11 +10,16 @@ "MixinMinecraft", "MixinNativeImage", "MixinRenderPlayer", + "MixinResourceLocation", "MixinSkinManager$1", "MixinSkinManager$CacheKey", - "MixinSkinManager$TextureCache", + "MixinSkinManager$TextureCache$V1", + "MixinSkinManager$TextureCache$V2", "MixinSkinManager$V2", "MixinSkinManager$V3", + "MixinSkinManager$V4", + "MixinSkinManager$V5", + "MixinSkinTextureDownloader", "MixinThreadDownloadImageData$V2" ], "refmap": "mixins.customskinloader.refmap.json", diff --git a/Vanilla/Common/build.gradle b/Vanilla/Common/build.gradle index 6a2f439b..2afe3d42 100644 --- a/Vanilla/Common/build.gradle +++ b/Vanilla/Common/build.gradle @@ -2,6 +2,7 @@ dependencies { implementation project(':Common') + implementation project(':Dummy') implementation 'org.spongepowered:mixin:0.8.5' } diff --git a/Vanilla/Common/src/main/java/customskinloader/mixin/MixinLayerCape.java b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinLayerCape.java index 407eab39..4cfa161c 100644 --- a/Vanilla/Common/src/main/java/customskinloader/mixin/MixinLayerCape.java +++ b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinLayerCape.java @@ -15,8 +15,9 @@ public abstract class MixinLayerCape { @Redirect( method = { - "Lnet/minecraft/client/renderer/entity/layers/LayerCape;doRenderLayer(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFFF)V", // 19w39a~19w44a - "Lnet/minecraft/client/renderer/entity/layers/LayerCape;doRenderLayer(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFF)V" // 19w45a+ + "Lnet/minecraft/client/renderer/entity/layers/LayerCape;doRenderLayer(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFFF)V", // 19w39a ~ 19w44a + "Lnet/minecraft/client/renderer/entity/layers/LayerCape;doRenderLayer(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/AbstractClientPlayer;FFFFFF)V", // 19w45a ~ 1.21.1 + "Lnet/minecraft/client/renderer/entity/layers/LayerCape;doRenderLayer(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/renderer/entity/state/PlayerRenderState;FF)V" // 24w33a+ }, at = @At( value = "INVOKE", diff --git a/Vanilla/Common/src/main/java/customskinloader/mixin/MixinResourceLocation.java b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinResourceLocation.java new file mode 100644 index 00000000..9bed8faf --- /dev/null +++ b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinResourceLocation.java @@ -0,0 +1,22 @@ +package customskinloader.mixin; + +import customskinloader.fake.itf.IFakeResourceLocation; +import net.minecraft.util.ResourceLocation; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +@Mixin(ResourceLocation.class) +public abstract class MixinResourceLocation implements IFakeResourceLocation { + @Unique + private Object customskinloader$texture; + + @Override + public Object customskinloader$getTexture() { + return this.customskinloader$texture; + } + + @Override + public void customskinloader$setTexture(Object texture) { + this.customskinloader$texture = texture; + } +} diff --git a/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinManager$1.java b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinManager$1.java index b269fe12..4c71cc10 100644 --- a/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinManager$1.java +++ b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinManager$1.java @@ -8,8 +8,8 @@ import com.mojang.authlib.minecraft.MinecraftSessionService; import com.mojang.authlib.properties.Property; import customskinloader.fake.FakeSkinManager; -import net.minecraft.client.resources.SkinManager; import net.minecraft.client.resources.SkinManager$1; +import net.minecraft.client.resources.SkinManager$CacheKey; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Coerce; @@ -28,7 +28,7 @@ public abstract class MixinSkinManager$1 { remap = false ) ) - private void modifyArgs_load(Args args, SkinManager.CacheKey cacheKey) { + private void modifyArgs_load(Args args, SkinManager$CacheKey cacheKey) { Object[] argsArr = new Object[args.size()]; for (int i = 0; i < argsArr.length; i++) { argsArr[i] = args.get(i); diff --git a/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinManager$CacheKey.java b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinManager$CacheKey.java index 3fa7a39f..0b282dff 100644 --- a/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinManager$CacheKey.java +++ b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinManager$CacheKey.java @@ -1,10 +1,10 @@ package customskinloader.mixin; import customskinloader.fake.itf.IFakeSkinManagerCacheKey; -import net.minecraft.client.resources.SkinManager; +import net.minecraft.client.resources.SkinManager$CacheKey; import org.spongepowered.asm.mixin.Mixin; -@Mixin(SkinManager.CacheKey.class) +@Mixin(SkinManager$CacheKey.class) public abstract class MixinSkinManager$CacheKey implements IFakeSkinManagerCacheKey { } diff --git a/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinManager$TextureCache.java b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinManager$TextureCache.java index 4a9abdb6..26baa21c 100644 --- a/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinManager$TextureCache.java +++ b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinManager$TextureCache.java @@ -3,31 +3,57 @@ import com.google.common.collect.ImmutableList; import com.mojang.authlib.minecraft.MinecraftProfileTexture; import customskinloader.fake.FakeSkinManager; -import net.minecraft.client.resources.SkinManager; +import net.minecraft.client.resources.SkinManager$TextureCache; 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.ModifyArgs; import org.spongepowered.asm.mixin.injection.invoke.arg.Args; -@Mixin(SkinManager.TextureCache.class) public abstract class MixinSkinManager$TextureCache { - @Shadow - private MinecraftProfileTexture.Type type; + // 23w31a ~ 24w45a + @Mixin(SkinManager$TextureCache.class) + public abstract static class V1 { + @Shadow + private MinecraftProfileTexture.Type type; - @ModifyArgs( - method = "Lnet/minecraft/client/resources/SkinManager$TextureCache;registerTexture(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture;", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/renderer/ThreadDownloadImageData;(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/util/ResourceLocation;ZLjava/lang/Runnable;)V" + @ModifyArgs( + method = "Lnet/minecraft/client/resources/SkinManager$TextureCache;registerTexture(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture;", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/renderer/ThreadDownloadImageData;(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/util/ResourceLocation;ZLjava/lang/Runnable;)V" + ) ) - ) - private void modifyArgs_registerTexture(Args args, MinecraftProfileTexture profileTexture) { - Object[] argsArr = new Object[args.size()]; - for (int i = 0; i < argsArr.length; i++) { - argsArr[i] = args.get(i); + private void modifyArgs_registerTexture(Args args, MinecraftProfileTexture profileTexture) { + Object[] argsArr = new Object[args.size()]; + for (int i = 0; i < argsArr.length; i++) { + argsArr[i] = args.get(i); + } + argsArr = FakeSkinManager.createThreadDownloadImageData(ImmutableList.copyOf(argsArr), profileTexture, this.type); + args.setAll(argsArr); + } + } + + // 23w46a+ + @Mixin(SkinManager$TextureCache.class) + public abstract static class V2 { + @Shadow + private MinecraftProfileTexture.Type type; + + @ModifyArgs( + method = "Lnet/minecraft/client/resources/SkinManager$TextureCache;registerTexture(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture;", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/renderer/texture/SkinTextureDownloader;downloadAndRegisterSkin(Lnet/minecraft/util/ResourceLocation;Ljava/nio/file/Path;Ljava/lang/String;Z)Ljava/util/concurrent/CompletableFuture;" + ) + ) + private void modifyArgs_registerTexture(Args args, MinecraftProfileTexture profileTexture) { + Object[] argsArr = new Object[args.size()]; + for (int i = 0; i < argsArr.length; i++) { + argsArr[i] = args.get(i); + } + argsArr = FakeSkinManager.createThreadDownloadImageData(ImmutableList.copyOf(argsArr), profileTexture, this.type); + args.setAll(argsArr); } - argsArr = FakeSkinManager.createThreadDownloadImageData(ImmutableList.copyOf(argsArr), profileTexture, this.type); - args.setAll(argsArr); } } diff --git a/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinManager.java b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinManager.java index ab9f5055..430ad095 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 @@ import java.io.File; import java.nio.file.Path; import java.util.Map; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; @@ -12,17 +13,21 @@ import com.google.common.collect.ImmutableList; import com.mojang.authlib.GameProfile; import com.mojang.authlib.minecraft.MinecraftProfileTexture; +import com.mojang.authlib.minecraft.MinecraftProfileTextures; 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$Model; import net.minecraft.client.resources.SkinManager; +import net.minecraft.client.resources.SkinManager$SkinAvailableCallback; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Group; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.ModifyArgs; +import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @@ -34,8 +39,8 @@ public abstract class MixinSkinManager { @Mixin(SkinManager.class) public abstract static class V1 { @Inject( - method = "Lnet/minecraft/client/resources/SkinManager;(Lnet/minecraft/client/renderer/texture/TextureManager;Ljava/io/File;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)V", - at = @At("RETURN") + method = "Lnet/minecraft/client/resources/SkinManager;(Lnet/minecraft/client/renderer/texture/TextureManager;Ljava/io/File;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)V", + at = @At("RETURN") ) private void inject_init(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService, CallbackInfo callbackInfo) { FakeSkinManager.setSkinCacheDir(skinCacheDirectory); @@ -53,7 +58,7 @@ private void inject_init(TextureManager textureManagerInstance, File skinCacheDi target = "Lnet/minecraft/client/renderer/ThreadDownloadImageData;(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/IImageBuffer;)V" ) ) - private void modifyArgs_loadSkin_0(Args args, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager.SkinAvailableCallback skinAvailableCallback) { + private void modifyArgs_loadSkin_0(Args args, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager$SkinAvailableCallback skinAvailableCallback) { Object[] argsArr = new Object[args.size()]; for (int i = 0; i < argsArr.length; i++) { argsArr[i] = args.get(i); @@ -74,7 +79,7 @@ private void modifyArgs_loadSkin_0(Args args, MinecraftProfileTexture profileTex target = "Lnet/minecraft/client/renderer/ThreadDownloadImageData;(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/util/ResourceLocation;ZLjava/lang/Runnable;)V" ) ) - private void modifyArgs_loadSkin_1(Args args, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager.SkinAvailableCallback skinAvailableCallback) { + private void modifyArgs_loadSkin_1(Args args, MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType, SkinManager$SkinAvailableCallback skinAvailableCallback) { this.modifyArgs_loadSkin_0(args, profileTexture, textureType, skinAvailableCallback); } @@ -91,7 +96,7 @@ private void modifyArgs_loadSkin_1(Args args, MinecraftProfileTexture profileTex remap = false ) ) - private Future redirect_loadProfileTextures_0(ExecutorService executor, Runnable task, GameProfile profile, SkinManager.SkinAvailableCallback skinAvailableCallback, boolean requireSecure) { + private Future redirect_loadProfileTextures_0(ExecutorService executor, Runnable task, GameProfile profile, SkinManager$SkinAvailableCallback skinAvailableCallback, boolean requireSecure) { FakeSkinManager.loadProfileTextures(task, profile); return null; } @@ -109,7 +114,7 @@ private Future redirect_loadProfileTextures_0(ExecutorService executor, Runna remap = false ) ) - private void redirect_loadProfileTextures_1(Executor executor, Runnable task, GameProfile profile, SkinManager.SkinAvailableCallback skinAvailableCallback, boolean requireSecure) { + private void redirect_loadProfileTextures_1(Executor executor, Runnable task, GameProfile profile, SkinManager$SkinAvailableCallback skinAvailableCallback, boolean requireSecure) { FakeSkinManager.loadProfileTextures(task, profile); } @@ -126,7 +131,7 @@ private void redirect_loadProfileTextures_1(Executor executor, Runnable task, Ga remap = false ) ) - private void redirect_loadProfileTextures_2(ExecutorService executor, Runnable task, GameProfile profile, SkinManager.SkinAvailableCallback skinAvailableCallback, boolean requireSecure) { + private void redirect_loadProfileTextures_2(ExecutorService executor, Runnable task, GameProfile profile, SkinManager$SkinAvailableCallback skinAvailableCallback, boolean requireSecure) { FakeSkinManager.loadProfileTextures(task, profile); } @@ -165,7 +170,7 @@ private Map redirect_func remap = false ) ) - private void inject_func_210276_a(Map map, SkinManager.SkinAvailableCallback skinAvailableCallback, CallbackInfo callbackInfo) { + private void inject_func_210276_a(Map map, SkinManager$SkinAvailableCallback skinAvailableCallback, CallbackInfo callbackInfo) { FakeSkinManager.loadElytraTexture((SkinManager) (Object) this, map, skinAvailableCallback); } @@ -187,7 +192,7 @@ private ImmutableList redirect_func_229297_b_(Obje } } - // 23w31a+ + // 23w31a ~ 23w45a @Mixin(SkinManager.class) public abstract static class V2 { @Inject( @@ -209,7 +214,11 @@ private void inject_init(TextureManager textureManager, Path path, MinecraftSess private CacheLoader modifyArg_init(CacheLoader cacheLoader) { return FakeSkinManager.setCacheLoader(cacheLoader); } + } + // 23w31a+ + @Mixin(SkinManager.class) + public abstract static class V3 { @Inject( method = "Lnet/minecraft/client/resources/SkinManager;getInsecureSkin(Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/client/resources/PlayerSkin;", at = @At("HEAD") @@ -233,7 +242,7 @@ private Object redirect_getOrLoad(LoadingCache loadingCache, Object cacheK // 23w42a+ @Mixin(SkinManager.class) - public abstract static class V3 { + public abstract static class V4 { @ModifyArg( method = "Lnet/minecraft/client/resources/SkinManager;getOrLoad(Lcom/mojang/authlib/GameProfile;)Ljava/util/concurrent/CompletableFuture;", at = @At( @@ -245,4 +254,37 @@ private Property modifyArg_getOrLoad(Property property) { return FakeSkinManager.createProperty(property); } } + + // 23w46a+ + @Mixin(SkinManager.class) + public abstract static class V5 { + @Inject( + method = "Lnet/minecraft/client/resources/SkinManager;(Ljava/nio/file/Path;Lcom/mojang/authlib/minecraft/MinecraftSessionService;Ljava/util/concurrent/Executor;)V", + at = @At("RETURN") + ) + private void inject_init(Path path, MinecraftSessionService minecraftSessionService, Executor executor, CallbackInfo callbackInfo) { + FakeSkinManager.setSkinCacheDir(path); + } + + @ModifyArg( + method = "Lnet/minecraft/client/resources/SkinManager;(Ljava/nio/file/Path;Lcom/mojang/authlib/minecraft/MinecraftSessionService;Ljava/util/concurrent/Executor;)V", + at = @At( + value = "INVOKE", + target = "Lcom/google/common/cache/CacheBuilder;build(Lcom/google/common/cache/CacheLoader;)Lcom/google/common/cache/LoadingCache;", + remap = false + ) + ) + private CacheLoader modifyArg_init(CacheLoader cacheLoader) { + return FakeSkinManager.setCacheLoader(cacheLoader); + } + + @ModifyVariable( + method = "Lnet/minecraft/client/resources/SkinManager;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;", + at = @At("HEAD"), + argsOnly = true + ) + private static PlayerSkin$Model modifyVariable_lambda$registerTextures$1(PlayerSkin$Model model, CompletableFuture skin, String url, CompletableFuture cape, CompletableFuture elytra, PlayerSkin$Model _model, MinecraftProfileTextures textures) { + return FakeSkinManager.loadSkinModel(model, textures); + } + } } diff --git a/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinTextureDownloader.java b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinTextureDownloader.java new file mode 100644 index 00000000..10713320 --- /dev/null +++ b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinSkinTextureDownloader.java @@ -0,0 +1,26 @@ +package customskinloader.mixin; + +import customskinloader.fake.itf.FakeInterfaceManager; +import net.minecraft.client.renderer.texture.AbstractTexture; +import net.minecraft.client.renderer.texture.ReloadableTexture; +import net.minecraft.client.renderer.texture.SkinTextureDownloader; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.util.ResourceLocation; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(SkinTextureDownloader.class) +@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;", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/renderer/texture/TextureManager;loadTexture(Lnet/minecraft/util/ResourceLocation;Lnet/minecraft/client/renderer/texture/AbstractTexture;)V" + ) + ) + private static void redirect_lambda$registerTextureInManager$2(TextureManager manager, ResourceLocation location, AbstractTexture texture) { + manager.registerAndLoad(location, (ReloadableTexture) FakeInterfaceManager.ResourceLocation_getTexture(location)); + } +} diff --git a/Vanilla/Common/src/main/java/customskinloader/mixin/MixinThreadDownloadImageData.java b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinThreadDownloadImageData.java index d5fb1da2..d2246c62 100644 --- a/Vanilla/Common/src/main/java/customskinloader/mixin/MixinThreadDownloadImageData.java +++ b/Vanilla/Common/src/main/java/customskinloader/mixin/MixinThreadDownloadImageData.java @@ -34,7 +34,7 @@ private NativeImage redirect_loadTexture(NativeImage image) { } } - @Mixin(ThreadDownloadImageData.class) // 1.17-rc2+ + @Mixin(ThreadDownloadImageData.class) // 1.17-rc2 ~ 24w45a public abstract static class V2 { @Final @Shadow 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 c98f2597..204eadf6 100644 --- a/Vanilla/Common/src/main/java/customskinloader/mixin/core/MixinConfigPlugin.java +++ b/Vanilla/Common/src/main/java/customskinloader/mixin/core/MixinConfigPlugin.java @@ -58,14 +58,18 @@ public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { result = this.world_version >= 2210 && this.protocol_version >= 558; // 19w41a+ } else if (mixinClassName.endsWith(".MixinSkinManager$V1")) { result = this.world_version <= 3465 && (this.protocol_version <= 763 || (this.protocol_version >= 801 && this.protocol_version <= 803) || (this.protocol_version >= 0x40000001 && this.protocol_version <= 0x4000008E)); // 18w43b ~ 1.20.1 - } else if (mixinClassName.endsWith(".MixinSkinManager$V2") || mixinClassName.endsWith(".MixinSkinManager$1") || mixinClassName.endsWith(".MixinSkinManager$CacheKey") || mixinClassName.endsWith(".MixinSkinManager$TextureCache")) { + } else if (mixinClassName.endsWith(".MixinSkinManager$V2") || mixinClassName.endsWith(".MixinSkinManager$TextureCache$V1")) { + result = (this.world_version >= 3567 && this.world_version <= 4177) && ((this.protocol_version >= 764 && this.protocol_version <= 768) || (this.protocol_version >= 0x40000090 && this.protocol_version <= 0x400000DD)); // 23w31a ~ 23w45a + } else if (mixinClassName.endsWith(".MixinSkinManager$V3") || mixinClassName.endsWith(".MixinSkinManager$1") || mixinClassName.endsWith(".MixinSkinManager$CacheKey")) { result = this.world_version >= 3567 && ((this.protocol_version >= 764 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x40000090); // 23w31a+ - } else if (mixinClassName.endsWith(".MixinSkinManager$V3")) { - 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$V4")) { + 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(".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")) { - result = this.world_version >= 2723 && ((this.protocol_version >= 755 && this.protocol_version < 801) || (this.protocol_version > 803 && this.protocol_version < 0x40000001) || this.protocol_version >= 0x40000023); // 1.17-rc2+ + result = (this.world_version >= 2723 && this.world_version <= 4177) && ((this.protocol_version >= 755 && this.protocol_version <= 768) || (this.protocol_version >= 0x40000023 && this.protocol_version <= 0x400000DD)); // 1.17-rc2 ~ 23w45a } logger.info("target: " + targetClassName + ", mixin: " + mixinClassName + ", result: " + result); return result; diff --git a/Vanilla/Common/src/main/java/net/minecraft/client/resources/SkinManager.java b/Vanilla/Common/src/main/java/net/minecraft/client/resources/SkinManager.java deleted file mode 100644 index 3157d6f2..00000000 --- a/Vanilla/Common/src/main/java/net/minecraft/client/resources/SkinManager.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.minecraft.client.resources; - -import java.io.File; -import java.util.Map; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.minecraft.MinecraftProfileTexture; -import com.mojang.authlib.minecraft.MinecraftSessionService; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.util.ResourceLocation; - -public class SkinManager { - public SkinManager(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService) { } - public ResourceLocation loadSkin(MinecraftProfileTexture profileTexture, MinecraftProfileTexture.Type textureType) { return null; } - public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final MinecraftProfileTexture.Type textureType, final SkinAvailableCallback skinAvailableCallback) { return null; } - public void loadProfileTextures(final GameProfile profile, final SkinAvailableCallback skinAvailableCallback, final boolean requireSecure) { } - public Map loadSkinFromCache(GameProfile profile) { return null; } - - public interface SkinAvailableCallback { - void skinAvailable(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture); - } - - public static class TextureCache { - - } - - public static class CacheKey { - public GameProfile profile() { - return null; - } - } -} diff --git a/build.gradle b/build.gradle index d07f449e..18525e8e 100644 --- a/build.gradle +++ b/build.gradle @@ -44,6 +44,16 @@ subprojects { replace '@MOD_FULL_VERSION@', project.version replace '@MOD_BUILD_NUMBER@', VersionUtil.getBuildNum() replaceIn 'CustomSkinLoader.java' + + makeObfSourceJar = false + } + + if (project.name != "Dummy") { + configurations { + configureEach { + exclude module: "forgeSrc" + } + } } jar { @@ -65,7 +75,7 @@ subprojects { archivesBaseName = "CustomSkinLoader_${-> VersionUtil.getEdition(project)}" processResources { - filesNotMatching(["**/*.js", "mixins.*.json"]) { + filesNotMatching(["**/*.js", "**/accesstransformer.cfg", "mixins.*.json"]) { expand([ modVersion : rootProject.ext.config.version, modFullVersion : project.version, diff --git a/build.properties b/build.properties index 660a99b4..f7bba871 100644 --- a/build.properties +++ b/build.properties @@ -1,3 +1,3 @@ name=CustomSkinLoader group=customskinloader -version=14.21.2 +version=14.21.3 diff --git a/buildSrc/src/main/java/customskinloader/gradle/util/RemapUtil.java b/buildSrc/src/main/java/customskinloader/gradle/util/RemapUtil.java index d1fafb3a..76838593 100644 --- a/buildSrc/src/main/java/customskinloader/gradle/util/RemapUtil.java +++ b/buildSrc/src/main/java/customskinloader/gradle/util/RemapUtil.java @@ -9,6 +9,7 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; +import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.Set; @@ -22,6 +23,8 @@ import org.cadixdev.lorenz.io.srg.SrgWriter; import org.cadixdev.lorenz.io.srg.tsrg.TSrgReader; import org.cadixdev.lorenz.model.ClassMapping; +import org.cadixdev.lorenz.model.FieldMapping; +import org.cadixdev.lorenz.model.MethodMapping; import org.cadixdev.mercury.Mercury; import org.cadixdev.mercury.remapper.MercuryRemapper; import org.gradle.api.Project; @@ -105,26 +108,37 @@ public static String fixClassName(String name) { } public static class SrgWriterWithoutFilter extends SrgWriter { - private final static Field classesField; - - static { - try { - classesField = SrgWriter.class.getDeclaredField("classes"); - classesField.setAccessible(true); - } catch (Exception e) { - throw new RuntimeException(e); - } - } + private final List classes = new ArrayList<>(); + private final List fields = new ArrayList<>(); + private final List methods = new ArrayList<>(); public SrgWriterWithoutFilter(Writer writer) { super(writer); } + @Override + public void write(final MappingSet mappings) { + // Write class mappings + mappings.getTopLevelClassMappings().stream() + .sorted(this.getConfig().getClassMappingComparator()) + .forEach(this::writeClassMapping); + + // Write everything to the print writer + this.classes.forEach(this.writer::println); + this.fields.forEach(this.writer::println); + this.methods.forEach(this.writer::println); + + // Clear out the lists, to ensure that mappings aren't written twice (or more) + this.classes.clear(); + this.fields.clear(); + this.methods.clear(); + } + @Override protected void writeClassMapping(ClassMapping mapping) { // Write class mappings without checking try { - ((List) classesField.get(this)).add(String.format("CL: %s %s", mapping.getFullObfuscatedName(), mapping.getFullDeobfuscatedName())); + this.classes.add(String.format("CL: %s %s", mapping.getFullObfuscatedName(), mapping.getFullDeobfuscatedName())); } catch (Exception e) { throw new RuntimeException(e); } @@ -144,5 +158,17 @@ protected void writeClassMapping(ClassMapping mapping) { .sorted(this.getConfig().getMethodMappingComparator()) .forEach(this::writeMethodMapping); } + + @Override + protected void writeFieldMapping(final FieldMapping mapping) { + this.fields.add(String.format("FD: %s %s", mapping.getFullObfuscatedName(), mapping.getFullDeobfuscatedName())); + } + + @Override + protected void writeMethodMapping(final MethodMapping mapping) { + this.methods.add(String.format("MD: %s %s %s %s", + mapping.getFullObfuscatedName(), mapping.getObfuscatedDescriptor(), + mapping.getFullDeobfuscatedName(), mapping.getDeobfuscatedDescriptor())); + } } } diff --git a/settings.gradle b/settings.gradle index baaa7402..d6ee6c8c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,6 +2,7 @@ rootProject.name = "MCCustomSkinLoader" //Base Project include "Common" +include "Dummy" //Vanilla Base Project include "Vanilla/Common"