mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-20 02:59:38 +00:00
1.9 forge support
This commit is contained in:
1 parent
bebbbb0050
commit
199c5d674e
5 files changed
+287
-250
No files matched your search
+115
@@ -0,0 +1,115 @@
|
||||
package net.minecraft.client.renderer;
|
||||
|
||||
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 var2 = new BufferedImage(this.imageWidth, this.imageHeight, 2);
|
||||
Graphics var3 = var2.getGraphics();
|
||||
var3.drawImage(image, 0, 0, null);
|
||||
if (image.getHeight() == 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.imageData = ((DataBufferInt)var2.getRaster().getDataBuffer()).getData();
|
||||
this.setAreaOpaque(0, 0, 32 * ratio, 16 * ratio);
|
||||
this.setAreaTransparent(32 * ratio, 0, 64 * ratio, 32 * ratio);
|
||||
this.setAreaOpaque(0, 16 * ratio, 64 * ratio, 32 * ratio);
|
||||
this.setAreaTransparent(0, 32 * ratio, 16 * ratio, 48 * ratio);
|
||||
this.setAreaTransparent(16 * ratio, 32 * ratio, 40 * ratio, 48 * ratio);
|
||||
this.setAreaTransparent(40 * ratio, 32 * ratio, 56 * ratio, 48 * ratio);
|
||||
this.setAreaTransparent(0, 48 * ratio, 16 * ratio, 64 * ratio);
|
||||
this.setAreaOpaque(16 * ratio, 48 * ratio, 48 * ratio, 64 * ratio);
|
||||
this.setAreaTransparent(48 * ratio, 48 * ratio, 64 * ratio, 64 * ratio);
|
||||
return var2;
|
||||
}
|
||||
}
|
||||
|
||||
public void skinAvailable()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the given area of the image transparent if it was previously completely opaque (used to remove the outer
|
||||
* layer of a skin around the head if it was saved all opaque; this would be redundant so it's assumed that the skin
|
||||
* maker is just using an image editor without an alpha channel)
|
||||
*/
|
||||
private void setAreaTransparent(int p_78434_1_, int p_78434_2_, int p_78434_3_, int p_78434_4_)
|
||||
{
|
||||
if (!this.hasTransparency(p_78434_1_, p_78434_2_, p_78434_3_, 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)
|
||||
{
|
||||
this.imageData[i + j * this.imageWidth] &= 16777215;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the given area of the image opaque
|
||||
*/
|
||||
private void setAreaOpaque(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.imageData[i + j * this.imageWidth] |= -16777216;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given area of the image contains transparent pixels
|
||||
*/
|
||||
private boolean hasTransparency(int p_78435_1_, int p_78435_2_, int p_78435_3_, int p_78435_4_)
|
||||
{
|
||||
for (int i = p_78435_1_; i < p_78435_3_; ++i)
|
||||
{
|
||||
for (int j = p_78435_2_; j < p_78435_4_; ++j)
|
||||
{
|
||||
int k = this.imageData[i + j * this.imageWidth];
|
||||
|
||||
if ((k >> 24 & 255) < 128)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
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 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<GameProfile, Map<Type, MinecraftProfileTexture>> 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).<GameProfile, Map<Type, MinecraftProfileTexture>>build(new CacheLoader<GameProfile, Map<Type, MinecraftProfileTexture>>()
|
||||
{
|
||||
public Map<Type, MinecraftProfileTexture> 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, 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<Type, MinecraftProfileTexture> map = Maps.<Type, MinecraftProfileTexture>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
|
||||
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<Type, MinecraftProfileTexture> loadSkinFromCache(GameProfile profile)
|
||||
{
|
||||
return (Map)this.skinCacheLoader.getUnchecked(profile);
|
||||
}
|
||||
|
||||
public interface SkinAvailableCallback
|
||||
{
|
||||
void skinAvailable(Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture);
|
||||
}
|
||||
}
|
||||
-104
@@ -1,104 +0,0 @@
|
||||
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
|
||||
// Jad home page: http://kpdus.tripod.com/jad.html
|
||||
// Decompiler options: packimports(3) fieldsfirst ansi space
|
||||
// Source File Name: SourceFile
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.*;
|
||||
|
||||
public class bnp
|
||||
implements bnj
|
||||
{
|
||||
|
||||
private int a[];
|
||||
private int b;
|
||||
private int c;
|
||||
|
||||
public bnp()
|
||||
{
|
||||
}
|
||||
|
||||
public BufferedImage a(BufferedImage image)
|
||||
{
|
||||
if (image == null)
|
||||
return null;
|
||||
|
||||
int ratio = image.getWidth() / 64;
|
||||
b = 64 * ratio;
|
||||
c = 64 * ratio;
|
||||
BufferedImage var2 = new BufferedImage(b, c, 2);
|
||||
Graphics var3 = var2.getGraphics();
|
||||
var3.drawImage(image, 0, 0, null);
|
||||
if (image.getHeight() == 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();
|
||||
a = ((DataBufferInt)var2.getRaster().getDataBuffer()).getData();
|
||||
b(0 * ratio, 0 * ratio, 32 * ratio, 16 * ratio);
|
||||
a(32 * ratio, 0 * ratio, 64 * ratio, 32 * ratio);
|
||||
b(0 * ratio, 16 * ratio, 64 * ratio, 32 * ratio);
|
||||
a(0 * ratio, 32 * ratio, 16 * ratio, 48 * ratio);
|
||||
a(16 * ratio, 32 * ratio, 40 * ratio, 48 * ratio);
|
||||
a(40 * ratio, 32 * ratio, 56 * ratio, 48 * ratio);
|
||||
a(0 * ratio, 48 * ratio, 16 * ratio, 64 * ratio);
|
||||
b(16 * ratio, 48 * ratio, 48 * ratio, 64 * ratio);
|
||||
a(48 * ratio, 48 * ratio, 64 * ratio, 64 * ratio);
|
||||
return var2;
|
||||
}
|
||||
|
||||
public void a()
|
||||
{
|
||||
}
|
||||
|
||||
private void a(int p1, int p2, int p3, int p4)
|
||||
{
|
||||
if (c(p1, p2, p3, p4))
|
||||
return;
|
||||
for (int i = p1; i < p3; i++)
|
||||
{
|
||||
for (int j = p2; j < p4; j++)
|
||||
a[i + j * b] &= 0xffffff;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void b(int p1, int p2, int p3, int p4)
|
||||
{
|
||||
for (int i = p1; i < p3; i++)
|
||||
{
|
||||
for (int j = p2; j < p4; j++)
|
||||
a[i + j * b] |= 0xff000000;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean c(int p1, int p2, int p3, int p4)
|
||||
{
|
||||
for (int i = p1; i < p3; i++)
|
||||
{
|
||||
for (int j = p2; j < p4; j++)
|
||||
{
|
||||
int k = a[i + j * b];
|
||||
if ((k >> 24 & 0xff) < 128)
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
-144
@@ -1,144 +0,0 @@
|
||||
import com.google.common.cache.*;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.minecraft.*;
|
||||
import com.mojang.authlib.properties.PropertyMap;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
public class bwn
|
||||
{
|
||||
public static interface a
|
||||
{
|
||||
|
||||
public abstract void a(com.mojang.authlib.minecraft.MinecraftProfileTexture.Type type, kk kk1, MinecraftProfileTexture minecraftprofiletexture);
|
||||
}
|
||||
|
||||
|
||||
private static final ExecutorService a;
|
||||
private final bvi b;
|
||||
private final File c;
|
||||
private final MinecraftSessionService d;
|
||||
private final LoadingCache e;
|
||||
|
||||
public bwn(bvi textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService)
|
||||
{
|
||||
b = textureManagerInstance;
|
||||
c = skinCacheDirectory;
|
||||
d = sessionService;
|
||||
e = CacheBuilder.newBuilder().expireAfterAccess(15L, TimeUnit.SECONDS).build(new CacheLoader() {
|
||||
|
||||
public Map a(GameProfile gameProfile)
|
||||
throws Exception
|
||||
{
|
||||
return bcf.z().X().getTextures(gameProfile, false);
|
||||
}
|
||||
|
||||
public Object load(Object obj)
|
||||
throws Exception
|
||||
{
|
||||
return a((GameProfile)obj);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public kk a(MinecraftProfileTexture profileTexture, com.mojang.authlib.minecraft.MinecraftProfileTexture.Type textureType)
|
||||
{
|
||||
return a(profileTexture, textureType, ((a) (null)));
|
||||
}
|
||||
|
||||
public kk a(final MinecraftProfileTexture profileTexture,final com.mojang.authlib.minecraft.MinecraftProfileTexture.Type textureType, final a skinAvailableCallback)
|
||||
{
|
||||
final kk resourceLocation = new kk((new StringBuilder()).append("skins/").append(profileTexture.getHash()).toString());
|
||||
bvj textureObject = b.b(resourceLocation);
|
||||
if (textureObject != null)
|
||||
{
|
||||
if (skinAvailableCallback != null)
|
||||
skinAvailableCallback.a(textureType, resourceLocation, profileTexture);
|
||||
} else
|
||||
{
|
||||
File cacheDir = new File(c, profileTexture.getHash().length() <= 2 ? "xx" : profileTexture.getHash().substring(0, 2));
|
||||
File cacheFile = new File(cacheDir, profileTexture.getHash());
|
||||
final bnj imageBuffer = textureType != com.mojang.authlib.minecraft.MinecraftProfileTexture.Type.SKIN ? null : ((bnj) (new bnp()));
|
||||
buy threadDownloadImageData = new buy(cacheFile, profileTexture.getUrl(), bvw.a(), new bnj() {
|
||||
|
||||
public BufferedImage a(BufferedImage image)
|
||||
{
|
||||
if (imageBuffer != null)
|
||||
image = imageBuffer.a(image);
|
||||
return image;
|
||||
}
|
||||
|
||||
public void a()
|
||||
{
|
||||
if (imageBuffer != null)
|
||||
imageBuffer.a();
|
||||
if (skinAvailableCallback != null)
|
||||
skinAvailableCallback.a(textureType, resourceLocation, profileTexture);
|
||||
}
|
||||
|
||||
});
|
||||
b.a(resourceLocation, threadDownloadImageData);
|
||||
}
|
||||
return resourceLocation;
|
||||
}
|
||||
|
||||
public void a(final GameProfile profile, final a skinAvailableCallback, final boolean requireSecure)
|
||||
{
|
||||
a.submit(new Runnable() {
|
||||
|
||||
public void run()
|
||||
{
|
||||
final Map map = Maps.newHashMap();
|
||||
try
|
||||
{
|
||||
map.putAll(bwn.this.d.getTextures(profile, requireSecure));
|
||||
}
|
||||
catch (InsecureTextureException insecureTextureException) { }
|
||||
/*
|
||||
if (map.isEmpty() && profile.getId().equals(bcf.z().K().e().getId()))
|
||||
{
|
||||
profile.getProperties().clear();
|
||||
profile.getProperties().putAll(bcf.z().L());
|
||||
map.putAll(bwn.this.d.getTextures(profile, false));
|
||||
}*/
|
||||
//CustomSkinLoader Begin
|
||||
if(customskinloader.CustomSkinLoader.config.enable){
|
||||
Map newMap=customskinloader.CustomSkinLoader.loadProfile(profile.getName(), map);
|
||||
if(!newMap.isEmpty()){
|
||||
map.clear();
|
||||
map.putAll(newMap);
|
||||
}
|
||||
}
|
||||
//CustomSkinLoader End
|
||||
bcf.z().a(new Runnable() {
|
||||
|
||||
public void run()
|
||||
{
|
||||
if (map.containsKey(com.mojang.authlib.minecraft.MinecraftProfileTexture.Type.SKIN))
|
||||
bwn.this.a((MinecraftProfileTexture)map.get(com.mojang.authlib.minecraft.MinecraftProfileTexture.Type.SKIN), com.mojang.authlib.minecraft.MinecraftProfileTexture.Type.SKIN, skinAvailableCallback);
|
||||
if (map.containsKey(com.mojang.authlib.minecraft.MinecraftProfileTexture.Type.CAPE))
|
||||
bwn.this.a((MinecraftProfileTexture)map.get(com.mojang.authlib.minecraft.MinecraftProfileTexture.Type.CAPE), com.mojang.authlib.minecraft.MinecraftProfileTexture.Type.CAPE, skinAvailableCallback);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Map a(GameProfile profile)
|
||||
{
|
||||
return (Map)e.getUnchecked(profile);
|
||||
}
|
||||
|
||||
static MinecraftSessionService a(bwn skinManagerInstance)
|
||||
{
|
||||
return skinManagerInstance.d;
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
a = new ThreadPoolExecutor(0, 2, 1L, TimeUnit.MINUTES, new LinkedBlockingQueue());
|
||||
}
|
||||
}
|
||||
@@ -25,10 +25,10 @@ import net.minecraft.client.Minecraft;
|
||||
/**
|
||||
* Custom skin loader mod for Minecraft.
|
||||
* @author (C) Jeremy Lam [JLChnToZ] 2013 & Alexander Xia [xfl03] 2014-2016
|
||||
* @version 13.2 (2016.3.5)
|
||||
* @version 13.3 (2016.3.13)
|
||||
*/
|
||||
public class CustomSkinLoader {
|
||||
public static final String CustomSkinLoader_VERSION="13.2";
|
||||
public static final String CustomSkinLoader_VERSION="13.3";
|
||||
public static final File DATA_DIR=new File(Minecraft.getMinecraft().mcDataDir,"CustomSkinLoader"),
|
||||
LOG_FILE=new File(DATA_DIR,"CustomSkinLoader.log"),
|
||||
CONFIG_FILE=new File(DATA_DIR,"CustomSkinLoader.json");
|
||||
|
||||
Reference in new issue
Block a user