diff --git a/1.14/1.14.srg b/1.14/1.14.srg index 6cabea3..f01cbdd 100644 --- a/1.14/1.14.srg +++ b/1.14/1.14.srg @@ -495,3 +495,4 @@ MD: net/minecraft/client/resources/SkinManager/func_210275_a (Lcom/mojang/authli MD: net/minecraft/client/resources/SkinManager/func_152792_a (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)Lnet/minecraft/util/ResourceLocation; duy/a (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;)Lqs; MD: net/minecraft/client/resources/SkinManager/func_152789_a (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation; duy/a (Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lduy$a;)Lqs; MD: net/minecraft/client/resources/SkinManager/func_210276_a (Ljava/util/Map;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)V duy/a (Ljava/util/Map;Lduy$a;)V +MD: net/minecraft/client/Minecraft/addScheduledTask (Ljava/lang/Runnable;)V cvi/execute (Ljava/lang/Runnable;)V diff --git a/1.14/source/net/minecraft/client/Minecraft.java b/1.14/source/net/minecraft/client/Minecraft.java new file mode 100644 index 0000000..0449b00 --- /dev/null +++ b/1.14/source/net/minecraft/client/Minecraft.java @@ -0,0 +1,40 @@ +package net.minecraft.client; + +import com.mojang.authlib.minecraft.MinecraftSessionService; +import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.resources.SkinManager; +import net.minecraft.util.Session; + +import java.io.File; + +public class Minecraft { + public File gameDir = null; + + public static Minecraft getMinecraft() { + return null; + } + + public SkinManager getSkinManager() { + return null; + } + + public TextureManager getTextureManager() { + return null; + } + + public MinecraftSessionService getSessionService() { + return null; + } + + public Session getSession() { + return null; + } + + public ServerData getCurrentServerData() { + return null; + } + + public void addScheduledTask(Runnable r) { + } +} diff --git a/Common/source/customskinloader/fake/FakeSkinManager.java b/Common/source/customskinloader/fake/FakeSkinManager.java index 6af5b76..8bbe86f 100644 --- a/Common/source/customskinloader/fake/FakeSkinManager.java +++ b/Common/source/customskinloader/fake/FakeSkinManager.java @@ -27,85 +27,100 @@ import net.minecraft.client.resources.DefaultPlayerSkin; import net.minecraft.client.resources.SkinManager.SkinAvailableCallback; import net.minecraft.util.ResourceLocation; -public class FakeSkinManager{ +public class FakeSkinManager { private static final ExecutorService THREAD_POOL = new ThreadPoolExecutor(0, 2, 1L, TimeUnit.MINUTES, new LinkedBlockingQueue()); private final TextureManager textureManager; public FakeSkinManager(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService) { - this.textureManager=textureManagerInstance; - HttpTextureUtil.defaultCacheDir=skinCacheDirectory; + this.textureManager = textureManagerInstance; + HttpTextureUtil.defaultCacheDir = skinCacheDirectory; } - - public ResourceLocation loadSkin(MinecraftProfileTexture profileTexture, Type textureType){ + + public ResourceLocation loadSkin(MinecraftProfileTexture profileTexture, Type textureType) { return this.loadSkin(profileTexture, textureType, null); } - public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final Type textureType, final SkinAvailableCallback skinAvailableCallback){ - HttpTextureInfo info=HttpTextureUtil.toHttpTextureInfo(profileTexture.getUrl()); - + + public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final Type textureType, final SkinAvailableCallback skinAvailableCallback) { + org.apache.logging.log4j.LogManager.getLogger().warn("loadSkin"); + HttpTextureInfo info = HttpTextureUtil.toHttpTextureInfo(profileTexture.getUrl()); + final ResourceLocation resourcelocation = new ResourceLocation("skins/" + info.hash); ITextureObject itextureobject = this.textureManager.getTexture(resourcelocation); if (itextureobject != null)//Have already loaded - makeCallback(skinAvailableCallback,textureType, resourcelocation, profileTexture); - else{ + makeCallback(skinAvailableCallback, textureType, resourcelocation, profileTexture); + else { ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(info.cacheFile, info.url, DefaultPlayerSkin.getDefaultSkinLegacy(), - new BaseBuffer(skinAvailableCallback, textureType, resourcelocation, profileTexture)); - if(skinAvailableCallback instanceof FakeClientPlayer.LegacyBuffer)//Cache for client player - FakeClientPlayer.textureCache.put(resourcelocation,threaddownloadimagedata); + new BaseBuffer(skinAvailableCallback, textureType, resourcelocation, profileTexture)); + if (skinAvailableCallback instanceof FakeClientPlayer.LegacyBuffer)//Cache for client player + FakeClientPlayer.textureCache.put(resourcelocation, threaddownloadimagedata); this.textureManager.loadTexture(resourcelocation, threaddownloadimagedata); } return resourcelocation; } - public void loadProfileTextures(final GameProfile profile, final SkinAvailableCallback skinAvailableCallback, final boolean requireSecure){ - THREAD_POOL.submit(new Runnable(){ - public void run(){ + + public void loadProfileTextures(final GameProfile profile, final SkinAvailableCallback skinAvailableCallback, final boolean requireSecure) { + THREAD_POOL.submit(new Runnable() { + public void run() { final Map map = Maps.newHashMap(); map.putAll(customskinloader.CustomSkinLoader.loadProfile(profile)); - Minecraft.getMinecraft().addScheduledTask(new Runnable(){ - public void run(){ - for(Type type:Type.values()) - if(map.containsKey(type)) + org.apache.logging.log4j.LogManager.getLogger().warn("Map size: " + map.size()); + Minecraft.getMinecraft().addScheduledTask(new Runnable() { + public void run() { + for (Type type : Type.values()) { + if (map.containsKey(type)) { + org.apache.logging.log4j.LogManager.getLogger().warn("Loading type:" + type); FakeSkinManager.this.loadSkin(map.get(type), type, skinAvailableCallback); + } + } } }); } }); } - public Map loadSkinFromCache(GameProfile profile){ + + public Map loadSkinFromCache(GameProfile profile) { return CustomSkinLoader.loadProfileFromCache(profile); } - - private static void makeCallback(SkinAvailableCallback callback,Type type, ResourceLocation location, MinecraftProfileTexture texture){ - if(callback!=null) + + private static void makeCallback(SkinAvailableCallback callback, Type type, ResourceLocation location, MinecraftProfileTexture texture) { + org.apache.logging.log4j.LogManager.getLogger().warn("makeCallback"); + if (callback != null) callback.skinAvailable(type, location, texture); } - private class BaseBuffer implements IImageBuffer{ + + private class BaseBuffer implements IImageBuffer { private IImageBuffer buffer; - + private SkinAvailableCallback callback; private Type type; private ResourceLocation location; private MinecraftProfileTexture texture; - public BaseBuffer(SkinAvailableCallback callback,Type type,ResourceLocation location,MinecraftProfileTexture texture){ - this.buffer=(type==Type.SKIN?new FakeSkinBuffer():null); - - this.callback=callback; - this.type=type; - this.location=location; - this.texture=texture; + + public BaseBuffer(SkinAvailableCallback callback, Type type, ResourceLocation location, MinecraftProfileTexture texture) { + this.buffer = (type == Type.SKIN ? new FakeSkinBuffer() : null); + + this.callback = callback; + this.type = type; + this.location = location; + this.texture = texture; } - public net.minecraft.client.renderer.texture.NativeImage func_195786_a(net.minecraft.client.renderer.texture.NativeImage image){ + public net.minecraft.client.renderer.texture.NativeImage func_195786_a(net.minecraft.client.renderer.texture.NativeImage image) { + org.apache.logging.log4j.LogManager.getLogger().warn("func_195786_a"); return buffer instanceof FakeSkinBuffer ? ((FakeSkinBuffer) buffer).func_195786_a(image) : image; } - public BufferedImage parseUserSkin(BufferedImage image){ - return buffer==null?image:buffer.parseUserSkin(image); + + public BufferedImage parseUserSkin(BufferedImage image) { + return buffer == null ? image : buffer.parseUserSkin(image); } - public void skinAvailable(){ - if (buffer != null){ + + public void skinAvailable() { + org.apache.logging.log4j.LogManager.getLogger().warn("skinAvailable"); + if (buffer != null) { buffer.skinAvailable(); - if ("auto".equals(texture.getMetadata("model")) && buffer instanceof FakeSkinBuffer){ + if ("auto".equals(texture.getMetadata("model")) && buffer instanceof FakeSkinBuffer) { //Auto judge skin type Map metadata = Maps.newHashMap(); metadata.put("model", ((FakeSkinBuffer) buffer).judgeType()); @@ -113,7 +128,7 @@ public class FakeSkinManager{ } } - FakeSkinManager.makeCallback(callback,type, location, texture); + FakeSkinManager.makeCallback(callback, type, location, texture); } } } diff --git a/common.gradle b/common.gradle index 4582322..795fc22 100644 --- a/common.gradle +++ b/common.gradle @@ -50,6 +50,7 @@ jar { attributes 'TweakOrder' : '-10' } exclude 'net/minecraft/client/renderer/texture/NativeImage.class' + exclude 'net/minecraft/client/Minecraft.class' } sourceSets { @@ -59,6 +60,8 @@ sourceSets { srcDir '../Common/source' //Vanilla srcDir '../Vanilla' + //Special + srcDir 'source' } resources { //Common @@ -79,17 +82,6 @@ processResources { buildUrl : System.getenv("CIRCLE_BUILD_URL") ]) } -task copyResources { - doLast { - def outputFile = file("src/main/resources") - outputFile.deleteDir() - copy { - from '../Common/resource' - into 'src/main/resources' - } - } -} -processResources.dependsOn copyResources apply from: rootProject.file("BuildScripts/remap.gradle") task afterBuild {