diff --git a/1.9-mcp924-beta1/src/minecraft/net/minecraft/client/resources/SkinManager.java b/1.9-mcp924-beta1/src/minecraft/net/minecraft/client/resources/SkinManager.java index f21a424..daa25e8 100644 --- a/1.9-mcp924-beta1/src/minecraft/net/minecraft/client/resources/SkinManager.java +++ b/1.9-mcp924-beta1/src/minecraft/net/minecraft/client/resources/SkinManager.java @@ -122,7 +122,7 @@ public class SkinManager ; } - /* + /* if (map.isEmpty() && profile.getId().equals(Minecraft.getMinecraft().getSession().getProfile().getId())) { profile.getProperties().clear(); @@ -132,11 +132,11 @@ public class SkinManager //CustomSkinLoader Begin (User Skin/Cape Part) if(customskinloader.CustomSkinLoader.config.enable){ - Map newMap=customskinloader.CustomSkinLoader.loadProfile(profile.getName(), map); - if(!newMap.isEmpty()){ - map.clear(); - map.putAll(newMap); - } + Map newMap=customskinloader.CustomSkinLoader.loadProfile(profile.getName(), map); + if(!newMap.isEmpty()){ + map.clear(); + map.putAll(newMap); + } } //CustomSkinLoader End Minecraft.getMinecraft().addScheduledTask(new Runnable() @@ -160,12 +160,12 @@ public class SkinManager public Map loadSkinFromCache(GameProfile profile) { - //CustomSkinLoader Begin (Skull Part) - //return (Map)this.skinCacheLoader.getUnchecked(profile); - return (customskinloader.CustomSkinLoader.config.enable && customskinloader.CustomSkinLoader.config.enableSkull)? - customskinloader.CustomSkinLoader.loadProfileFromCache(profile.getName(),this.skinCacheLoader.getUnchecked(profile)): - this.skinCacheLoader.getUnchecked(profile); - //CustomSkinLoader End + //CustomSkinLoader Begin (Skull Part) + //return (Map)this.skinCacheLoader.getUnchecked(profile); + return (customskinloader.CustomSkinLoader.config.enable && customskinloader.CustomSkinLoader.config.enableSkull)? + customskinloader.CustomSkinLoader.loadProfileFromCache(profile.getName(),this.skinCacheLoader.getUnchecked(profile)): + this.skinCacheLoader.getUnchecked(profile); + //CustomSkinLoader End } public interface SkinAvailableCallback diff --git a/1.9.4-mcp924-beta1/src/minecraft/net/minecraft/client/renderer/ImageBufferDownload.java b/1.9.4-mcp924-beta1/src/minecraft/net/minecraft/client/renderer/ImageBufferDownload.java new file mode 100644 index 0000000..18c0a08 --- /dev/null +++ b/1.9.4-mcp924-beta1/src/minecraft/net/minecraft/client/renderer/ImageBufferDownload.java @@ -0,0 +1,109 @@ +package net.minecraft.client.renderer; + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.image.BufferedImage; +import java.awt.image.DataBufferInt; +import java.awt.image.ImageObserver; + +public class ImageBufferDownload implements IImageBuffer +{ + private int[] imageData; + private int imageWidth; + private int imageHeight; + + public BufferedImage parseUserSkin(BufferedImage image) + { + if (image == null) + { + return null; + } + else + { + int ratio = image.getWidth() / 64; + this.imageWidth = 64 * ratio; + this.imageHeight = 64 * ratio; + BufferedImage bufferedimage = new BufferedImage(this.imageWidth, this.imageHeight, 2); + Graphics graphics = bufferedimage.getGraphics(); + graphics.drawImage(image, 0, 0, (ImageObserver)null); + boolean flag = image.getHeight() == 32 * ratio; + + if (flag) + { + if(!customskinloader.CustomSkinLoader.config.enableTransparentSkin){ + graphics.setColor(new Color(0, 0, 0, 0)); + graphics.fillRect(0, 32 * ratio, 64 * ratio, 32 * ratio); + } + graphics.drawImage(bufferedimage, 24 * ratio, 48 * ratio, 20 * ratio, 52 * ratio, 4 * ratio, 16 * ratio, 8 * ratio, 20 * ratio, (ImageObserver)null); + graphics.drawImage(bufferedimage, 28 * ratio, 48 * ratio, 24 * ratio, 52 * ratio, 8 * ratio, 16 * ratio, 12 * ratio, 20 * ratio, (ImageObserver)null); + graphics.drawImage(bufferedimage, 20 * ratio, 52 * ratio, 16 * ratio, 64 * ratio, 8 * ratio, 20 * ratio, 12 * ratio, 32 * ratio, (ImageObserver)null); + graphics.drawImage(bufferedimage, 24 * ratio, 52 * ratio, 20 * ratio, 64 * ratio, 4 * ratio, 20 * ratio, 8 * ratio, 32 * ratio, (ImageObserver)null); + graphics.drawImage(bufferedimage, 28 * ratio, 52 * ratio, 24 * ratio, 64 * ratio, 0 * ratio, 20 * ratio, 4 * ratio, 32 * ratio, (ImageObserver)null); + graphics.drawImage(bufferedimage, 32 * ratio, 52 * ratio, 28 * ratio, 64 * ratio, 12 * ratio, 20 * ratio, 16 * ratio, 32 * ratio, (ImageObserver)null); + graphics.drawImage(bufferedimage, 40 * ratio, 48 * ratio, 36 * ratio, 52 * ratio, 44 * ratio, 16 * ratio, 48 * ratio, 20 * ratio, (ImageObserver)null); + graphics.drawImage(bufferedimage, 44 * ratio, 48 * ratio, 40 * ratio, 52 * ratio, 48 * ratio, 16 * ratio, 52 * ratio, 20 * ratio, (ImageObserver)null); + graphics.drawImage(bufferedimage, 36 * ratio, 52 * ratio, 32 * ratio, 64 * ratio, 48 * ratio, 20 * ratio, 52 * ratio, 32 * ratio, (ImageObserver)null); + graphics.drawImage(bufferedimage, 40 * ratio, 52 * ratio, 36 * ratio, 64 * ratio, 44 * ratio, 20 * ratio, 48 * ratio, 32 * ratio, (ImageObserver)null); + graphics.drawImage(bufferedimage, 44 * ratio, 52 * ratio, 40 * ratio, 64 * ratio, 40 * ratio, 20 * ratio, 44 * ratio, 32 * ratio, (ImageObserver)null); + graphics.drawImage(bufferedimage, 48 * ratio, 52 * ratio, 44 * ratio, 64 * ratio, 52 * ratio, 20 * ratio, 56 * ratio, 32 * ratio, (ImageObserver)null); + } + + graphics.dispose(); + this.imageData = ((DataBufferInt)bufferedimage.getRaster().getDataBuffer()).getData(); + if(!customskinloader.CustomSkinLoader.config.enableTransparentSkin){ + this.setAreaOpaque( 0 * ratio, 0 * ratio, 32 * ratio, 16 * ratio); + + if (flag) + { + this.doTransparencyHack(32 * ratio, 0, 64 * ratio, 32 * ratio); + } + + this.setAreaOpaque( 0 * ratio, 16 * ratio, 64 * ratio, 32 * ratio); + this.setAreaOpaque(16 * ratio, 48 * ratio, 48 * ratio, 64 * ratio); + } + return bufferedimage; + } + } + + public void skinAvailable() + { + } + + private void doTransparencyHack(int p_189559_1_, int p_189559_2_, int p_189559_3_, int p_189559_4_) + { + for (int i = p_189559_1_; i < p_189559_3_; ++i) + { + for (int j = p_189559_2_; j < p_189559_4_; ++j) + { + int k = this.imageData[i + j * this.imageWidth]; + + if ((k >> 24 & 255) < 128) + { + return; + } + } + } + + for (int l = p_189559_1_; l < p_189559_3_; ++l) + { + for (int i1 = p_189559_2_; i1 < p_189559_4_; ++i1) + { + this.imageData[l + i1 * this.imageWidth] &= 16777215; + } + } + } + + /** + * Makes the given area of the image opaque + */ + private void setAreaOpaque(int x, int y, int width, int height) + { + for (int i = x; i < width; ++i) + { + for (int j = y; j < height; ++j) + { + this.imageData[i + j * this.imageWidth] |= -16777216; + } + } + } +} diff --git a/1.9.4-mcp924-beta1/src/minecraft/net/minecraft/client/resources/SkinManager.java b/1.9.4-mcp924-beta1/src/minecraft/net/minecraft/client/resources/SkinManager.java new file mode 100644 index 0000000..e0ebf01 --- /dev/null +++ b/1.9.4-mcp924-beta1/src/minecraft/net/minecraft/client/resources/SkinManager.java @@ -0,0 +1,176 @@ +package net.minecraft.client.resources; + +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import com.google.common.collect.Maps; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.minecraft.InsecureTextureException; +import com.mojang.authlib.minecraft.MinecraftProfileTexture; +import com.mojang.authlib.minecraft.MinecraftSessionService; +import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; +import java.awt.image.BufferedImage; +import java.io.File; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import javax.annotation.Nullable; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.IImageBuffer; +import net.minecraft.client.renderer.ImageBufferDownload; +import net.minecraft.client.renderer.ThreadDownloadImageData; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.util.ResourceLocation; + +public class SkinManager +{ + private static final ExecutorService THREAD_POOL = new ThreadPoolExecutor(0, 2, 1L, TimeUnit.MINUTES, new LinkedBlockingQueue()); + private final TextureManager textureManager; + private final File skinCacheDir; + private final MinecraftSessionService sessionService; + private final LoadingCache> skinCacheLoader; + + public SkinManager(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService) + { + this.textureManager = textureManagerInstance; + this.skinCacheDir = skinCacheDirectory; + this.sessionService = sessionService; + this.skinCacheLoader = CacheBuilder.newBuilder().expireAfterAccess(15L, TimeUnit.SECONDS).>build(new CacheLoader>() + { + public Map load(GameProfile p_load_1_) throws Exception + { + return Minecraft.getMinecraft().getSessionService().getTextures(p_load_1_, false); + } + }); + } + + /** + * Used in the Skull renderer to fetch a skin. May download the skin if it's not in the cache + */ + public ResourceLocation loadSkin(MinecraftProfileTexture profileTexture, Type textureType) + { + return this.loadSkin(profileTexture, textureType, (SkinManager.SkinAvailableCallback)null); + } + + /** + * May download the skin if its not in the cache, can be passed a SkinManager#SkinAvailableCallback for handling + */ + public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final Type textureType, @Nullable final SkinManager.SkinAvailableCallback skinAvailableCallback) + { + final ResourceLocation resourcelocation = new ResourceLocation("skins/" + profileTexture.getHash()); + ITextureObject itextureobject = this.textureManager.getTexture(resourcelocation); + + if (itextureobject != null) + { + if (skinAvailableCallback != null) + { + skinAvailableCallback.skinAvailable(textureType, resourcelocation, profileTexture); + } + } + else + { + File file1 = new File(this.skinCacheDir, profileTexture.getHash().length() > 2 ? profileTexture.getHash().substring(0, 2) : "xx"); + File file2 = new File(file1, profileTexture.getHash()); + final IImageBuffer iimagebuffer = textureType == Type.SKIN ? new ImageBufferDownload() : null; + ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(file2, profileTexture.getUrl(), DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer() + { + public BufferedImage parseUserSkin(BufferedImage image) + { + if (iimagebuffer != null) + { + image = iimagebuffer.parseUserSkin(image); + } + + return image; + } + public void skinAvailable() + { + if (iimagebuffer != null) + { + iimagebuffer.skinAvailable(); + } + + if (skinAvailableCallback != null) + { + skinAvailableCallback.skinAvailable(textureType, resourcelocation, profileTexture); + } + } + }); + this.textureManager.loadTexture(resourcelocation, threaddownloadimagedata); + } + + return resourcelocation; + } + + public void loadProfileTextures(final GameProfile profile, final SkinManager.SkinAvailableCallback skinAvailableCallback, final boolean requireSecure) + { + THREAD_POOL.submit(new Runnable() + { + public void run() + { + final Map map = Maps.newHashMap(); + + try + { + map.putAll(SkinManager.this.sessionService.getTextures(profile, requireSecure)); + } + catch (InsecureTextureException var3) + { + ; + } + + /* + if (map.isEmpty() && profile.getId().equals(Minecraft.getMinecraft().getSession().getProfile().getId())) + { + profile.getProperties().clear(); + profile.getProperties().putAll(Minecraft.getMinecraft().getProfileProperties()); + map.putAll(SkinManager.this.sessionService.getTextures(profile, false)); + }*/ + + //CustomSkinLoader Begin (User Skin/Cape Part) + if(customskinloader.CustomSkinLoader.config.enable){ + Map newMap=customskinloader.CustomSkinLoader.loadProfile(profile.getName(), map); + if(!newMap.isEmpty()){ + map.clear(); + map.putAll(newMap); + } + } + //CustomSkinLoader End + + Minecraft.getMinecraft().addScheduledTask(new Runnable() + { + public void run() + { + if (map.containsKey(Type.SKIN)) + { + SkinManager.this.loadSkin((MinecraftProfileTexture)map.get(Type.SKIN), Type.SKIN, skinAvailableCallback); + } + + if (map.containsKey(Type.CAPE)) + { + SkinManager.this.loadSkin((MinecraftProfileTexture)map.get(Type.CAPE), Type.CAPE, skinAvailableCallback); + } + } + }); + } + }); + } + + public Map loadSkinFromCache(GameProfile profile) + { + //CustomSkinLoader Begin (Skull Part) + //return (Map)this.skinCacheLoader.getUnchecked(profile); + return (customskinloader.CustomSkinLoader.config.enable && customskinloader.CustomSkinLoader.config.enableSkull)? + customskinloader.CustomSkinLoader.loadProfileFromCache(profile.getName(),this.skinCacheLoader.getUnchecked(profile)): + this.skinCacheLoader.getUnchecked(profile); + //CustomSkinLoader End + } + + public interface SkinAvailableCallback + { + void skinAvailable(Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture); + } +} diff --git a/1.9.4/compile.bat b/1.9.4/compile.bat deleted file mode 100644 index f4ab211..0000000 --- a/1.9.4/compile.bat +++ /dev/null @@ -1,10 +0,0 @@ -@echo off -SET MC_VERSION=1.9.4 -SET CSL_VERSION=13.7a -cd src -javac -source 1.6 -target 1.6 -d ../bin -cp ;../lib/commons-codec-1.9.jar;../lib/commons-io-2.4.jar;../lib/gson-2.2.4.jar;../lib/guava-17.0.jar;../lib/authlib-1.5.22.jar;../%MC_VERSION%.jar *.java -javac -source 1.6 -target 1.6 -d ../bin -cp ;../lib/launchwrapper-1.7.jar customskinloader/tweaker/*.java -cd ../bin -del ../out/CustomSkinLoader_%MC_VERSION%-%CSL_VERSION%.jar -jar cfm ../out/CustomSkinLoader_%MC_VERSION%-%CSL_VERSION%.jar META-INF/MANIFEST.MF . -pause \ No newline at end of file diff --git a/1.9.4/src/bnm.java b/1.9.4/src/bnm.java deleted file mode 100644 index 4aa1f1e..0000000 --- a/1.9.4/src/bnm.java +++ /dev/null @@ -1,89 +0,0 @@ -import java.awt.Color; -import java.awt.Graphics; -import java.awt.image.BufferedImage; -import java.awt.image.DataBufferInt; -import java.awt.image.ImageObserver; - -public class bnm implements bng { - private int[] a;//imageData - private int b;//imageWidth - private int c;//imageHeight - - //BufferedImage parseUserSkin(BufferedImage image) - public BufferedImage a(BufferedImage image) { - if(image == null) { - return null; - } else { - int ratio = image.getWidth() / 64; - this.b = 64 * ratio; - this.c = 64 * ratio; - BufferedImage var2 = new BufferedImage(this.b, this.c, 2); - Graphics var3 = var2.getGraphics(); - var3.drawImage(image, 0, 0, (ImageObserver)null); - boolean var4 = image.getHeight() == 32 * ratio; - if(var4) { - if(!customskinloader.CustomSkinLoader.config.enableTransparentSkin){ - var3.setColor(new Color(0, 0, 0, 0)); - var3.fillRect(0, 32 * ratio, 64 * ratio, 32 * ratio); - } - var3.drawImage(var2, 24 * ratio, 48 * ratio, 20 * ratio, 52 * ratio, 4 * ratio, 16 * ratio, 8 * ratio, 20 * ratio, (ImageObserver)null); - var3.drawImage(var2, 28 * ratio, 48 * ratio, 24 * ratio, 52 * ratio, 8 * ratio, 16 * ratio, 12 * ratio, 20 * ratio, (ImageObserver)null); - var3.drawImage(var2, 20 * ratio, 52 * ratio, 16 * ratio, 64 * ratio, 8 * ratio, 20 * ratio, 12 * ratio, 32 * ratio, (ImageObserver)null); - var3.drawImage(var2, 24 * ratio, 52 * ratio, 20 * ratio, 64 * ratio, 4 * ratio, 20 * ratio, 8 * ratio, 32 * ratio, (ImageObserver)null); - var3.drawImage(var2, 28 * ratio, 52 * ratio, 24 * ratio, 64 * ratio, 0 * ratio, 20 * ratio, 4 * ratio, 32 * ratio, (ImageObserver)null); - var3.drawImage(var2, 32 * ratio, 52 * ratio, 28 * ratio, 64 * ratio, 12 * ratio, 20 * ratio, 16 * ratio, 32 * ratio, (ImageObserver)null); - var3.drawImage(var2, 40 * ratio, 48 * ratio, 36 * ratio, 52 * ratio, 44 * ratio, 16 * ratio, 48 * ratio, 20 * ratio, (ImageObserver)null); - var3.drawImage(var2, 44 * ratio, 48 * ratio, 40 * ratio, 52 * ratio, 48 * ratio, 16 * ratio, 52 * ratio, 20 * ratio, (ImageObserver)null); - var3.drawImage(var2, 36 * ratio, 52 * ratio, 32 * ratio, 64 * ratio, 48 * ratio, 20 * ratio, 52 * ratio, 32 * ratio, (ImageObserver)null); - var3.drawImage(var2, 40 * ratio, 52 * ratio, 36 * ratio, 64 * ratio, 44 * ratio, 20 * ratio, 48 * ratio, 32 * ratio, (ImageObserver)null); - var3.drawImage(var2, 44 * ratio, 52 * ratio, 40 * ratio, 64 * ratio, 40 * ratio, 20 * ratio, 44 * ratio, 32 * ratio, (ImageObserver)null); - var3.drawImage(var2, 48 * ratio, 52 * ratio, 44 * ratio, 64 * ratio, 52 * ratio, 20 * ratio, 56 * ratio, 32 * ratio, (ImageObserver)null); - } - - var3.dispose(); - this.a = ((DataBufferInt)var2.getRaster().getDataBuffer()).getData(); - if(!customskinloader.CustomSkinLoader.config.enableTransparentSkin){ - this.b(0, 0, 32 * ratio, 16 * ratio); - if(var4) { - this.a(32 * ratio, 0, 64 * ratio, 32 * ratio); - } - - this.b( 0 * ratio, 16 * ratio, 64 * ratio, 32 * ratio); - this.b(16 * ratio, 48 * ratio, 48 * ratio, 64 * ratio); - } - return var2; - } - } - - public void a() { - } - - //setAreaTransparent(int p_78434_1_, int p_78434_2_, int p_78434_3_, int p_78434_4_) - private void a(int p_78434_1_, int p_78434_2_, int p_78434_3_, int p_78434_4_) { - for(int i = p_78434_1_; i < p_78434_3_; ++i) { - for(int j = p_78434_2_; j < p_78434_4_; ++j) { - int k = this.a[i + j * this.b]; - if((k >> 24 & 255) < 128) { - return; - } - } - } - - for(int i = p_78434_1_; i < p_78434_3_; ++i) { - for(int j = p_78434_2_; j < p_78434_4_; ++j) { - this.a[i + j * this.b] &= 16777215; - } - } - - } - - //setAreaOpaque(int p_78433_1_, int p_78433_2_, int p_78433_3_, int p_78433_4_) - private void b(int p_78433_1_, int p_78433_2_, int p_78433_3_, int p_78433_4_) { - for(int i = p_78433_1_; i < p_78433_3_; ++i) { - for(int j = p_78433_2_; j < p_78433_4_; ++j) { - this.a[i + j * this.b] |= -16777216; - } - } - - } -} diff --git a/1.9.4/src/bwk.java b/1.9.4/src/bwk.java deleted file mode 100644 index 118726b..0000000 --- a/1.9.4/src/bwk.java +++ /dev/null @@ -1,143 +0,0 @@ -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.google.common.collect.Maps; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.minecraft.InsecureTextureException; -import com.mojang.authlib.minecraft.MinecraftProfileTexture; -import com.mojang.authlib.minecraft.MinecraftSessionService; -import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; -import java.awt.image.BufferedImage; -import java.io.File; -import java.util.Map; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - -public class bwk { - private static final ExecutorService a = new ThreadPoolExecutor(0, 2, 1L, TimeUnit.MINUTES, new LinkedBlockingQueue());//THREAD_POOL - private final bvf b;//textureManager - private final File c;//skinCacheDir - private final MinecraftSessionService d;//sessionService - private final LoadingCache e;//skinCacheLoader - - //SkinManager(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService) - public bwk(bvf textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService) { - this.b = textureManagerInstance; - this.c = skinCacheDirectory; - this.d = sessionService; - this.e = CacheBuilder.newBuilder().expireAfterAccess(15L, TimeUnit.SECONDS).build(new CacheLoader() { - public Map a(GameProfile p_load_1_) throws Exception { - return bcd.z().X().getTextures(p_load_1_, false); - } - - // $FF: synthetic method - public Object load(Object p_load_1_) throws Exception { - return this.a((GameProfile)p_load_1_); - } - }); - } - - //ResourceLocation loadSkin(MinecraftProfileTexture profileTexture, Type textureType) - public kl a(MinecraftProfileTexture profileTexture, Type textureType) { - return this.a(profileTexture, textureType, (bwk.a)null); - } - - //ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final Type textureType, final SkinManager.SkinAvailableCallback skinAvailableCallback) - public kl a(final MinecraftProfileTexture profileTexture, final Type textureType, final bwk.a skinAvailableCallback) { - final kl resourcelocation = new kl("skins/" + profileTexture.getHash()); - bvg itextureobject = this.b.b(resourcelocation); - if(itextureobject != null) { - if(skinAvailableCallback != null) { - skinAvailableCallback.a(textureType, resourcelocation, profileTexture); - } - } else { - File file1 = new File(this.c, profileTexture.getHash().length() > 2?profileTexture.getHash().substring(0, 2):"xx"); - File file2 = new File(file1, profileTexture.getHash()); - final bng iimagebuffer = textureType == Type.SKIN?new bnm():null; - buv threaddownloadimagedata = new buv(file2, profileTexture.getUrl(), bvt.a(), new bng() { - public BufferedImage a(BufferedImage image) { - if(iimagebuffer != null) { - image = iimagebuffer.a(image); - } - - return image; - } - - public void a() { - if(iimagebuffer != null) { - iimagebuffer.a(); - } - - if(skinAvailableCallback != null) { - skinAvailableCallback.a(textureType, resourcelocation, profileTexture); - } - - } - }); - this.b.a((kl)resourcelocation, (bvg)threaddownloadimagedata); - } - - return resourcelocation; - } - - //loadProfileTextures(final GameProfile profile, final SkinManager.SkinAvailableCallback skinAvailableCallback, final boolean requireSecure) - public void a(final GameProfile profile, final bwk.a skinAvailableCallback, final boolean requireSecure) { - a.submit(new Runnable() { - public void run() { - final Map map = Maps.newHashMap(); - - try { - map.putAll(bwk.this.d.getTextures(profile, requireSecure)); - } catch (InsecureTextureException var3) { - ; - } - - /* - if(map.isEmpty() && profile.getId().equals(bcd.z().K().e().getId())) { - profile.getProperties().clear(); - profile.getProperties().putAll(bcd.z().L()); - map.putAll(bwk.this.d.getTextures(profile, false)); - }*/ - - //CustomSkinLoader Begin (User Skin/Cape Part) - if(customskinloader.CustomSkinLoader.config.enable){ - Map newMap=customskinloader.CustomSkinLoader.loadProfile(profile.getName(), map); - if(!newMap.isEmpty()){ - map.clear(); - map.putAll(newMap); - } - } - //CustomSkinLoader End - - bcd.z().a(new Runnable() { - public void run() { - if(map.containsKey(Type.SKIN)) { - bwk.this.a((MinecraftProfileTexture)map.get(Type.SKIN), Type.SKIN, skinAvailableCallback); - } - - if(map.containsKey(Type.CAPE)) { - bwk.this.a((MinecraftProfileTexture)map.get(Type.CAPE), Type.CAPE, skinAvailableCallback); - } - - } - }); - } - }); - } - - //Map loadSkinFromCache(GameProfile profile) - public Map a(GameProfile profile) { - //return (Map)this.e.getUnchecked(profile); - //CustomSkinLoader Begin (Skull Part) - return (customskinloader.CustomSkinLoader.config.enable && customskinloader.CustomSkinLoader.config.enableSkull)? - customskinloader.CustomSkinLoader.loadProfileFromCache(profile.getName()): - (Map)this.e.getUnchecked(profile); - //CustomSkinLoader End - } - - public interface a { - void a(Type var1, kl var2, MinecraftProfileTexture var3); - } -} diff --git a/1.9.4/src/customskinloader/utils/MinecraftUtil.java b/1.9.4/src/customskinloader/utils/MinecraftUtil.java deleted file mode 100644 index 6c3b2cc..0000000 --- a/1.9.4/src/customskinloader/utils/MinecraftUtil.java +++ /dev/null @@ -1,71 +0,0 @@ -package customskinloader.utils; - -import java.io.File; -import java.net.URL; -import java.net.URLClassLoader; -import java.net.URLDecoder; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * MinecraftUtil for non-mcp version. - * It is the only class in package 'customskinloader' which has differences in mcp/non-mcp version. - * - * @author Alexander Xia - * @since 13.6 - * - */ -public class MinecraftUtil { - public static File getMinecraftDataDir0(){ - return getMinecraftDataDir(); - } - - public static File minecraftDataFolder=null; - private static final String MINECRAFT_DATA_FOLDER=".minecraft"; - public static File getMinecraftDataDir(){ - if(minecraftDataFolder!=null) - return minecraftDataFolder; - testProbe(); - if(minecraftDataFolder!=null) - return minecraftDataFolder; - File temp=new File(""); - if(temp.getAbsolutePath().endsWith(MINECRAFT_DATA_FOLDER)) - return temp; - File temp0=new File(MINECRAFT_DATA_FOLDER); - if(temp0.exists()) - return temp0; - return temp; - } - - private static String minecraftVersion=null; - public static String getMinecraftVersion(){ - if(minecraftVersion!=null) - return minecraftVersion; - testProbe(); - return minecraftVersion; - } - - private final static Pattern MINECRAFT_CORE_FILE_PATTERN = Pattern.compile("^(.*?)/versions/(.*?)/(.*?).jar$"); - private static void testProbe(){ - URLClassLoader ucl = (URLClassLoader)new MinecraftUtil().getClass().getClassLoader(); - URL urls[] = ucl.getURLs(); - for(URL url:urls){ - Matcher m = null; - try{ - m=MINECRAFT_CORE_FILE_PATTERN.matcher(URLDecoder.decode(url.getPath(),"UTF-8")); - }catch(Exception e){ - e.printStackTrace(); - } - if(m==null) - continue; - if(!m.matches()) - continue; - if(minecraftDataFolder==null) - minecraftDataFolder=new File(m.group(1)); - //System.out.println(url.getPath()+" "+minecraftDataFolder.getAbsolutePath()); - if(minecraftVersion==null) - minecraftVersion=m.group(2); - break; - } - } -}