mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-25 04:04:25 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3dbf812f50 | ||
|
|
2bb8da3ff9 | ||
|
|
1371e7685e | ||
|
|
a49fea706d | ||
|
|
32547481e7 | ||
|
|
faff465ace | ||
|
|
e487ab1147 | ||
|
|
e26bc85f46 | ||
|
|
7dc2c45600 | ||
|
|
d6281881a5 | ||
|
|
7cdd582ed4 | ||
|
|
129b50a6c2 | ||
|
|
eaf9c5f48f | ||
|
|
b7e5c59ecf | ||
|
|
05e98d6eee | ||
|
|
f4b7393b44 | ||
|
|
898a4fe7d9 | ||
|
|
5cbfb87d08 | ||
|
|
8cdabb762d | ||
|
|
4369ddf43e | ||
|
|
8a1dca0dd4 | ||
|
|
b533d33f71 | ||
|
|
bfaa97ba04 | ||
|
|
c86790371d | ||
|
|
ed4bf8dbb3 | ||
|
|
b97f838d59 | ||
|
|
79440740ee | ||
|
|
481b0d9df9 |
No files matched your search
+13
@@ -10,3 +10,16 @@
|
|||||||
|
|
||||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
hs_err_pid*
|
hs_err_pid*
|
||||||
|
|
||||||
|
#VSCode
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
#eclipse
|
||||||
|
*/.classpath
|
||||||
|
.classpath
|
||||||
|
*/.project
|
||||||
|
.project
|
||||||
|
.settings/
|
||||||
|
|
||||||
|
#gradle
|
||||||
|
.gradle/
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
minecraft_version=1.10
|
|
||||||
minecraft_full_versions=1.10,1.10.1,1.10.2
|
|
||||||
#forge gradle needs forge version
|
|
||||||
forge_mc_version=1.10.2
|
|
||||||
forge_version=12.18.2.2099
|
|
||||||
mappings_version=stable_29
|
|
||||||
@@ -1,161 +0,0 @@
|
|||||||
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<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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//CustomSkinLoader Begin (Init)
|
|
||||||
customskinloader.loader.MojangAPILoader.defaultSessionService=sessionService;
|
|
||||||
customskinloader.utils.HttpTextureUtil.defaultCacheDir=skinCacheDirectory;
|
|
||||||
//CustomSkinLoader End
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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)
|
|
||||||
{
|
|
||||||
//CustomSkinLoader Begin (Parse HttpTextureInfo)
|
|
||||||
customskinloader.utils.HttpTextureUtil.HttpTextureInfo info=customskinloader.utils.HttpTextureUtil.toHttpTextureInfo(profileTexture.getUrl());
|
|
||||||
//CustomSkinLoader End
|
|
||||||
final ResourceLocation resourcelocation = new ResourceLocation("skins/" + info.hash);//Modified
|
|
||||||
ITextureObject itextureobject = this.textureManager.getTexture(resourcelocation);
|
|
||||||
|
|
||||||
if (itextureobject != null)
|
|
||||||
{
|
|
||||||
if (skinAvailableCallback != null)
|
|
||||||
{
|
|
||||||
skinAvailableCallback.skinAvailable(textureType, resourcelocation, profileTexture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
final IImageBuffer iimagebuffer = textureType == Type.SKIN ? new customskinloader.renderer.SkinBuffer() : null;//Modified
|
|
||||||
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(info.cacheFile, info.url, DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer()//Modified
|
|
||||||
{
|
|
||||||
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();
|
|
||||||
|
|
||||||
//CustomSkinLoader Begin (User Profile Part)
|
|
||||||
if(customskinloader.CustomSkinLoader.config.enable){
|
|
||||||
map.putAll(customskinloader.CustomSkinLoader.loadProfile(profile));
|
|
||||||
}else{
|
|
||||||
try{
|
|
||||||
map.putAll(SkinManager.this.sessionService.getTextures(profile, requireSecure));
|
|
||||||
}catch (InsecureTextureException var3){}
|
|
||||||
}
|
|
||||||
//CustomSkinLoader End
|
|
||||||
|
|
||||||
Minecraft.getMinecraft().addScheduledTask(new Runnable()
|
|
||||||
{
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
//CustomSkinLoader Begin (Loading Task)
|
|
||||||
for(Type type:Type.values()){
|
|
||||||
if(map.containsKey(type))
|
|
||||||
SkinManager.this.loadSkin((MinecraftProfileTexture)map.get(type), type, skinAvailableCallback);
|
|
||||||
}
|
|
||||||
//CustomSkinLoader End
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<Type, MinecraftProfileTexture> 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):
|
|
||||||
this.skinCacheLoader.getUnchecked(profile);
|
|
||||||
//CustomSkinLoader End
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface SkinAvailableCallback
|
|
||||||
{
|
|
||||||
void skinAvailable(Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
minecraft_version=1.11
|
|
||||||
minecraft_full_versions=1.11
|
|
||||||
#forge gradle needs forge version
|
|
||||||
forge_mc_version=1.11
|
|
||||||
forge_version=13.19.0.2153
|
|
||||||
mappings_version=snapshot_20161119
|
|
||||||
@@ -1,162 +0,0 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
//This code is from 1.10-mcp931
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//CustomSkinLoader Begin (Init)
|
|
||||||
customskinloader.loader.MojangAPILoader.defaultSessionService=sessionService;
|
|
||||||
customskinloader.utils.HttpTextureUtil.defaultCacheDir=skinCacheDirectory;
|
|
||||||
//CustomSkinLoader End
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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)
|
|
||||||
{
|
|
||||||
//CustomSkinLoader Begin (Parse HttpTextureInfo)
|
|
||||||
customskinloader.utils.HttpTextureUtil.HttpTextureInfo info=customskinloader.utils.HttpTextureUtil.toHttpTextureInfo(profileTexture.getUrl());
|
|
||||||
//CustomSkinLoader End
|
|
||||||
final ResourceLocation resourcelocation = new ResourceLocation("skins/" + info.hash);//Modified
|
|
||||||
ITextureObject itextureobject = this.textureManager.getTexture(resourcelocation);
|
|
||||||
|
|
||||||
if (itextureobject != null)
|
|
||||||
{
|
|
||||||
if (skinAvailableCallback != null)
|
|
||||||
{
|
|
||||||
skinAvailableCallback.skinAvailable(textureType, resourcelocation, profileTexture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
final IImageBuffer iimagebuffer = textureType == Type.SKIN ? new customskinloader.renderer.SkinBuffer() : null;//Modified
|
|
||||||
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(info.cacheFile, info.url, DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer()//Modified
|
|
||||||
{
|
|
||||||
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();
|
|
||||||
|
|
||||||
//CustomSkinLoader Begin (User Profile Part)
|
|
||||||
if(customskinloader.CustomSkinLoader.config.enable){
|
|
||||||
map.putAll(customskinloader.CustomSkinLoader.loadProfile(profile));
|
|
||||||
}else{
|
|
||||||
try{
|
|
||||||
map.putAll(SkinManager.this.sessionService.getTextures(profile, requireSecure));
|
|
||||||
}catch (InsecureTextureException var3){}
|
|
||||||
}
|
|
||||||
//CustomSkinLoader End
|
|
||||||
|
|
||||||
Minecraft.getMinecraft().addScheduledTask(new Runnable()
|
|
||||||
{
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
//CustomSkinLoader Begin (Loading Task)
|
|
||||||
for(Type type:Type.values()){
|
|
||||||
if(map.containsKey(type))
|
|
||||||
SkinManager.this.loadSkin((MinecraftProfileTexture)map.get(type), type, skinAvailableCallback);
|
|
||||||
}
|
|
||||||
//CustomSkinLoader End
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<Type, MinecraftProfileTexture> 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):
|
|
||||||
this.skinCacheLoader.getUnchecked(profile);
|
|
||||||
//CustomSkinLoader End
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface SkinAvailableCallback
|
|
||||||
{
|
|
||||||
void skinAvailable(Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
minecraft_version=1.12
|
||||||
|
minecraft_full_versions=1.12
|
||||||
|
#forge gradle needs forge version
|
||||||
|
forge_mc_version=1.12
|
||||||
|
forge_version=14.21.1.2387
|
||||||
|
mappings_version=snapshot_20170813
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
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<GameProfile, Map<Type, MinecraftProfileTexture>> skinCacheLoader;
|
||||||
|
|
||||||
|
private customskinloader.fake.FakeSkinManager fakeManager;//Fake Skin Manager
|
||||||
|
|
||||||
|
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
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Minecraft.getMinecraft().getSessionService().getTextures(p_load_1_, false);
|
||||||
|
}
|
||||||
|
catch (Throwable var3)
|
||||||
|
{
|
||||||
|
return Maps.<Type, MinecraftProfileTexture>newHashMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.fakeManager=new customskinloader.fake.FakeSkinManager(textureManagerInstance,skinCacheDirectory,sessionService);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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)
|
||||||
|
{
|
||||||
|
return this.fakeManager.loadSkin(profileTexture, textureType, skinAvailableCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadProfileTextures(final GameProfile profile, final SkinManager.SkinAvailableCallback skinAvailableCallback, final boolean requireSecure)
|
||||||
|
{
|
||||||
|
this.fakeManager.loadProfileTextures(profile, skinAvailableCallback, requireSecure);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<Type, MinecraftProfileTexture> loadSkinFromCache(GameProfile profile)
|
||||||
|
{
|
||||||
|
return this.fakeManager.loadSkinFromCache(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface SkinAvailableCallback
|
||||||
|
{
|
||||||
|
void skinAvailable(Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
minecraft_version=1.12.1
|
||||||
|
minecraft_full_versions=1.12.1
|
||||||
|
#forge gradle needs forge version
|
||||||
|
forge_mc_version=1.12.1
|
||||||
|
forge_version=14.22.0.2452
|
||||||
|
mappings_version=snapshot_20170813
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
//From 1.12-mcp940
|
||||||
|
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;
|
||||||
|
|
||||||
|
private customskinloader.fake.FakeSkinManager fakeManager;//Fake Skin Manager
|
||||||
|
|
||||||
|
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
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Minecraft.getMinecraft().getSessionService().getTextures(p_load_1_, false);
|
||||||
|
}
|
||||||
|
catch (Throwable var3)
|
||||||
|
{
|
||||||
|
return Maps.<Type, MinecraftProfileTexture>newHashMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.fakeManager=new customskinloader.fake.FakeSkinManager(textureManagerInstance,skinCacheDirectory,sessionService);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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)
|
||||||
|
{
|
||||||
|
return this.fakeManager.loadSkin(profileTexture, textureType, skinAvailableCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadProfileTextures(final GameProfile profile, final SkinManager.SkinAvailableCallback skinAvailableCallback, final boolean requireSecure)
|
||||||
|
{
|
||||||
|
this.fakeManager.loadProfileTextures(profile, skinAvailableCallback, requireSecure);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<Type, MinecraftProfileTexture> loadSkinFromCache(GameProfile profile)
|
||||||
|
{
|
||||||
|
return this.fakeManager.loadSkinFromCache(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface SkinAvailableCallback
|
||||||
|
{
|
||||||
|
void skinAvailable(Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,141 +0,0 @@
|
|||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
/*
|
|
||||||
maven {
|
|
||||||
name = "fmm"
|
|
||||||
url = "http://forgemavenmirror.sinaapp.com/maven"
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
jcenter()
|
|
||||||
maven {
|
|
||||||
name = "forge"
|
|
||||||
url = "http://files.minecraftforge.net/maven"
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name = "sonatype"
|
|
||||||
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
apply plugin: 'forge'
|
|
||||||
|
|
||||||
ext.rootConfigFile = file "../build.properties"
|
|
||||||
rootConfigFile.withReader {
|
|
||||||
def prop = new Properties()
|
|
||||||
prop.load(it)
|
|
||||||
project.ext.rootConfig = new ConfigSlurper().parse prop
|
|
||||||
}
|
|
||||||
|
|
||||||
ext.configFile = file "build.properties"
|
|
||||||
configFile.withReader {
|
|
||||||
def prop = new Properties()
|
|
||||||
prop.load(it)
|
|
||||||
project.ext.config = new ConfigSlurper().parse prop
|
|
||||||
}
|
|
||||||
//Example: 14.4a-SNAPSHOT-20160820
|
|
||||||
version = rootConfig.version + rootConfig.dev_version + ((rootConfig.snapshot==""||rootConfig.snapshot=="0"||rootConfig.snapshot==0)?'':('-SNAPSHOT-'+System.getenv("BUILD_NUMBER")))
|
|
||||||
group = config.group
|
|
||||||
archivesBaseName = rootConfig.name+"_"+config.minecraft_version
|
|
||||||
|
|
||||||
minecraft {
|
|
||||||
version = config.forge_mc_version+"-"+config.forge_version
|
|
||||||
runDir = "run"
|
|
||||||
mappings = config.mappings_version
|
|
||||||
|
|
||||||
replace '@MOD_VERSION@', rootConfig.version
|
|
||||||
replace '@MOD_FULL_VERSION@', project.version
|
|
||||||
replaceIn 'CustomSkinLoader.java'
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
manifest {
|
|
||||||
attributes 'TweakClass' : 'customskinloader.tweaker.ModSystemTweaker'
|
|
||||||
attributes 'TweakName' : rootConfig.name
|
|
||||||
attributes 'TweakAuthor' : 'xfl03,JLChnToZ'
|
|
||||||
attributes 'TweakVersion' : version
|
|
||||||
attributes 'TweakOrder' : '-10'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task copySource << {
|
|
||||||
def outputFile = file("src/main/java")
|
|
||||||
outputFile.deleteDir()
|
|
||||||
copy {
|
|
||||||
from '../Common'
|
|
||||||
from 'src/minecraft/'
|
|
||||||
into 'src/main/java'
|
|
||||||
include '**/*.java'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sourceMainJava.dependsOn copySource
|
|
||||||
|
|
||||||
processResources {
|
|
||||||
expand ([
|
|
||||||
modVersion:rootConfig.version,
|
|
||||||
modFullVersion:config.minecraft_full_versions,
|
|
||||||
mcVersion:config.minecraft_version,
|
|
||||||
mcFullVersions:config.minecraft_full_versions,
|
|
||||||
forgeVersion:config.forge_version,
|
|
||||||
gitVersion:System.getenv("GIT_COMMIT"),
|
|
||||||
buildUrl:System.getenv("BUILD_URL")
|
|
||||||
])
|
|
||||||
}
|
|
||||||
task copyResources << {
|
|
||||||
def outputFile = file("src/main/resources")
|
|
||||||
outputFile.deleteDir()
|
|
||||||
copy {
|
|
||||||
from '../Common'
|
|
||||||
into 'src/main/resources'
|
|
||||||
exclude '**/*.java'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
processResources.dependsOn copyResources
|
|
||||||
|
|
||||||
|
|
||||||
task afterBuild << {
|
|
||||||
//renameSrgJar
|
|
||||||
def file0 = file("build/libs/${archivesBaseName}-${version}.jar")
|
|
||||||
def file1 = file("build/libs/${archivesBaseName}-${version}-srg.jar")
|
|
||||||
file0.renameTo(file1)
|
|
||||||
|
|
||||||
//reobfSrgToNotch
|
|
||||||
reobfSrgToNotch()
|
|
||||||
|
|
||||||
//copyBuildFile
|
|
||||||
copy {
|
|
||||||
from 'build/libs'
|
|
||||||
into '../build/libs'
|
|
||||||
include '**/*.jar'
|
|
||||||
exclude '**/*-srg.jar'
|
|
||||||
exclude '**/*-sources.jar'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
build.finalizedBy afterBuild
|
|
||||||
|
|
||||||
//notch pack
|
|
||||||
void reobfSrgToNotch(){
|
|
||||||
def srgName = "${archivesBaseName}-${version}-srg.jar"
|
|
||||||
def mcpName = srgName.replace('-srg', '-dev')
|
|
||||||
applySpecialSource(srgName,mcpName,"srg-mcp")
|
|
||||||
def notchName = srgName.replace('-srg', '')
|
|
||||||
applySpecialSource(mcpName,notchName,"mcp-notch")
|
|
||||||
}
|
|
||||||
|
|
||||||
void applySpecialSource(String inputName,String outputName,String srgType){
|
|
||||||
def mcpVersion = minecraft.mappings.replace('_',"/")
|
|
||||||
def mapping = new net.md_5.specialsource.JarMapping()
|
|
||||||
def srgFile = file(System.getProperty('user.home') + "/.gradle/caches/minecraft/net/minecraftforge/forge/${config.forge_mc_version}-${config.forge_version}/${mcpVersion}/srgs/${srgType}.srg")
|
|
||||||
def inputFile = file("build/libs/${inputName}")
|
|
||||||
def outputFile = file("build/libs/${outputName}")
|
|
||||||
def remapper = new net.md_5.specialsource.JarRemapper(null, mapping)
|
|
||||||
def inputJar = net.md_5.specialsource.Jar.init(inputFile)
|
|
||||||
def inheritanceProviders = new net.md_5.specialsource.provider.JointProvider()
|
|
||||||
def jarProvider = new net.md_5.specialsource.provider.JarProvider(inputJar)
|
|
||||||
inheritanceProviders.add(jarProvider)
|
|
||||||
mapping.loadMappings(srgFile)
|
|
||||||
mapping.setFallbackInheritanceProvider(inheritanceProviders)
|
|
||||||
remapper.remapJar(inputJar, outputFile)
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
minecraft_version=1.7.10
|
|
||||||
minecraft_full_versions=1.7.9,1.7.10
|
|
||||||
#forge gradle needs forge version
|
|
||||||
forge_mc_version=1.7.10
|
|
||||||
forge_version=10.13.4.1558-1.7.10
|
|
||||||
mappings_version=stable_12
|
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
package customskinloader.profile;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Model Manager for 1.7.10 and lower.
|
|
||||||
* A manager to check if model is available.
|
|
||||||
* It is the only class in package 'customskinloader' which has differences in different Minecraft version.
|
|
||||||
* @since 13.1
|
|
||||||
*/
|
|
||||||
public class ModelManager0 {
|
|
||||||
public static enum Model{
|
|
||||||
SKIN_DEFAULT,
|
|
||||||
SKIN_SLIM,
|
|
||||||
CAPE,
|
|
||||||
ELYTRA
|
|
||||||
}
|
|
||||||
private static HashMap<String,Model> models=new HashMap<String,Model>();
|
|
||||||
private static Type typeElytra=null;
|
|
||||||
static{
|
|
||||||
models.put("default", Model.SKIN_DEFAULT);
|
|
||||||
models.put("cape", Model.CAPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get enum for the model.
|
|
||||||
* @param model - string model
|
|
||||||
* @since 14.5
|
|
||||||
*/
|
|
||||||
public static Model getEnumModel(String model){
|
|
||||||
return models.get(model);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if model is skin.
|
|
||||||
* @since 14.5
|
|
||||||
* */
|
|
||||||
public static boolean isSkin(Model model){
|
|
||||||
return model==Model.SKIN_DEFAULT||model==Model.SKIN_SLIM;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if elytra is supported.
|
|
||||||
* @since 14.5
|
|
||||||
*/
|
|
||||||
public static boolean isElytraSupported(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse hashMapProfile to UserProfile
|
|
||||||
* @param profile - hashMapProfile (HashMap<String,MinecraftProfileTexture>)
|
|
||||||
* @return profile - UserProfile instance
|
|
||||||
* @since 13.1
|
|
||||||
*/
|
|
||||||
public static UserProfile toUserProfile(Map profile){
|
|
||||||
UserProfile userProfile=new UserProfile();
|
|
||||||
if(profile==null)
|
|
||||||
return userProfile;
|
|
||||||
MinecraftProfileTexture skin=(MinecraftProfileTexture)profile.get(Type.SKIN);
|
|
||||||
userProfile.skinUrl= skin==null?null:skin.getUrl();//Avoid NullPointerException
|
|
||||||
userProfile.model="default";
|
|
||||||
MinecraftProfileTexture cape=(MinecraftProfileTexture)profile.get(Type.CAPE);
|
|
||||||
userProfile.capeUrl= cape==null?null:cape.getUrl();
|
|
||||||
return userProfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse UserProfile to hashMapProfile
|
|
||||||
* @param profile - UserProfile instance
|
|
||||||
* @return profile - hashMapProfile (HashMap<String,MinecraftProfileTexture>)
|
|
||||||
* @since 13.1
|
|
||||||
*/
|
|
||||||
public static Map fromUserProfile(UserProfile profile){
|
|
||||||
Map map=Maps.newHashMap();
|
|
||||||
if(profile==null)
|
|
||||||
return map;
|
|
||||||
if(profile.skinUrl!=null)
|
|
||||||
map.put(Type.SKIN, getProfileTexture(profile.skinUrl,null));
|
|
||||||
if(profile.capeUrl!=null)
|
|
||||||
map.put(Type.CAPE, getProfileTexture(profile.capeUrl,null));
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse url to MinecraftProfileTexture
|
|
||||||
* Fix authlib 21 bug for 1.7.10
|
|
||||||
* @param url - textureUrl
|
|
||||||
* metadata - metadata
|
|
||||||
* @return MinecraftProfileTexture
|
|
||||||
* @since 14.5
|
|
||||||
*/
|
|
||||||
public static MinecraftProfileTexture getProfileTexture(String url,Map metadata){
|
|
||||||
Map hashMap=new HashMap<String,String>();
|
|
||||||
hashMap.put("url", url);
|
|
||||||
Gson gson=new Gson();
|
|
||||||
String json=gson.toJson(hashMap);
|
|
||||||
MinecraftProfileTexture pt=gson.fromJson(json, MinecraftProfileTexture.class);
|
|
||||||
return pt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
package customskinloader.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 SkinBuffer implements net.minecraft.client.renderer.IImageBuffer {
|
|
||||||
|
|
||||||
private int[] imageData;
|
|
||||||
private int ratio=1;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BufferedImage parseUserSkin(BufferedImage image) {
|
|
||||||
if(image==null)
|
|
||||||
return null;
|
|
||||||
ratio = image.getWidth() / 64;
|
|
||||||
BufferedImage bufferedimage = new BufferedImage(64 * ratio, 32 * ratio, 2);
|
|
||||||
Graphics graphics = bufferedimage.getGraphics();
|
|
||||||
graphics.setColor(new Color(0,0,0,0));
|
|
||||||
graphics.fillRect(0,0,64,32);
|
|
||||||
if (image.getHeight() == 64 * ratio){//Double layer
|
|
||||||
graphics.drawImage(image, 0 *ratio, 0 *ratio, 64*ratio, 32*ratio, 0 *ratio, 0 *ratio, 64*ratio, 32*ratio, (ImageObserver)null);
|
|
||||||
graphics.drawImage(image, 0 *ratio, 16*ratio, 64*ratio, 32*ratio, 0 *ratio, 32*ratio, 64*ratio, 48*ratio, (ImageObserver)null);
|
|
||||||
}else{
|
|
||||||
graphics.drawImage(image, 0, 0, (ImageObserver)null);
|
|
||||||
}
|
|
||||||
graphics.dispose();
|
|
||||||
this.imageData = ((DataBufferInt)bufferedimage.getRaster().getDataBuffer()).getData();
|
|
||||||
|
|
||||||
setAreaDueToConfig( 0 * ratio, 0 * ratio,32 * ratio,16 * ratio);//Head - 1
|
|
||||||
setAreaTransparent(32 * ratio, 0 * ratio,64 * ratio,16 * ratio);//Head - 2
|
|
||||||
|
|
||||||
setAreaDueToConfig( 0 * ratio,16 * ratio,16 * ratio,32 * ratio);//Leg - 1
|
|
||||||
setAreaDueToConfig(16 * ratio,16 * ratio,40 * ratio,32 * ratio);//Body - 1
|
|
||||||
setAreaDueToConfig(40 * ratio,16 * ratio,56 * ratio,32 * ratio);//Arm - 1
|
|
||||||
|
|
||||||
return bufferedimage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 2^24-1
|
|
||||||
* 00000000 11111111 11111111 11111111 */
|
|
||||||
private static final int A=16777215;
|
|
||||||
private static final int WHITE=getARGB(255,255,255,255);
|
|
||||||
private static final int BLACK=getARGB(255,0,0,0);
|
|
||||||
private boolean isFilled(int x0,int y0,int x1,int y1){
|
|
||||||
int data=this.imageData[getPosition(x0,y0)];
|
|
||||||
if(data!=WHITE && data!=BLACK)
|
|
||||||
return false;
|
|
||||||
for (int x=x0;x<x1;++x)
|
|
||||||
for (int y=y0;y<y1;++y)
|
|
||||||
if(this.imageData[getPosition(x,y)]!=data)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
private void setAreaTransparent(int x0,int y0,int x1,int y1){
|
|
||||||
if(!isFilled(x0,y0,x1,y1))
|
|
||||||
return;
|
|
||||||
for (int x=x0;x<x1;++x)
|
|
||||||
for (int y=y0;y<y1;++y)
|
|
||||||
this.imageData[getPosition(x,y)] &= A;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -2^24
|
|
||||||
* 00000001 00000000 00000000 00000000 ->
|
|
||||||
* 11111110 11111111 11111111 11111111 ->
|
|
||||||
* 11111111 00000000 00000000 00000000 */
|
|
||||||
private static final int B=-16777216;
|
|
||||||
private void setAreaOpaque(int x0,int y0,int x1,int y1){
|
|
||||||
for (int x=x0;x<x1;++x)
|
|
||||||
for (int y=y0;y<y1;++y)
|
|
||||||
this.imageData[getPosition(x,y)] |= B;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setAreaDueToConfig(int x0,int y0,int x1,int y1){
|
|
||||||
if(customskinloader.CustomSkinLoader.config.enableTransparentSkin)
|
|
||||||
setAreaTransparent(x0,y0,x1,y1);
|
|
||||||
else
|
|
||||||
setAreaOpaque(x0,y0,x1,y1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void func_152634_a(){
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int getARGB(int a,int r,int g,int b){
|
|
||||||
return (a << 24) | (r << 16) | (g << 8) | b;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getPosition(int x,int y){
|
|
||||||
return x+y*64*ratio;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,174 +0,0 @@
|
|||||||
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.HashMap;
|
|
||||||
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
|
|
||||||
{
|
|
||||||
public static final ResourceLocation DEFAULT_SKIN = new ResourceLocation("textures/entity/steve.png");
|
|
||||||
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;
|
|
||||||
private static final String __OBFID = "CL_00001830";
|
|
||||||
|
|
||||||
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()
|
|
||||||
{
|
|
||||||
private static final String __OBFID = "CL_00001829";
|
|
||||||
public Map func_152786_a(GameProfile p_152786_1_)
|
|
||||||
{
|
|
||||||
return Minecraft.getMinecraft().getSessionService().getTextures(p_152786_1_, false);
|
|
||||||
}
|
|
||||||
public Object load(Object p_load_1_)
|
|
||||||
{
|
|
||||||
return this.func_152786_a((GameProfile)p_load_1_);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//CustomSkinLoader Begin (Init)
|
|
||||||
customskinloader.loader.MojangAPILoader.defaultSessionService=sessionService;
|
|
||||||
customskinloader.utils.HttpTextureUtil.defaultCacheDir=skinCacheDirectory;
|
|
||||||
//CustomSkinLoader End
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used in the Skull renderer to fetch a skin. May download the skin if it's not in the cache
|
|
||||||
*/
|
|
||||||
public ResourceLocation loadSkin(MinecraftProfileTexture p_152792_1_, Type p_152792_2_)
|
|
||||||
{
|
|
||||||
return this.loadSkin(p_152792_1_, p_152792_2_, (SkinManager.SkinAvailableCallback)null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* May download the skin if its not in the cache, can be passed a SkinManager#SkinAvailableCallback for handling
|
|
||||||
*/
|
|
||||||
public ResourceLocation loadSkin(MinecraftProfileTexture p_152789_1_, final Type p_152789_2_, final SkinManager.SkinAvailableCallback p_152789_3_)
|
|
||||||
{
|
|
||||||
//CustomSkinLoader Begin (Parse HttpTextureInfo)
|
|
||||||
customskinloader.utils.HttpTextureUtil.HttpTextureInfo info=customskinloader.utils.HttpTextureUtil.toHttpTextureInfo(p_152789_1_.getUrl());
|
|
||||||
//CustomSkinLoader End
|
|
||||||
final ResourceLocation var4 = new ResourceLocation("skins/" + info.hash);//Modified
|
|
||||||
ITextureObject var5 = this.textureManager.getTexture(var4);
|
|
||||||
if (var5 != null)
|
|
||||||
{
|
|
||||||
if (p_152789_3_ != null)
|
|
||||||
{
|
|
||||||
p_152789_3_.onSkinAvailable(p_152789_2_, var4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
final IImageBuffer var8 = p_152789_2_ == Type.SKIN ? new customskinloader.renderer.SkinBuffer() : null;//Modified
|
|
||||||
ThreadDownloadImageData var9 = new ThreadDownloadImageData(info.cacheFile, info.url, DEFAULT_SKIN, new IImageBuffer()//Modified
|
|
||||||
{
|
|
||||||
private static final String __OBFID = "CL_00001828";
|
|
||||||
public BufferedImage parseUserSkin(BufferedImage p_78432_1_)
|
|
||||||
{
|
|
||||||
if (var8 != null)
|
|
||||||
{
|
|
||||||
p_78432_1_ = var8.parseUserSkin(p_78432_1_);
|
|
||||||
}
|
|
||||||
|
|
||||||
return p_78432_1_;
|
|
||||||
}
|
|
||||||
public void func_152634_a()
|
|
||||||
{
|
|
||||||
if (var8 != null)
|
|
||||||
{
|
|
||||||
var8.func_152634_a();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p_152789_3_ != null)
|
|
||||||
{
|
|
||||||
p_152789_3_.onSkinAvailable(p_152789_2_, var4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.textureManager.loadTexture(var4, var9);
|
|
||||||
}
|
|
||||||
|
|
||||||
return var4;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void func_152790_a(final GameProfile p_152790_1_, final SkinManager.SkinAvailableCallback p_152790_2_, final boolean p_152790_3_)
|
|
||||||
{
|
|
||||||
THREAD_POOL.submit(new Runnable()
|
|
||||||
{
|
|
||||||
private static final String __OBFID = "CL_00001827";
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
final HashMap var1 = Maps.newHashMap();
|
|
||||||
|
|
||||||
//CustomSkinLoader Begin (User Skin/Cape Part)
|
|
||||||
if(customskinloader.CustomSkinLoader.config.enable){
|
|
||||||
var1.putAll(customskinloader.CustomSkinLoader.loadProfile(p_152790_1_));
|
|
||||||
}else{
|
|
||||||
try{
|
|
||||||
var1.putAll(SkinManager.this.sessionService.getTextures(p_152790_1_, p_152790_3_));
|
|
||||||
}catch(InsecureTextureException var3){}
|
|
||||||
}
|
|
||||||
//CustomSkinLoader End
|
|
||||||
|
|
||||||
Minecraft.getMinecraft().addScheduledTask(new Runnable()
|
|
||||||
{
|
|
||||||
private static final String __OBFID = "CL_00001826";
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
if (var1.containsKey(Type.SKIN))
|
|
||||||
{
|
|
||||||
SkinManager.this.loadSkin((MinecraftProfileTexture)var1.get(Type.SKIN), Type.SKIN, p_152790_2_);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (var1.containsKey(Type.CAPE))
|
|
||||||
{
|
|
||||||
SkinManager.this.loadSkin((MinecraftProfileTexture)var1.get(Type.CAPE), Type.CAPE, p_152790_2_);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map loadSkinFromCache(GameProfile p_152788_1_)
|
|
||||||
{
|
|
||||||
//CustomSkinLoader Begin (Skull Part)
|
|
||||||
//return (Map)this.skinCacheLoader.getUnchecked(p_152788_1_);
|
|
||||||
return (customskinloader.CustomSkinLoader.config.enable && customskinloader.CustomSkinLoader.config.enableSkull)?
|
|
||||||
customskinloader.CustomSkinLoader.loadProfileFromCache(p_152788_1_):
|
|
||||||
(Map)this.skinCacheLoader.getUnchecked(p_152788_1_);
|
|
||||||
//CustomSkinLoader End
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface SkinAvailableCallback
|
|
||||||
{
|
|
||||||
void onSkinAvailable(Type skinPart, ResourceLocation skinLoc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
minecraft_version=1.8
|
|
||||||
minecraft_full_versions=1.8
|
|
||||||
#forge gradle needs forge version
|
|
||||||
forge_mc_version=1.8
|
|
||||||
forge_version=11.14.4.1563
|
|
||||||
mappings_version=stable_18
|
|
||||||
@@ -1,173 +0,0 @@
|
|||||||
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.HashMap;
|
|
||||||
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 skinCacheLoader;
|
|
||||||
private static final String __OBFID = "CL_00001830";
|
|
||||||
|
|
||||||
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()
|
|
||||||
{
|
|
||||||
private static final String __OBFID = "CL_00001829";
|
|
||||||
public Map func_152786_a(GameProfile profile)
|
|
||||||
{
|
|
||||||
return Minecraft.getMinecraft().getSessionService().getTextures(profile, false);
|
|
||||||
}
|
|
||||||
public Object load(Object p_load_1_)
|
|
||||||
{
|
|
||||||
return this.func_152786_a((GameProfile)p_load_1_);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//CustomSkinLoader Begin (Init)
|
|
||||||
customskinloader.loader.MojangAPILoader.defaultSessionService=sessionService;
|
|
||||||
customskinloader.utils.HttpTextureUtil.defaultCacheDir=skinCacheDirectory;
|
|
||||||
//CustomSkinLoader End
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 p_152792_2_)
|
|
||||||
{
|
|
||||||
return this.loadSkin(profileTexture, p_152792_2_, (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 p_152789_2_, final SkinManager.SkinAvailableCallback skinAvailableCallback)
|
|
||||||
{
|
|
||||||
//CustomSkinLoader Begin (Parse HttpTextureInfo)
|
|
||||||
customskinloader.utils.HttpTextureUtil.HttpTextureInfo info=customskinloader.utils.HttpTextureUtil.toHttpTextureInfo(profileTexture.getUrl());
|
|
||||||
//CustomSkinLoader End
|
|
||||||
final ResourceLocation var4 = new ResourceLocation("skins/" + info.hash);//Modified
|
|
||||||
ITextureObject var5 = this.textureManager.getTexture(var4);
|
|
||||||
|
|
||||||
if (var5 != null)
|
|
||||||
{
|
|
||||||
if (skinAvailableCallback != null)
|
|
||||||
{
|
|
||||||
skinAvailableCallback.skinAvailable(p_152789_2_, var4, profileTexture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
final IImageBuffer var8 = p_152789_2_ == Type.SKIN ? new customskinloader.renderer.SkinBuffer() : null;//Modified
|
|
||||||
ThreadDownloadImageData var9 = new ThreadDownloadImageData(info.cacheFile, info.url, DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer()//Modified
|
|
||||||
{
|
|
||||||
private static final String __OBFID = "CL_00001828";
|
|
||||||
public BufferedImage parseUserSkin(BufferedImage image)
|
|
||||||
{
|
|
||||||
if (var8 != null)
|
|
||||||
{
|
|
||||||
image = var8.parseUserSkin(image);
|
|
||||||
}
|
|
||||||
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
public void skinAvailable()
|
|
||||||
{
|
|
||||||
if (var8 != null)
|
|
||||||
{
|
|
||||||
var8.skinAvailable();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (skinAvailableCallback != null)
|
|
||||||
{
|
|
||||||
skinAvailableCallback.skinAvailable(p_152789_2_, var4, profileTexture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.textureManager.loadTexture(var4, var9);
|
|
||||||
}
|
|
||||||
|
|
||||||
return var4;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadProfileTextures(final GameProfile profile, final SkinManager.SkinAvailableCallback skinAvailableCallback, final boolean requireSecure)
|
|
||||||
{
|
|
||||||
THREAD_POOL.submit(new Runnable()
|
|
||||||
{
|
|
||||||
private static final String __OBFID = "CL_00001827";
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
final HashMap var1 = Maps.newHashMap();
|
|
||||||
|
|
||||||
//CustomSkinLoader Begin (User Skin/Cape Part)
|
|
||||||
if(customskinloader.CustomSkinLoader.config.enable){
|
|
||||||
var1.putAll(customskinloader.CustomSkinLoader.loadProfile(profile));
|
|
||||||
}else{
|
|
||||||
try{
|
|
||||||
var1.putAll(SkinManager.this.sessionService.getTextures(profile, requireSecure));
|
|
||||||
}catch(InsecureTextureException var3){}
|
|
||||||
}
|
|
||||||
//CustomSkinLoader End
|
|
||||||
|
|
||||||
Minecraft.getMinecraft().addScheduledTask(new Runnable()
|
|
||||||
{
|
|
||||||
private static final String __OBFID = "CL_00001826";
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
if (var1.containsKey(Type.SKIN))
|
|
||||||
{
|
|
||||||
SkinManager.this.loadSkin((MinecraftProfileTexture)var1.get(Type.SKIN), Type.SKIN, skinAvailableCallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (var1.containsKey(Type.CAPE))
|
|
||||||
{
|
|
||||||
SkinManager.this.loadSkin((MinecraftProfileTexture)var1.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):
|
|
||||||
(Map)this.skinCacheLoader.getUnchecked(profile);
|
|
||||||
//CustomSkinLoader End
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface SkinAvailableCallback
|
|
||||||
{
|
|
||||||
void skinAvailable(Type p_180521_1_, ResourceLocation location, MinecraftProfileTexture profileTexture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
minecraft_version=1.8.8
|
|
||||||
minecraft_full_versions=1.8.4,1.8.5,1.8.6,1.8.7,1.8.8,1.8.9
|
|
||||||
#forge gradle needs forge version
|
|
||||||
forge_mc_version=1.8.9
|
|
||||||
forge_version=11.15.1.1722
|
|
||||||
mappings_version=stable_22
|
|
||||||
@@ -1,163 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//CustomSkinLoader Begin (Init)
|
|
||||||
customskinloader.loader.MojangAPILoader.defaultSessionService=sessionService;
|
|
||||||
customskinloader.utils.HttpTextureUtil.defaultCacheDir=skinCacheDirectory;
|
|
||||||
//CustomSkinLoader End
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 p_152792_2_)
|
|
||||||
{
|
|
||||||
return this.loadSkin(profileTexture, p_152792_2_, (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 p_152789_2_, final SkinManager.SkinAvailableCallback skinAvailableCallback)
|
|
||||||
{
|
|
||||||
//CustomSkinLoader Begin (Parse HttpTextureInfo)
|
|
||||||
customskinloader.utils.HttpTextureUtil.HttpTextureInfo info=customskinloader.utils.HttpTextureUtil.toHttpTextureInfo(profileTexture.getUrl());
|
|
||||||
//CustomSkinLoader End
|
|
||||||
final ResourceLocation resourcelocation = new ResourceLocation("skins/" + info.hash);//Modified
|
|
||||||
ITextureObject itextureobject = this.textureManager.getTexture(resourcelocation);
|
|
||||||
|
|
||||||
if (itextureobject != null)
|
|
||||||
{
|
|
||||||
if (skinAvailableCallback != null)
|
|
||||||
{
|
|
||||||
skinAvailableCallback.skinAvailable(p_152789_2_, resourcelocation, profileTexture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
final IImageBuffer iimagebuffer = p_152789_2_ == Type.SKIN ? new customskinloader.renderer.SkinBuffer() : null;//Modified
|
|
||||||
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(info.cacheFile, info.url, DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer()//Modified
|
|
||||||
{
|
|
||||||
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(p_152789_2_, 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();
|
|
||||||
|
|
||||||
//CustomSkinLoader Begin (User Skin/Cape Part)
|
|
||||||
if(customskinloader.CustomSkinLoader.config.enable){
|
|
||||||
map.putAll(customskinloader.CustomSkinLoader.loadProfile(profile));
|
|
||||||
}else{
|
|
||||||
try{
|
|
||||||
map.putAll(SkinManager.this.sessionService.getTextures(profile, requireSecure));
|
|
||||||
}catch(InsecureTextureException var3){}
|
|
||||||
}
|
|
||||||
//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)
|
|
||||||
{
|
|
||||||
//CustomSkinLoader Begin (Skull Part)
|
|
||||||
//return (Map)this.skinCacheLoader.getUnchecked(profile);
|
|
||||||
return (customskinloader.CustomSkinLoader.config.enable && customskinloader.CustomSkinLoader.config.enableSkull)?
|
|
||||||
customskinloader.CustomSkinLoader.loadProfileFromCache(profile):
|
|
||||||
this.skinCacheLoader.getUnchecked(profile);
|
|
||||||
//CustomSkinLoader End
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface SkinAvailableCallback
|
|
||||||
{
|
|
||||||
void skinAvailable(Type p_180521_1_, ResourceLocation location, MinecraftProfileTexture profileTexture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
minecraft_version=1.9
|
|
||||||
minecraft_full_versions=1.9
|
|
||||||
#forge gradle needs forge version
|
|
||||||
forge_mc_version=1.9
|
|
||||||
forge_version=12.16.1.1887
|
|
||||||
mappings_version=stable_24
|
|
||||||
@@ -1,161 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//CustomSkinLoader Begin (Init)
|
|
||||||
customskinloader.loader.MojangAPILoader.defaultSessionService=sessionService;
|
|
||||||
customskinloader.utils.HttpTextureUtil.defaultCacheDir=skinCacheDirectory;
|
|
||||||
//CustomSkinLoader End
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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)
|
|
||||||
{
|
|
||||||
//CustomSkinLoader Begin (Parse HttpTextureInfo)
|
|
||||||
customskinloader.utils.HttpTextureUtil.HttpTextureInfo info=customskinloader.utils.HttpTextureUtil.toHttpTextureInfo(profileTexture.getUrl());
|
|
||||||
//CustomSkinLoader End
|
|
||||||
final ResourceLocation resourcelocation = new ResourceLocation("skins/" + info.hash);//Modified
|
|
||||||
ITextureObject itextureobject = this.textureManager.getTexture(resourcelocation);
|
|
||||||
|
|
||||||
if (itextureobject != null)
|
|
||||||
{
|
|
||||||
if (skinAvailableCallback != null)
|
|
||||||
{
|
|
||||||
skinAvailableCallback.skinAvailable(textureType, resourcelocation, profileTexture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
final IImageBuffer iimagebuffer = textureType == Type.SKIN ? new customskinloader.renderer.SkinBuffer() : null;//Modified
|
|
||||||
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(info.cacheFile, info.url, DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer()//Modified
|
|
||||||
{
|
|
||||||
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();
|
|
||||||
|
|
||||||
//CustomSkinLoader Begin (User Profile Part)
|
|
||||||
if(customskinloader.CustomSkinLoader.config.enable){
|
|
||||||
map.putAll(customskinloader.CustomSkinLoader.loadProfile(profile));
|
|
||||||
}else{
|
|
||||||
try{
|
|
||||||
map.putAll(SkinManager.this.sessionService.getTextures(profile, requireSecure));
|
|
||||||
}catch(InsecureTextureException var3){}
|
|
||||||
}
|
|
||||||
//CustomSkinLoader End
|
|
||||||
|
|
||||||
Minecraft.getMinecraft().addScheduledTask(new Runnable()
|
|
||||||
{
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
//CustomSkinLoader Begin (Loading Task)
|
|
||||||
for(Type type:Type.values()){
|
|
||||||
if(map.containsKey(type))
|
|
||||||
SkinManager.this.loadSkin((MinecraftProfileTexture)map.get(type), type, skinAvailableCallback);
|
|
||||||
}
|
|
||||||
//CustomSkinLoader End
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<Type, MinecraftProfileTexture> 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):
|
|
||||||
this.skinCacheLoader.getUnchecked(profile);
|
|
||||||
//CustomSkinLoader End
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface SkinAvailableCallback
|
|
||||||
{
|
|
||||||
void skinAvailable(Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
minecraft_version=1.9.4
|
|
||||||
minecraft_full_versions=1.9.3,1.9.4
|
|
||||||
#forge gradle needs forge version
|
|
||||||
forge_mc_version=1.9.4
|
|
||||||
forge_version=12.17.0.1976
|
|
||||||
mappings_version=stable_26
|
|
||||||
@@ -1,161 +0,0 @@
|
|||||||
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<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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//CustomSkinLoader Begin (Init)
|
|
||||||
customskinloader.loader.MojangAPILoader.defaultSessionService=sessionService;
|
|
||||||
customskinloader.utils.HttpTextureUtil.defaultCacheDir=skinCacheDirectory;
|
|
||||||
//CustomSkinLoader End
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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)
|
|
||||||
{
|
|
||||||
//CustomSkinLoader Begin (Parse HttpTextureInfo)
|
|
||||||
customskinloader.utils.HttpTextureUtil.HttpTextureInfo info=customskinloader.utils.HttpTextureUtil.toHttpTextureInfo(profileTexture.getUrl());
|
|
||||||
//CustomSkinLoader End
|
|
||||||
final ResourceLocation resourcelocation = new ResourceLocation("skins/" + info.hash);//Modified
|
|
||||||
ITextureObject itextureobject = this.textureManager.getTexture(resourcelocation);
|
|
||||||
|
|
||||||
if (itextureobject != null)
|
|
||||||
{
|
|
||||||
if (skinAvailableCallback != null)
|
|
||||||
{
|
|
||||||
skinAvailableCallback.skinAvailable(textureType, resourcelocation, profileTexture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
final IImageBuffer iimagebuffer = textureType == Type.SKIN ? new customskinloader.renderer.SkinBuffer() : null;//Modified
|
|
||||||
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(info.cacheFile, info.url, DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer()//Modified
|
|
||||||
{
|
|
||||||
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();
|
|
||||||
|
|
||||||
//CustomSkinLoader Begin (User Profile Part)
|
|
||||||
if(customskinloader.CustomSkinLoader.config.enable){
|
|
||||||
map.putAll(customskinloader.CustomSkinLoader.loadProfile(profile));
|
|
||||||
}else{
|
|
||||||
try{
|
|
||||||
map.putAll(SkinManager.this.sessionService.getTextures(profile, requireSecure));
|
|
||||||
}catch(InsecureTextureException var3){}
|
|
||||||
}
|
|
||||||
//CustomSkinLoader End
|
|
||||||
|
|
||||||
Minecraft.getMinecraft().addScheduledTask(new Runnable()
|
|
||||||
{
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
//CustomSkinLoader Begin (Loading Task)
|
|
||||||
for(Type type:Type.values()){
|
|
||||||
if(map.containsKey(type))
|
|
||||||
SkinManager.this.loadSkin((MinecraftProfileTexture)map.get(type), type, skinAvailableCallback);
|
|
||||||
}
|
|
||||||
//CustomSkinLoader End
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<Type, MinecraftProfileTexture> 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):
|
|
||||||
this.skinCacheLoader.getUnchecked(profile);
|
|
||||||
//CustomSkinLoader End
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface SkinAvailableCallback
|
|
||||||
{
|
|
||||||
void skinAvailable(Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
package customskinloader.loader;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.prefs.Preferences;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
|
||||||
|
|
||||||
import customskinloader.CustomSkinLoader;
|
|
||||||
import customskinloader.config.SkinSiteProfile;
|
|
||||||
import customskinloader.loader.ProfileLoader.IProfileLoader;
|
|
||||||
import customskinloader.profile.UserProfile;
|
|
||||||
import customskinloader.utils.HttpRequestUtil;
|
|
||||||
import customskinloader.utils.HttpRequestUtil.HttpRequest;
|
|
||||||
import customskinloader.utils.HttpRequestUtil.HttpResponce;
|
|
||||||
import customskinloader.utils.MinecraftUtil;
|
|
||||||
|
|
||||||
//For ElfSkin http://www.mcelf.com/s/mcskin
|
|
||||||
public class ElfSkinLoader implements IProfileLoader {
|
|
||||||
private static final String LOGIN_URL="http://status.mcelf.com/login?gid=%SERVER_IP%&name=%USERNAME%&oid=%ELF_ID%";
|
|
||||||
private static final String LOGOUT_URL="http://status.mcelf.com/logout?gid=%SERVER_IP%&name=%USERNAME%";
|
|
||||||
private static final String PROFILE_URL="http://status.mcelf.com/s?gid=%SERVER_IP%&name=%USERNAME%";
|
|
||||||
|
|
||||||
private static String elfID=Preferences.userRoot().node("elfskin").get("elfid", "null");
|
|
||||||
private static String lastLoginServer=null;
|
|
||||||
private static HashMap<String,Profile> cache=new HashMap<String, Profile>();
|
|
||||||
@Override
|
|
||||||
public UserProfile loadProfile(SkinSiteProfile ssp, GameProfile gameProfile) throws Exception {
|
|
||||||
String username=gameProfile.getName();
|
|
||||||
String ip=MinecraftUtil.getServerAddress();
|
|
||||||
if(elfID!=null && isIPChange(ip)){
|
|
||||||
if(lastLoginServer!=null)
|
|
||||||
makeLogout(lastLoginServer,MinecraftUtil.getCurrentUsername());
|
|
||||||
Profile[] ps=makeLogin(ip,MinecraftUtil.getCurrentUsername(),elfID);
|
|
||||||
cache.clear();
|
|
||||||
for(Profile pp:ps){
|
|
||||||
cache.put(pp.name, pp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Profile p=cache.containsKey(username)?cache.get(username):getProfile(MinecraftUtil.getServerAddress(),username);
|
|
||||||
if(p==null)
|
|
||||||
return null;
|
|
||||||
UserProfile profile=new UserProfile();
|
|
||||||
profile.skinUrl=p.skin;
|
|
||||||
profile.capeUrl=p.cape;
|
|
||||||
if(profile.isEmpty()){
|
|
||||||
CustomSkinLoader.logger.info("Profile is empty.");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return profile;
|
|
||||||
}
|
|
||||||
private boolean isIPChange(String newIP){
|
|
||||||
return lastLoginServer==null ? newIP!=null : !lastLoginServer.equalsIgnoreCase(newIP);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Profile[] makeLogin(String ip,String username,String elfID){
|
|
||||||
String url=LOGIN_URL.replaceAll("%SERVER_IP%", ip).replaceAll("%USERNAME%", username).replaceAll("%ELF_ID%", elfID);
|
|
||||||
HttpResponce responce=HttpRequestUtil.makeHttpRequest(new HttpRequest(url));
|
|
||||||
|
|
||||||
if(!responce.success||StringUtils.isEmpty(responce.content)){
|
|
||||||
CustomSkinLoader.logger.info("Request failed.");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
BasicResponce r=CustomSkinLoader.GSON.fromJson(responce.content, BasicResponce.class);
|
|
||||||
if(r.error!=0){
|
|
||||||
CustomSkinLoader.logger.info("Error "+r.error+": "+r.msg);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if(r.players==null||r.players.length==0){
|
|
||||||
CustomSkinLoader.logger.info("No Profile found.");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.players;
|
|
||||||
}
|
|
||||||
public static void makeLogout(String ip,String username){
|
|
||||||
String url=LOGOUT_URL.replaceAll("%SERVER_IP%", ip).replaceAll("%USERNAME%", username);
|
|
||||||
HttpResponce responce=HttpRequestUtil.makeHttpRequest(new HttpRequest(url).setCacheTime(-1));
|
|
||||||
}
|
|
||||||
public static Profile getProfile(String ip,String username){
|
|
||||||
String url=PROFILE_URL.replaceAll("%SERVER_IP%", ip).replaceAll("%USERNAME%", username);
|
|
||||||
HttpResponce responce=HttpRequestUtil.makeHttpRequest(new HttpRequest(url));
|
|
||||||
|
|
||||||
if(!responce.success||StringUtils.isEmpty(responce.content)){
|
|
||||||
CustomSkinLoader.logger.info("Request failed.");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
BasicResponce r=CustomSkinLoader.GSON.fromJson(responce.content, BasicResponce.class);
|
|
||||||
if(r.error!=0){
|
|
||||||
CustomSkinLoader.logger.info("Error "+r.error+": "+r.msg);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if(r.players==null||r.players.length==0){
|
|
||||||
CustomSkinLoader.logger.info("Profile not found.");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.players[0];
|
|
||||||
}
|
|
||||||
private static class BasicResponce{
|
|
||||||
int error;
|
|
||||||
String msg;
|
|
||||||
|
|
||||||
String gid;
|
|
||||||
String expired_at;
|
|
||||||
Profile[] players;
|
|
||||||
}
|
|
||||||
private static class Profile{
|
|
||||||
String name;
|
|
||||||
String login_time;
|
|
||||||
String skin;
|
|
||||||
String cape;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean compare(SkinSiteProfile ssp0, SkinSiteProfile ssp1) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "ElfSkin";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initLocalFolder(SkinSiteProfile ssp) {
|
|
||||||
//No local skin
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File renamed without changes.
File renamed without changes.
+19
-5
@@ -28,13 +28,15 @@ public class CustomSkinLoader {
|
|||||||
public static final String CustomSkinLoader_VERSION="@MOD_VERSION@";
|
public static final String CustomSkinLoader_VERSION="@MOD_VERSION@";
|
||||||
public static final String CustomSkinLoader_FULL_VERSION="@MOD_FULL_VERSION@";
|
public static final String CustomSkinLoader_FULL_VERSION="@MOD_FULL_VERSION@";
|
||||||
|
|
||||||
public static final File DATA_DIR=new File(MinecraftUtil.getMinecraftDataDir0(),"CustomSkinLoader"),
|
public static final File DATA_DIR=new File(MinecraftUtil.getMinecraftDataDir(),"CustomSkinLoader"),
|
||||||
LOG_FILE=new File(DATA_DIR,"CustomSkinLoader.log"),
|
LOG_FILE=new File(DATA_DIR,"CustomSkinLoader.log"),
|
||||||
CONFIG_FILE=new File(DATA_DIR,"CustomSkinLoader.json");
|
CONFIG_FILE=new File(DATA_DIR,"CustomSkinLoader.json");
|
||||||
public static final SkinSiteProfile[] DEFAULT_LOAD_LIST={
|
public static final SkinSiteProfile[] DEFAULT_LOAD_LIST={
|
||||||
SkinSiteProfile.createMojangAPI("Mojang"),
|
SkinSiteProfile.createMojangAPI("Mojang"),
|
||||||
|
SkinSiteProfile.createCustomSkinAPI("LittleSkin","https://mcskin.littleservice.cn/"),
|
||||||
SkinSiteProfile.createCustomSkinAPI("BlessingSkin","http://skin.prinzeugen.net/"),
|
SkinSiteProfile.createCustomSkinAPI("BlessingSkin","http://skin.prinzeugen.net/"),
|
||||||
SkinSiteProfile.createCustomSkinAPI("OneSkin","http://fleey.org/skin/skin_user/skin_json.php/"),
|
//OneSkin has been removed temporarily
|
||||||
|
//SkinSiteProfile.createCustomSkinAPI("OneSkin","http://fleey.cn/skin/skin_user/skin_json.php/"),
|
||||||
//Minecrack could not load skin correctly
|
//Minecrack could not load skin correctly
|
||||||
//SkinSiteProfile.creatLegacy("Minecrack","http://minecrack.fr.nf/mc/skinsminecrackd/{USERNAME}.png","http://minecrack.fr.nf/mc/cloaksminecrackd/{USERNAME}.png",null),
|
//SkinSiteProfile.creatLegacy("Minecrack","http://minecrack.fr.nf/mc/skinsminecrackd/{USERNAME}.png","http://minecrack.fr.nf/mc/cloaksminecrackd/{USERNAME}.png",null),
|
||||||
SkinSiteProfile.createUniSkinAPI("SkinMe","http://www.skinme.cc/uniskin/"),
|
SkinSiteProfile.createUniSkinAPI("SkinMe","http://www.skinme.cc/uniskin/"),
|
||||||
@@ -84,6 +86,8 @@ public class CustomSkinLoader {
|
|||||||
logger.info("LoadList is Empty.");
|
logger.info("LoadList is Empty.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UserProfile profile0=new UserProfile();
|
||||||
for(int i=0;i<config.loadlist.size();i++){
|
for(int i=0;i<config.loadlist.size();i++){
|
||||||
SkinSiteProfile ssp=config.loadlist.get(i);
|
SkinSiteProfile ssp=config.loadlist.get(i);
|
||||||
logger.info((i+1)+"/"+config.loadlist.size()+" Try to load profile from '"+ssp.name+"'.");
|
logger.info((i+1)+"/"+config.loadlist.size()+" Try to load profile from '"+ssp.name+"'.");
|
||||||
@@ -101,13 +105,23 @@ public class CustomSkinLoader {
|
|||||||
}
|
}
|
||||||
if(profile==null)
|
if(profile==null)
|
||||||
continue;
|
continue;
|
||||||
|
if(!config.forceLoadAllTextures){
|
||||||
|
profile0=profile;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
profile0.mix(profile);
|
||||||
|
if(profile0.isFull())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(!profile0.isEmpty()){
|
||||||
logger.info(username+"'s profile loaded.");
|
logger.info(username+"'s profile loaded.");
|
||||||
profileCache.updateCache(username, profile);
|
profileCache.updateCache(username, profile0);
|
||||||
profileCache.setLoading(username, false);
|
profileCache.setLoading(username, false);
|
||||||
logger.info(profile.toString(profileCache.getExpiry(username)));
|
logger.info(profile0.toString(profileCache.getExpiry(username)));
|
||||||
return profile;
|
return profile0;
|
||||||
}
|
}
|
||||||
logger.info(username+"'s profile not found in load list.");
|
logger.info(username+"'s profile not found in load list.");
|
||||||
|
|
||||||
if(config.enableLocalProfileCache){
|
if(config.enableLocalProfileCache){
|
||||||
UserProfile profile=profileCache.getLocalProfile(username);
|
UserProfile profile=profileCache.getLocalProfile(username);
|
||||||
if(profile==null)
|
if(profile==null)
|
||||||
@@ -62,7 +62,7 @@ public class Logger {
|
|||||||
StringBuilder sb=new StringBuilder();
|
StringBuilder sb=new StringBuilder();
|
||||||
sb.append("[").append(Thread.currentThread().getName()).append(" ").append(level.getName()).append("] ");
|
sb.append("[").append(Thread.currentThread().getName()).append(" ").append(level.getName()).append("] ");
|
||||||
sb.append(msg);
|
sb.append(msg);
|
||||||
if(level.display)
|
if(level.display())
|
||||||
System.out.println(sb.toString());
|
System.out.println(sb.toString());
|
||||||
if(writer==null)
|
if(writer==null)
|
||||||
return;
|
return;
|
||||||
+11
-7
@@ -17,14 +17,13 @@ import customskinloader.utils.HttpUtil0;
|
|||||||
public class Config {
|
public class Config {
|
||||||
//Program
|
//Program
|
||||||
public String version;
|
public String version;
|
||||||
public boolean enable=true;
|
|
||||||
public List<SkinSiteProfile> loadlist;
|
public List<SkinSiteProfile> loadlist;
|
||||||
|
|
||||||
//Function
|
//Function
|
||||||
public boolean enableSkull=true;
|
|
||||||
public boolean enableDynamicSkull=true;
|
public boolean enableDynamicSkull=true;
|
||||||
public boolean enableTransparentSkin=true;
|
public boolean enableTransparentSkin=true;
|
||||||
public boolean ignoreHttpsCertificate=false;
|
public boolean ignoreHttpsCertificate=false;
|
||||||
|
public boolean forceLoadAllTextures=false;
|
||||||
|
|
||||||
//Cache
|
//Cache
|
||||||
public int cacheExpiry=10;
|
public int cacheExpiry=10;
|
||||||
@@ -58,14 +57,17 @@ public class Config {
|
|||||||
if(config.ignoreHttpsCertificate)
|
if(config.ignoreHttpsCertificate)
|
||||||
HttpUtil0.ignoreHttpsCertificate();
|
HttpUtil0.ignoreHttpsCertificate();
|
||||||
if(config.enableCacheAutoClean && !config.enableLocalProfileCache){
|
if(config.enableCacheAutoClean && !config.enableLocalProfileCache){
|
||||||
HttpRequestUtil.CACHE_DIR.delete();
|
try{
|
||||||
HttpTextureUtil.cleanCacheDir();
|
FileUtils.deleteDirectory(HttpRequestUtil.CACHE_DIR);
|
||||||
|
FileUtils.deleteDirectory(HttpTextureUtil.getCacheDir());
|
||||||
|
CustomSkinLoader.logger.info("Successfully cleaned cache.");
|
||||||
|
}catch(Exception e){
|
||||||
|
CustomSkinLoader.logger.warning("Exception occurs while cleaning cache: "+e.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Output config
|
//Output config
|
||||||
CustomSkinLoader.logger.info("Enable:"+config.enable+
|
CustomSkinLoader.logger.info("EnableDynamicSkull:"+config.enableDynamicSkull+
|
||||||
", EnableSkull:"+config.enableSkull+
|
|
||||||
", EnableDynamicSkull:"+config.enableDynamicSkull+
|
|
||||||
", EnableTranSkin:"+config.enableTransparentSkin+
|
", EnableTranSkin:"+config.enableTransparentSkin+
|
||||||
", IgnoreHttpsCertificate:"+config.ignoreHttpsCertificate+
|
", IgnoreHttpsCertificate:"+config.ignoreHttpsCertificate+
|
||||||
", CacheExpiry:"+config.cacheExpiry+
|
", CacheExpiry:"+config.cacheExpiry+
|
||||||
@@ -80,6 +82,8 @@ public class Config {
|
|||||||
try{
|
try{
|
||||||
floatVersion=Float.parseFloat(CustomSkinLoader.CustomSkinLoader_VERSION);
|
floatVersion=Float.parseFloat(CustomSkinLoader.CustomSkinLoader_VERSION);
|
||||||
configVersion=Float.parseFloat(config.version);
|
configVersion=Float.parseFloat(config.version);
|
||||||
|
if(configVersion==15.1f)//To avoid some bug
|
||||||
|
configVersion=14.6f;
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
CustomSkinLoader.logger.warning("Exception occurs while parsing version: "+e.toString());
|
CustomSkinLoader.logger.warning("Exception occurs while parsing version: "+e.toString());
|
||||||
}
|
}
|
||||||
File renamed without changes.
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
package customskinloader.renderer;
|
package customskinloader.fake;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
@@ -6,7 +6,7 @@ import java.awt.image.BufferedImage;
|
|||||||
import java.awt.image.DataBufferInt;
|
import java.awt.image.DataBufferInt;
|
||||||
import java.awt.image.ImageObserver;
|
import java.awt.image.ImageObserver;
|
||||||
|
|
||||||
public class SkinBuffer implements net.minecraft.client.renderer.IImageBuffer {
|
public class FakeSkinBuffer implements net.minecraft.client.renderer.IImageBuffer {
|
||||||
|
|
||||||
private int[] imageData;
|
private int[] imageData;
|
||||||
private int ratio=1;
|
private int ratio=1;
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
package customskinloader.fake;
|
||||||
|
|
||||||
|
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 com.google.common.collect.Maps;
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||||
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||||
|
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||||
|
|
||||||
|
import customskinloader.CustomSkinLoader;
|
||||||
|
import customskinloader.utils.HttpTextureUtil;
|
||||||
|
import customskinloader.utils.HttpTextureUtil.HttpTextureInfo;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.IImageBuffer;
|
||||||
|
import net.minecraft.client.renderer.ThreadDownloadImageData;
|
||||||
|
import net.minecraft.client.renderer.texture.ITextureObject;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureManager;
|
||||||
|
import net.minecraft.client.resources.DefaultPlayerSkin;
|
||||||
|
import net.minecraft.client.resources.SkinManager.SkinAvailableCallback;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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());
|
||||||
|
|
||||||
|
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{
|
||||||
|
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(info.cacheFile, info.url, DefaultPlayerSkin.getDefaultSkinLegacy(),
|
||||||
|
new BaseBuffer(skinAvailableCallback, textureType, resourcelocation, profileTexture));
|
||||||
|
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(){
|
||||||
|
final Map<Type, MinecraftProfileTexture> map = Maps.<Type, MinecraftProfileTexture>newHashMap();
|
||||||
|
map.putAll(customskinloader.CustomSkinLoader.loadProfile(profile));
|
||||||
|
|
||||||
|
Minecraft.getMinecraft().addScheduledTask(new Runnable(){
|
||||||
|
public void run(){
|
||||||
|
for(Type type:Type.values())
|
||||||
|
if(map.containsKey(type))
|
||||||
|
FakeSkinManager.this.loadSkin((MinecraftProfileTexture)map.get(type), type, skinAvailableCallback);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public Map<Type, MinecraftProfileTexture> loadSkinFromCache(GameProfile profile){
|
||||||
|
return CustomSkinLoader.loadProfileFromCache(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void makeCallback(SkinAvailableCallback callback,Type type, ResourceLocation location, MinecraftProfileTexture texture){
|
||||||
|
if(callback!=null)
|
||||||
|
callback.skinAvailable(type, location, texture);
|
||||||
|
}
|
||||||
|
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 BufferedImage parseUserSkin(BufferedImage image){
|
||||||
|
return buffer==null?image:buffer.parseUserSkin(image);
|
||||||
|
}
|
||||||
|
public void skinAvailable(){
|
||||||
|
if (buffer != null)
|
||||||
|
buffer.skinAvailable();
|
||||||
|
|
||||||
|
FakeSkinManager.makeCallback(callback,type, location, texture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
File renamed without changes.
File renamed without changes.
+2
-5
@@ -25,16 +25,13 @@ import customskinloader.profile.UserProfile;
|
|||||||
import customskinloader.utils.HttpRequestUtil;
|
import customskinloader.utils.HttpRequestUtil;
|
||||||
import customskinloader.utils.HttpRequestUtil.HttpRequest;
|
import customskinloader.utils.HttpRequestUtil.HttpRequest;
|
||||||
import customskinloader.utils.HttpRequestUtil.HttpResponce;
|
import customskinloader.utils.HttpRequestUtil.HttpResponce;
|
||||||
|
import customskinloader.utils.MinecraftUtil;
|
||||||
|
|
||||||
public class MojangAPILoader implements ProfileLoader.IProfileLoader {
|
public class MojangAPILoader implements ProfileLoader.IProfileLoader {
|
||||||
|
|
||||||
public static MinecraftSessionService defaultSessionService=null;
|
public static final MinecraftSessionService defaultSessionService=MinecraftUtil.getSessionService();
|
||||||
@Override
|
@Override
|
||||||
public UserProfile loadProfile(SkinSiteProfile ssp, GameProfile gameProfile) throws Exception {
|
public UserProfile loadProfile(SkinSiteProfile ssp, GameProfile gameProfile) throws Exception {
|
||||||
if(defaultSessionService==null){
|
|
||||||
CustomSkinLoader.logger.warning("Session Service Not Exist.");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
Map<MinecraftProfileTexture.Type,MinecraftProfileTexture> map=getTextures(gameProfile);
|
Map<MinecraftProfileTexture.Type,MinecraftProfileTexture> map=getTextures(gameProfile);
|
||||||
if(!map.isEmpty()){
|
if(!map.isEmpty()){
|
||||||
CustomSkinLoader.logger.info("Default profile will be used.");
|
CustomSkinLoader.logger.info("Default profile will be used.");
|
||||||
+1
-2
@@ -13,8 +13,7 @@ public class ProfileLoader {
|
|||||||
new JsonAPILoader(JsonAPILoader.Type.CustomSkinAPI),
|
new JsonAPILoader(JsonAPILoader.Type.CustomSkinAPI),
|
||||||
new JsonAPILoader(JsonAPILoader.Type.CustomSkinAPIPlus),
|
new JsonAPILoader(JsonAPILoader.Type.CustomSkinAPIPlus),
|
||||||
new LegacyLoader(),
|
new LegacyLoader(),
|
||||||
new JsonAPILoader(JsonAPILoader.Type.UniSkinAPI),
|
new JsonAPILoader(JsonAPILoader.Type.UniSkinAPI)};
|
||||||
new ElfSkinLoader()};
|
|
||||||
|
|
||||||
public static final HashMap<String,IProfileLoader> LOADERS=initLoaders();
|
public static final HashMap<String,IProfileLoader> LOADERS=initLoaders();
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
+2
@@ -35,6 +35,8 @@ public class UniSkinAPI implements IJsonAPI {
|
|||||||
|
|
||||||
if(profile.skins==null||profile.skins.isEmpty())
|
if(profile.skins==null||profile.skins.isEmpty())
|
||||||
return p;
|
return p;
|
||||||
|
if(profile.model_preference==null||profile.model_preference.isEmpty())
|
||||||
|
return p;
|
||||||
|
|
||||||
boolean hasSkin=false;
|
boolean hasSkin=false;
|
||||||
for(String model:profile.model_preference){
|
for(String model:profile.model_preference){
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+23
-1
@@ -64,7 +64,11 @@ public class UserProfile {
|
|||||||
return toString(0);
|
return toString(0);
|
||||||
}
|
}
|
||||||
public String toString(long expiry){
|
public String toString(long expiry){
|
||||||
return "(SkinUrl: "+skinUrl+" , Model: "+model+" , CapeUrl: "+capeUrl+" , ElytraUrl: "+elytraUrl+(expiry==0?"":(" , Expiry: "+expiry))+")";
|
return "(SkinUrl: "+skinUrl+
|
||||||
|
" , Model: "+model+
|
||||||
|
" , CapeUrl: "+capeUrl+
|
||||||
|
(StringUtils.isBlank(elytraUrl)?" ":" , ElytraUrl: "+elytraUrl)+
|
||||||
|
(expiry==0?"":(" , Expiry: "+expiry))+")";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -74,7 +78,25 @@ public class UserProfile {
|
|||||||
public boolean isEmpty(){
|
public boolean isEmpty(){
|
||||||
return StringUtils.isEmpty(skinUrl) && StringUtils.isEmpty(capeUrl) && StringUtils.isEmpty(elytraUrl);
|
return StringUtils.isEmpty(skinUrl) && StringUtils.isEmpty(capeUrl) && StringUtils.isEmpty(elytraUrl);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Check if the instance is full(Both skin and cape).
|
||||||
|
* @return status (true - full)
|
||||||
|
* @since 14.7
|
||||||
|
*/
|
||||||
|
public boolean isFull(){
|
||||||
|
return StringUtils.isNoneBlank(skinUrl,capeUrl);
|
||||||
|
}
|
||||||
public boolean hasSkinUrl(){
|
public boolean hasSkinUrl(){
|
||||||
return StringUtils.isNotEmpty(skinUrl);
|
return StringUtils.isNotEmpty(skinUrl);
|
||||||
}
|
}
|
||||||
|
public void mix(UserProfile profile){
|
||||||
|
if(profile==null)
|
||||||
|
return;
|
||||||
|
if(StringUtils.isEmpty(this.skinUrl))
|
||||||
|
this.skinUrl=profile.skinUrl;
|
||||||
|
if(StringUtils.isEmpty(this.capeUrl))
|
||||||
|
this.capeUrl=profile.capeUrl;
|
||||||
|
if(StringUtils.isEmpty(this.elytraUrl))
|
||||||
|
this.elytraUrl=profile.elytraUrl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+11
-6
@@ -27,11 +27,11 @@ public class ClassTransformer implements IClassTransformer {
|
|||||||
URL urls[] = ucl.getURLs();
|
URL urls[] = ucl.getURLs();
|
||||||
for (URL url : urls) {
|
for (URL url : urls) {
|
||||||
if(MinecraftUtil.isCoreFile(url)){
|
if(MinecraftUtil.isCoreFile(url)){
|
||||||
ModSystemTweaker.logger.info(url.toString()+" : SKIP (core file).");
|
ModSystemTweaker.logger.debug(url.toString()+" : SKIP (core file).");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(MinecraftUtil.isLibraryFile(url)){
|
if(MinecraftUtil.isLibraryFile(url)){
|
||||||
ModSystemTweaker.logger.info(url.toString()+" : SKIP (library file).");
|
ModSystemTweaker.logger.debug(url.toString()+" : SKIP (library file).");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
File file = new File(url.toURI());
|
File file = new File(url.toURI());
|
||||||
@@ -46,7 +46,7 @@ public class ClassTransformer implements IClassTransformer {
|
|||||||
}
|
}
|
||||||
if (tempZipFile.getEntry("customskinloader/tweaker/ClassTransformer.class") == null){
|
if (tempZipFile.getEntry("customskinloader/tweaker/ClassTransformer.class") == null){
|
||||||
tempZipFile.close();
|
tempZipFile.close();
|
||||||
ModSystemTweaker.logger.info(url.toString()+" : FINISH (not target).");
|
ModSystemTweaker.logger.debug(url.toString()+" : FINISH (not target).");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
zipFile = tempZipFile;
|
zipFile = tempZipFile;
|
||||||
@@ -89,9 +89,14 @@ public class ClassTransformer implements IClassTransformer {
|
|||||||
if (zipFile == null)
|
if (zipFile == null)
|
||||||
return bytes;
|
return bytes;
|
||||||
|
|
||||||
String fullName = new StringBuilder().append(name.startsWith("net") ? name.replaceAll("\\.", "\\/") : name).append(".class").toString();
|
String fullName = new StringBuilder().append(name.startsWith("net") ? name.replaceAll("\\.", "\\/") : name).append(".class").toString();//Notch(Run)/MCP(Dev) Class Name
|
||||||
if(!classes.contains(fullName))
|
if(!classes.contains(fullName)){//Check Name
|
||||||
return bytes;
|
if(name.equals(transformedName))
|
||||||
|
return bytes;
|
||||||
|
fullName = new StringBuilder().append(transformedName.replaceAll("\\.", "\\/")).append(".class").toString();//MCP Class Name
|
||||||
|
if(!classes.contains(fullName))//check Again
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
ZipEntry ze = zipFile.getEntry(fullName);
|
ZipEntry ze = zipFile.getEntry(fullName);
|
||||||
if (ze == null)
|
if (ze == null)
|
||||||
return bytes;
|
return bytes;
|
||||||
+1
-3
@@ -1,7 +1,6 @@
|
|||||||
package customskinloader.tweaker;
|
package customskinloader.tweaker;
|
||||||
|
|
||||||
import customskinloader.Logger;
|
import customskinloader.Logger;
|
||||||
import customskinloader.utils.MinecraftUtil;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -14,8 +13,7 @@ public class ModSystemTweaker implements ITweaker {
|
|||||||
public static Logger logger = new Logger();
|
public static Logger logger = new Logger();
|
||||||
|
|
||||||
public void acceptOptions(List args, File gameDir, File assetsDir, String profile) {
|
public void acceptOptions(List args, File gameDir, File assetsDir, String profile) {
|
||||||
MinecraftUtil.minecraftDataFolder=gameDir;
|
File tweakerLogFile = new File(gameDir,"CustomSkinLoader/Tweaker.log");
|
||||||
File tweakerLogFile = new File(MinecraftUtil.getMinecraftDataDir(),"CustomSkinLoader/Tweaker.log");
|
|
||||||
logger = new Logger(tweakerLogFile);
|
logger = new Logger(tweakerLogFile);
|
||||||
|
|
||||||
logger.info("Using ModSystemTweaker");
|
logger.info("Using ModSystemTweaker");
|
||||||
+1
-3
@@ -1,7 +1,6 @@
|
|||||||
package customskinloader.tweaker;
|
package customskinloader.tweaker;
|
||||||
|
|
||||||
import customskinloader.Logger;
|
import customskinloader.Logger;
|
||||||
import customskinloader.utils.MinecraftUtil;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -18,8 +17,7 @@ public class Tweaker implements ITweaker {
|
|||||||
public static Logger logger = new Logger();
|
public static Logger logger = new Logger();
|
||||||
|
|
||||||
public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) {
|
public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) {
|
||||||
MinecraftUtil.minecraftDataFolder=gameDir;
|
File tweakerLogFile = new File(gameDir,"CustomSkinLoader/Tweaker.log");
|
||||||
File tweakerLogFile = new File(MinecraftUtil.getMinecraftDataDir(),"CustomSkinLoader/Tweaker.log");
|
|
||||||
logger = new Logger(tweakerLogFile);
|
logger = new Logger(tweakerLogFile);
|
||||||
|
|
||||||
logger.info("Using Tweaker");
|
logger.info("Using Tweaker");
|
||||||
+5
-3
@@ -95,7 +95,7 @@ public class HttpRequestUtil {
|
|||||||
if(cacheInfo==null)
|
if(cacheInfo==null)
|
||||||
cacheInfo=new CacheInfo();
|
cacheInfo=new CacheInfo();
|
||||||
if(cacheInfo.expire>=TimeUtil.getCurrentUnixTimestamp())
|
if(cacheInfo.expire>=TimeUtil.getCurrentUnixTimestamp())
|
||||||
return loadFromCache(request,new HttpResponce());
|
return loadFromCache(request,new HttpResponce(),cacheInfo.expire);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Init Connection
|
//Init Connection
|
||||||
@@ -173,11 +173,13 @@ public class HttpRequestUtil {
|
|||||||
public static File getCacheFile(String hash){
|
public static File getCacheFile(String hash){
|
||||||
return new File(CACHE_DIR,hash);
|
return new File(CACHE_DIR,hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HttpResponce loadFromCache(HttpRequest request,HttpResponce responce){
|
private static HttpResponce loadFromCache(HttpRequest request,HttpResponce responce){
|
||||||
|
return loadFromCache(request,responce,0);
|
||||||
|
}
|
||||||
|
private static HttpResponce loadFromCache(HttpRequest request,HttpResponce responce,long expireTime){
|
||||||
if(request.cacheFile==null||!request.cacheFile.isFile())
|
if(request.cacheFile==null||!request.cacheFile.isFile())
|
||||||
return responce;
|
return responce;
|
||||||
CustomSkinLoader.logger.info("Cache file found (Length: "+request.cacheFile.length()+" , Path: '"+request.cacheFile.getAbsolutePath()+"')");
|
CustomSkinLoader.logger.info("Cache file found (Length: "+request.cacheFile.length()+" , Path: '"+request.cacheFile.getAbsolutePath()+"' , Expire: "+expireTime+"')");
|
||||||
responce.fromCache=true;
|
responce.fromCache=true;
|
||||||
responce.success=true;
|
responce.success=true;
|
||||||
if(!request.loadContent)
|
if(!request.loadContent)
|
||||||
+3
@@ -24,6 +24,9 @@ public class HttpTextureUtil {
|
|||||||
defaultCacheDir.mkdirs();
|
defaultCacheDir.mkdirs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static File getCacheDir(){
|
||||||
|
return defaultCacheDir==null?new File(MinecraftUtil.getMinecraftDataDir(),"assets/skins"):defaultCacheDir;
|
||||||
|
}
|
||||||
|
|
||||||
public static HttpTextureInfo toHttpTextureInfo(String fakeUrl){
|
public static HttpTextureInfo toHttpTextureInfo(String fakeUrl){
|
||||||
HttpTextureInfo info=new HttpTextureInfo();
|
HttpTextureInfo info=new HttpTextureInfo();
|
||||||
File renamed without changes.
+11
-15
@@ -10,27 +10,24 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.texture.TextureManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MinecraftUtil for mcp version.
|
|
||||||
* It is the only class in package 'customskinloader' which has differences in mcp/non-mcp version.
|
|
||||||
*
|
|
||||||
* @author Alexander Xia
|
* @author Alexander Xia
|
||||||
* @since 13.6
|
* @since 13.6
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class MinecraftUtil {
|
public class MinecraftUtil {
|
||||||
public static File getMinecraftDataDir0(){
|
public static File getMinecraftDataDir(){
|
||||||
return net.minecraft.client.Minecraft.getMinecraft().mcDataDir;
|
return net.minecraft.client.Minecraft.getMinecraft().mcDataDir;
|
||||||
}
|
}
|
||||||
|
public static MinecraftSessionService getSessionService(){
|
||||||
public static File minecraftDataFolder=null;
|
return net.minecraft.client.Minecraft.getMinecraft().getSessionService();
|
||||||
public static File getMinecraftDataDir(){
|
}
|
||||||
if(minecraftDataFolder!=null)
|
public static TextureManager getTextureManager(){
|
||||||
return minecraftDataFolder;
|
return net.minecraft.client.Minecraft.getMinecraft().getTextureManager();
|
||||||
testProbe();
|
|
||||||
if(minecraftDataFolder!=null)
|
|
||||||
return minecraftDataFolder;
|
|
||||||
return new File("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ArrayList<String> minecraftVersion=new ArrayList<String>();
|
private static ArrayList<String> minecraftVersion=new ArrayList<String>();
|
||||||
@@ -98,11 +95,10 @@ public class MinecraftUtil {
|
|||||||
}
|
}
|
||||||
if(m==null || !m.matches())
|
if(m==null || !m.matches())
|
||||||
continue;
|
continue;
|
||||||
if(minecraftDataFolder==null)
|
|
||||||
minecraftDataFolder=new File(m.group(1));
|
|
||||||
minecraftVersion.add(m.group(2));
|
minecraftVersion.add(m.group(2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isCoreFile(URL url){
|
public static boolean isCoreFile(URL url){
|
||||||
Matcher m = null;
|
Matcher m = null;
|
||||||
try{
|
try{
|
||||||
File renamed without changes.
@@ -0,0 +1,108 @@
|
|||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
/*maven {
|
||||||
|
name = "fmm"
|
||||||
|
url = "http://forgemavenmirror.sinaapp.com/maven"
|
||||||
|
}*/
|
||||||
|
jcenter()
|
||||||
|
maven { url = "http://files.minecraftforge.net/maven" }
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||||
|
|
||||||
|
ext.MINECRAFT_VERSION="1.12"
|
||||||
|
ext.FORGE_VERSION="14.21.1.2387"
|
||||||
|
ext.MAPPING_VERSION="snapshot_20170813"
|
||||||
|
ext.MINECRAFT_FULL_VERSIONS="1.8,1.8.8,1.8.9,1.9,1.9.4,1.10,1.10.2,1.11,1.11.2,1.12,1.12.1"
|
||||||
|
|
||||||
|
ext.snapshot = !(rootProject.ext.config.snapshot==""||rootProject.ext.config.snapshot=="0"||rootProject.ext.config.snapshot==0)
|
||||||
|
|
||||||
|
archivesBaseName = "CustomSkinLoader_Forge"
|
||||||
|
version = rootProject.ext.config.version + rootProject.ext.config.dev_version + (snapshot?"-SNAPSHOT-"+System.getenv("BUILD_NUMBER"):"")
|
||||||
|
group = "customskinloader"
|
||||||
|
|
||||||
|
sourceCompatibility = targetCompatibility = "1.6"
|
||||||
|
compileJava {
|
||||||
|
sourceCompatibility = targetCompatibility = "1.6"
|
||||||
|
}
|
||||||
|
jar {
|
||||||
|
manifest {
|
||||||
|
attributes 'FMLCorePlugin': 'customskinloader.forge.ForgePlugin'
|
||||||
|
attributes 'FMLCorePluginContainsFMLMod': true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
java {
|
||||||
|
srcDir 'MergedSource'//Merge source
|
||||||
|
}
|
||||||
|
resources {
|
||||||
|
srcDir 'MergedResource'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
minecraft {
|
||||||
|
version = MINECRAFT_VERSION+"-"+FORGE_VERSION
|
||||||
|
runDir = "run"
|
||||||
|
|
||||||
|
mappings = MAPPING_VERSION
|
||||||
|
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||||
|
|
||||||
|
replace '@MOD_VERSION@', rootProject.ext.config.version
|
||||||
|
replace '@MOD_FULL_VERSION@', project.version
|
||||||
|
replaceIn 'CustomSkinLoader.java'
|
||||||
|
replaceIn 'ForgeMod.java'
|
||||||
|
}
|
||||||
|
|
||||||
|
task mergeSource { doLast {
|
||||||
|
copy {
|
||||||
|
from '../Common/source'
|
||||||
|
exclude '**/tweaker/**'
|
||||||
|
from 'source'
|
||||||
|
into 'MergedSource'
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
sourceMainJava.dependsOn mergeSource
|
||||||
|
|
||||||
|
task mergeResources { doLast {
|
||||||
|
copy {
|
||||||
|
from '../Common/resource'
|
||||||
|
from 'resource'
|
||||||
|
into 'MergedResource'
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
processResources.dependsOn mergeResources
|
||||||
|
|
||||||
|
processResources
|
||||||
|
{
|
||||||
|
expand ([
|
||||||
|
modVersion :rootProject.ext.config.version,
|
||||||
|
modFullVersion :project.version,
|
||||||
|
mcVersion :MINECRAFT_VERSION,
|
||||||
|
mcFullVersions :MINECRAFT_FULL_VERSIONS,
|
||||||
|
forgeVersion :FORGE_VERSION,
|
||||||
|
gitVersion :System.getenv("GIT_COMMIT"),
|
||||||
|
buildUrl :System.getenv("BUILD_URL")
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
task afterBuild { doLast {
|
||||||
|
//Clean Up
|
||||||
|
def sourceDir = file("MergedSource")
|
||||||
|
sourceDir.deleteDir()
|
||||||
|
def resourceDir = file("MergedResource")
|
||||||
|
resourceDir.deleteDir()
|
||||||
|
|
||||||
|
//copyBuildFile
|
||||||
|
copy {
|
||||||
|
from 'build/libs'
|
||||||
|
into '../build/libs'
|
||||||
|
include '**/*.jar'
|
||||||
|
exclude '**/*-sources.jar'
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
build.finalizedBy afterBuild
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"modid": "customskinloader",
|
||||||
|
"name": "CustomSkinLoader",
|
||||||
|
"description": "Custom Skin Loader for Minecraft",
|
||||||
|
"version": "${modFullVersion}",
|
||||||
|
"url": "https://github.com/xfl03/MCCustomSkinLoader",
|
||||||
|
"authorList": ["xfl03"],
|
||||||
|
"credits": "GPLv3"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package customskinloader.forge;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
|
||||||
|
@Mod(modid = "customskinloader",
|
||||||
|
name = "CustomSkinLoader",
|
||||||
|
version = "@MOD_FULL_VERSION@",
|
||||||
|
clientSideOnly=true,
|
||||||
|
acceptedMinecraftVersions="[1.8,)")
|
||||||
|
public class ForgeMod{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package customskinloader.forge;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
|
||||||
|
|
||||||
|
public class ForgePlugin implements IFMLLoadingPlugin {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getASMTransformerClass() {
|
||||||
|
return new String[] {TransformerManager.class.getName()};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getModContainerClass() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSetupClass() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void injectData(Map<String, Object> data) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAccessTransformerClass() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package customskinloader.forge;
|
||||||
|
|
||||||
|
import java.util.ListIterator;
|
||||||
|
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
|
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||||
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
import org.objectweb.asm.tree.InsnNode;
|
||||||
|
import org.objectweb.asm.tree.MethodNode;
|
||||||
|
import org.objectweb.asm.tree.VarInsnNode;
|
||||||
|
|
||||||
|
import customskinloader.forge.TransformerManager.IMethodTransformer;
|
||||||
|
import customskinloader.forge.TransformerManager.TransformTarget;
|
||||||
|
|
||||||
|
public class PlayerTabTransformer {
|
||||||
|
@TransformTarget(className="net.minecraft.client.gui.GuiPlayerTabOverlay",
|
||||||
|
methodNames={"func_175249_a","renderPlayerlist"},
|
||||||
|
desc="(ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V")
|
||||||
|
public static class ScoreObjectiveTransformer implements IMethodTransformer{
|
||||||
|
//From: http://git.oschina.net/AsteriskTeam/TabIconHackForge/blob/master/src/main/java/kengxxiao/tabiconhack/coremod/TabIconHackForgeClassTransformer.java#L30-L43
|
||||||
|
@Override
|
||||||
|
public void transform(ClassNode cn, MethodNode mn) {
|
||||||
|
ListIterator<AbstractInsnNode> iterator = mn.instructions.iterator();
|
||||||
|
while (iterator.hasNext())
|
||||||
|
{
|
||||||
|
AbstractInsnNode node = iterator.next();
|
||||||
|
if (node instanceof VarInsnNode)
|
||||||
|
{
|
||||||
|
VarInsnNode varNode = (VarInsnNode) node;
|
||||||
|
if (varNode.getOpcode() == Opcodes.ISTORE && varNode.var == 11)
|
||||||
|
mn.instructions.set(varNode.getPrevious(), new InsnNode(Opcodes.ICONST_1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
package customskinloader.forge;
|
||||||
|
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
import org.objectweb.asm.tree.FieldInsnNode;
|
||||||
|
import org.objectweb.asm.tree.FieldNode;
|
||||||
|
import org.objectweb.asm.tree.InsnNode;
|
||||||
|
import org.objectweb.asm.tree.MethodInsnNode;
|
||||||
|
import org.objectweb.asm.tree.MethodNode;
|
||||||
|
import org.objectweb.asm.tree.TypeInsnNode;
|
||||||
|
import org.objectweb.asm.tree.VarInsnNode;
|
||||||
|
|
||||||
|
import customskinloader.forge.TransformerManager.IMethodTransformer;
|
||||||
|
import customskinloader.forge.TransformerManager.TransformTarget;
|
||||||
|
|
||||||
|
public class SkinManagerTransformer {
|
||||||
|
@TransformTarget(className="net.minecraft.client.resources.SkinManager",
|
||||||
|
methodNames={"<init>"},
|
||||||
|
desc="(Lnet/minecraft/client/renderer/texture/TextureManager;Ljava/io/File;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)V")
|
||||||
|
public static class InitTransformer implements IMethodTransformer{
|
||||||
|
@Override
|
||||||
|
public void transform(ClassNode cn,MethodNode mn) {
|
||||||
|
cn.fields.add(new FieldNode(Opcodes.ACC_PRIVATE, "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;", null, null));
|
||||||
|
mn.instructions.clear();
|
||||||
|
mn.instructions.add(new VarInsnNode(Opcodes.ALOAD,0));
|
||||||
|
mn.instructions.add(new MethodInsnNode(Opcodes.INVOKESPECIAL,"java/lang/Object","<init>","()V", false));
|
||||||
|
mn.instructions.add(new VarInsnNode(Opcodes.ALOAD,0));
|
||||||
|
mn.instructions.add(new TypeInsnNode(Opcodes.NEW, "customskinloader/fake/FakeSkinManager"));
|
||||||
|
mn.instructions.add(new InsnNode(Opcodes.DUP));
|
||||||
|
mn.instructions.add(new VarInsnNode(Opcodes.ALOAD,1));
|
||||||
|
mn.instructions.add(new VarInsnNode(Opcodes.ALOAD,2));
|
||||||
|
mn.instructions.add(new VarInsnNode(Opcodes.ALOAD,3));
|
||||||
|
mn.instructions.add(new MethodInsnNode(Opcodes.INVOKESPECIAL,"customskinloader/fake/FakeSkinManager","<init>",
|
||||||
|
"(Lnet/minecraft/client/renderer/texture/TextureManager;Ljava/io/File;Lcom/mojang/authlib/minecraft/MinecraftSessionService;)V", false));
|
||||||
|
mn.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
|
||||||
|
mn.instructions.add(new InsnNode(Opcodes.RETURN));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@TransformTarget(className="net.minecraft.client.resources.SkinManager",
|
||||||
|
methodNames={"func_152789_a","loadSkin"},
|
||||||
|
desc="(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;")
|
||||||
|
public static class LoadSkinTransformer implements IMethodTransformer{
|
||||||
|
@Override
|
||||||
|
public void transform(ClassNode cn,MethodNode mn) {
|
||||||
|
mn.instructions.clear();
|
||||||
|
mn.instructions.add(new VarInsnNode(Opcodes.ALOAD,0));
|
||||||
|
mn.instructions.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
|
||||||
|
mn.instructions.add(new VarInsnNode(Opcodes.ALOAD,1));
|
||||||
|
mn.instructions.add(new VarInsnNode(Opcodes.ALOAD,2));
|
||||||
|
mn.instructions.add(new VarInsnNode(Opcodes.ALOAD,3));
|
||||||
|
mn.instructions.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL,"customskinloader/fake/FakeSkinManager","loadSkin",
|
||||||
|
"(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;)Lnet/minecraft/util/ResourceLocation;", false));
|
||||||
|
mn.instructions.add(new InsnNode(Opcodes.ARETURN));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@TransformTarget(className="net.minecraft.client.resources.SkinManager",
|
||||||
|
methodNames={"func_152790_a","loadProfileTextures"},
|
||||||
|
desc="(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V")
|
||||||
|
public static class LoadProfileTexturesTransformer implements IMethodTransformer{
|
||||||
|
@Override
|
||||||
|
public void transform(ClassNode cn,MethodNode mn) {
|
||||||
|
mn.instructions.clear();
|
||||||
|
mn.instructions.add(new VarInsnNode(Opcodes.ALOAD,0));
|
||||||
|
mn.instructions.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
|
||||||
|
mn.instructions.add(new VarInsnNode(Opcodes.ALOAD,1));
|
||||||
|
mn.instructions.add(new VarInsnNode(Opcodes.ALOAD,2));
|
||||||
|
mn.instructions.add(new VarInsnNode(Opcodes.ILOAD,3));
|
||||||
|
mn.instructions.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL,"customskinloader/fake/FakeSkinManager","loadProfileTextures",
|
||||||
|
"(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;Z)V", false));
|
||||||
|
mn.instructions.add(new InsnNode(Opcodes.RETURN));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@TransformTarget(className="net.minecraft.client.resources.SkinManager",
|
||||||
|
methodNames={"func_152788_a","loadSkinFromCache"},
|
||||||
|
desc="(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;")
|
||||||
|
public static class LoadSkinFromCacheTransformer implements IMethodTransformer{
|
||||||
|
@Override
|
||||||
|
public void transform(ClassNode cn,MethodNode mn) {
|
||||||
|
mn.instructions.clear();
|
||||||
|
mn.instructions.add(new VarInsnNode(Opcodes.ALOAD,0));
|
||||||
|
mn.instructions.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/resources/SkinManager", "fakeManager", "Lcustomskinloader/fake/FakeSkinManager;"));
|
||||||
|
mn.instructions.add(new VarInsnNode(Opcodes.ALOAD,1));
|
||||||
|
mn.instructions.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL,"customskinloader/fake/FakeSkinManager","loadSkinFromCache",
|
||||||
|
"(Lcom/mojang/authlib/GameProfile;)Ljava/util/Map;", false));
|
||||||
|
mn.instructions.add(new InsnNode(Opcodes.ARETURN));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
package customskinloader.forge;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.objectweb.asm.ClassReader;
|
||||||
|
import org.objectweb.asm.ClassWriter;
|
||||||
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
import org.objectweb.asm.tree.MethodNode;
|
||||||
|
|
||||||
|
import net.minecraft.launchwrapper.IClassTransformer;
|
||||||
|
import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
|
||||||
|
import net.minecraftforge.fml.relauncher.FMLRelaunchLog;
|
||||||
|
import customskinloader.forge.PlayerTabTransformer.ScoreObjectiveTransformer;
|
||||||
|
import customskinloader.forge.SkinManagerTransformer.*;
|
||||||
|
|
||||||
|
public class TransformerManager implements IClassTransformer {
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.TYPE)
|
||||||
|
public @interface TransformTarget{
|
||||||
|
public String className();
|
||||||
|
public String[] methodNames();
|
||||||
|
public String desc();
|
||||||
|
}
|
||||||
|
public interface IMethodTransformer{
|
||||||
|
public void transform(ClassNode cn,MethodNode mn);
|
||||||
|
}
|
||||||
|
private static final IMethodTransformer[] TRANFORMERS={
|
||||||
|
new InitTransformer(),
|
||||||
|
new LoadSkinTransformer(),
|
||||||
|
new LoadProfileTexturesTransformer(),
|
||||||
|
new LoadSkinFromCacheTransformer(),
|
||||||
|
new ScoreObjectiveTransformer()};
|
||||||
|
private Map<String, Map<String, IMethodTransformer>> map;
|
||||||
|
public TransformerManager(){
|
||||||
|
map = new HashMap<String, Map<String, IMethodTransformer>>();
|
||||||
|
for(IMethodTransformer t:TRANFORMERS){
|
||||||
|
FMLRelaunchLog.info("[CSL DEBUG] REGISTERING TRANSFORMER %s",t.getClass().getName());
|
||||||
|
if(!t.getClass().isAnnotationPresent(TransformTarget.class)){
|
||||||
|
FMLRelaunchLog.info("[CSL DEBUG] ERROR occurs while parsing Annotation.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
addMethodTransformer(t.getClass().getAnnotation(TransformTarget.class),t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void addMethodTransformer(TransformTarget target, IMethodTransformer transformer) {
|
||||||
|
if (!map.containsKey(target.className()))
|
||||||
|
map.put(target.className(), new HashMap<String, IMethodTransformer>());
|
||||||
|
for(String methodName:target.methodNames()){
|
||||||
|
map.get(target.className()).put(methodName + target.desc(), transformer);
|
||||||
|
FMLRelaunchLog.info("[CSL DEBUG] REGISTERING METHOD %s(%s)",target.className(),methodName + target.desc());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//From: https://github.com/RecursiveG/UniSkinMod/blob/1.9.4/src/main/java/org/devinprogress/uniskinmod/coremod/BaseAsmTransformer.java#L83-L114
|
||||||
|
@Override
|
||||||
|
public byte[] transform(String obfClassName, String className, byte[] bytes) {
|
||||||
|
if (!map.containsKey(className)) return bytes;
|
||||||
|
FMLRelaunchLog.info("[CSL DEBUG] CLASS %s will be transformed", className);
|
||||||
|
Map<String, IMethodTransformer> transMap = map.get(className);
|
||||||
|
|
||||||
|
ClassReader cr = new ClassReader(bytes);
|
||||||
|
ClassNode cn = new ClassNode();
|
||||||
|
cr.accept(cn, 0);
|
||||||
|
|
||||||
|
// NOTE: `map` = convert obfuscated name to srgName;
|
||||||
|
List<MethodNode> ml = new ArrayList<MethodNode>();
|
||||||
|
ml.addAll(cn.methods);
|
||||||
|
for (MethodNode mn : ml) {
|
||||||
|
String methodName = FMLDeobfuscatingRemapper.INSTANCE.mapMethodName(obfClassName, mn.name, mn.desc);
|
||||||
|
String methodDesc = FMLDeobfuscatingRemapper.INSTANCE.mapMethodDesc(mn.desc);
|
||||||
|
if (transMap.containsKey(methodName + methodDesc)) {
|
||||||
|
try {
|
||||||
|
FMLRelaunchLog.info("[CSL DEBUG] Transforming method %s in class %s(%s)", methodName + methodDesc, obfClassName, className);
|
||||||
|
transMap.get(methodName + methodDesc).transform(cn,mn);
|
||||||
|
FMLRelaunchLog.info("[CSL DEBUG] Successfully transformed method %s in class %s(%s)", methodName + methodDesc, obfClassName, className);
|
||||||
|
} catch (Exception e) {
|
||||||
|
FMLRelaunchLog.warning("[CSL DEBUG] An error happened when transforming method %s in class %s(%s). The whole class was not modified.", methodName + methodDesc, obfClassName, className);
|
||||||
|
e.printStackTrace();
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
||||||
|
cn.accept(cw);
|
||||||
|
return cw.toByteArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,77 +1,81 @@
|
|||||||
#CustomSkinLoader
|
# CustomSkinLoader
|
||||||
##What's this?
|
## What's this?
|
||||||
Custom Skin Loader mod for Minecraft.
|
Custom Skin Loader mod for Minecraft.
|
||||||
You can use it to load any skin from any website.
|
You can use it to load any skin from any website.
|
||||||
|
|
||||||
##Download
|
## Download
|
||||||
Build Server : [Infinity Studio CI](https://ci.infstudio.net/job/CustomSkinLoader/)
|
Build Server : [Infinity Studio CI](https://jenkins.mcdev.se/job/CustomSkinLoader/)
|
||||||
[](https://ci.infstudio.net/job/CustomSkinLoader/)
|
[](https://ci.infstudio.net/job/CustomSkinLoader/)
|
||||||
Release Page : [MCBBS](http://www.mcbbs.net/thread-269807-1-1.html)
|
Release Page : [MCBBS](http://www.mcbbs.net/thread-269807-1-1.html)
|
||||||
|
|
||||||
##Feature
|
## Feature
|
||||||
###Plenty of Skin Load API Support and Customizable Skin Load List
|
### Plenty of Skin Load API Support and Customizable Skin Load List
|
||||||
Skin Load API Supported:
|
Skin Load API Supported:
|
||||||
- [Mojang API](http://wiki.vg/Mojang_API)
|
- [Mojang API](http://wiki.vg/Mojang_API)
|
||||||
- [CustomSkinAPI](https://github.com/xfl03/CustomSkinLoaderAPI/tree/master/CustomSkinAPI)
|
- [CustomSkinAPI](https://github.com/xfl03/CustomSkinLoaderAPI/tree/master/CustomSkinAPI)
|
||||||
- CustomSkinAPIPlus (Test Only)
|
- CustomSkinAPIPlus (Test Only)
|
||||||
- [UniSkinAPI](https://github.com/RecursiveG/UniSkinServer/tree/master/doc)
|
- [UniSkinAPI](https://github.com/RecursiveG/UniSkinServer/tree/master/doc)
|
||||||
- Legacy
|
- Legacy
|
||||||
- ElfSkin (Self-made API, Test Only)
|
|
||||||
|
|
||||||
You can use this feature to customize your skin load list so as to load from any skin server you want.
|
You can use this feature to customize your skin load list so as to load from any skin server you want.
|
||||||
If you are the owner of skin server, you can use CustomSkinLoader to load skin from your server if one of the api has been actualized.
|
If you are the owner of skin server, you can use CustomSkinLoader to load skin from your server if one of the api has been actualized.
|
||||||
|
|
||||||
###HD Skins Support
|
### HD Skins Support
|
||||||
Even though there is no Optifine or MCPatcher, CustomSkinLoader has fix this problem.
|
Even though there is no Optifine or MCPatcher, CustomSkinLoader has fix this problem.
|
||||||
You can easily to get a better view in skin.
|
You can easily to get a better view in skin.
|
||||||
|
|
||||||
###Skull Support
|
### Skull Support
|
||||||
Fixed skull load bug.
|
Fixed skull load bug.
|
||||||
Dynamic skull supported.
|
Dynamic skull supported.
|
||||||
|
|
||||||
###Profile Cache
|
### Profile Cache
|
||||||
- Decrease frenquency of using network.
|
- Decrease frenquency of using network.
|
||||||
- Meanwhile,you can still load profile without network.
|
- Meanwhile,you can still load profile without network.
|
||||||
|
|
||||||
*Should be open in configratulation file.
|
*Should be open in configratulation file.
|
||||||
|
|
||||||
###Local Skin
|
### Local Skin
|
||||||
Load skin without skin server.
|
Load skin without skin server.
|
||||||
Furthermore, by using this function you can preview your skin in game and even change default skin and model.
|
Furthermore, by using this function you can preview your skin in game and even change default skin and model.
|
||||||
You can load local skin by using any API(excluding MojangAPI).
|
You can load local skin by using any API(excluding MojangAPI).
|
||||||
*While using default configratulation, just put skin into `.minecraft/CustomSkinLoader/LocalSkin/(skin|cape)s/{USERNAME}.png`.
|
*While using default configratulation, just put skin into `.minecraft/CustomSkinLoader/LocalSkin/(skin|cape)s/{USERNAME}.png`.
|
||||||
|
|
||||||
###Extra List
|
### Extra List
|
||||||
A json file generated by supported skin server.
|
A json file generated by supported skin server.
|
||||||
To add server to load list, users just need to put file into `.minecraft/CustomSkinLoader/ExtraList` .
|
To add server to load list, users just need to put file into `.minecraft/CustomSkinLoader/ExtraList` .
|
||||||
|
|
||||||
###Transparent Skin Support
|
### Transparent Skin Support
|
||||||
The problem of rendering incorrect texture has been fixed.
|
The problem of rendering incorrect texture has been fixed.
|
||||||
|
|
||||||
##Default Load List
|
## Default Load List
|
||||||
- [Mojang](http://www.minecraft.net/) (Mojang API)
|
- [Mojang](http://www.minecraft.net/) (Mojang API)
|
||||||
|
- [Little Skin](https://mcskin.littleservice.cn/) (CustomSkinAPI)
|
||||||
- [Blessing Skin](http://skin.prinzeugen.net/) (CustomSkinAPI)
|
- [Blessing Skin](http://skin.prinzeugen.net/) (CustomSkinAPI)
|
||||||
- [OneSkin](http://fleey.org/skin/) (CustomSkinAPI)
|
|
||||||
- SkinMe (UniSkinAPI)
|
- SkinMe (UniSkinAPI)
|
||||||
- LocalSkin (Legacy)
|
- LocalSkin (Legacy)
|
||||||
If you want to apply to add other skin server to default list, please go to [issue](https://github.com/JLChnToZ/MCCustomSkinLoader/issues).
|
If you want to apply to add other skin server to default list, please go to [issue](https://github.com/JLChnToZ/MCCustomSkinLoader/issues).
|
||||||
|
|
||||||
##To Skin Server Owner
|
## To Skin Server Owner
|
||||||
CustomSkinLoader is designed for loading from any server, which makes it complex.
|
CustomSkinLoader is designed for loading from any server, which makes it complex.
|
||||||
It's not a good idea to refer to CustomSkinLoader's source code to develop your own skin mod.
|
It's not a good idea to refer to CustomSkinLoader's source code to develop your own skin mod.
|
||||||
It's recommended to use CustomSkinLoader for your server directly.
|
It's recommended to use CustomSkinLoader for your server directly.
|
||||||
Furthermore, you can add your server to 'Default Load List'.
|
Furthermore, you can add your server to 'Default Load List'.
|
||||||
You also can use 'ExtraList' which makes it easier for user to adds your server into load list.
|
You also can use 'ExtraList' which makes it easier for user to adds your server into load list.
|
||||||
|
|
||||||
##Copyright & LICENSE
|
## Copyright & LICENSE
|
||||||
###Binary File
|
### Binary File
|
||||||
You could not modify binary file.
|
You could not modify binary file.
|
||||||
Feel free to use and share this mod and unmodified file in anyway like modpack.
|
Feel free to use and share this mod and unmodified file in anyway like modpack.
|
||||||
When using in modpack, you must put 'CustomSkinLoader' in mod list.
|
When using in modpack, you must put 'CustomSkinLoader' in mod list.
|
||||||
You could not repost this mod to any website without permission.
|
You could not repost this mod to any website without permission.
|
||||||
You could not earn money with this mod excluding modpack.
|
You could not earn money with this mod excluding modpack.
|
||||||
###Source Code
|
### Source Code
|
||||||
####Package 'customskinloader'
|
#### Package 'customskinloader'
|
||||||
Copyright(C) 2013-2016 JLChnToZ xfl03
|
Including some code from
|
||||||
|
- [AsteriskTeam/TabIconHackForge](http://git.oschina.net/AsteriskTeam/TabIconHackForge) (GPLv3)
|
||||||
|
- [RecursiveG/UniSkinMod](https://github.com/RecursiveG/UniSkinMod) (GPLv3)
|
||||||
|
|
||||||
|
Copyright(C) 2013-2017 JLChnToZ xfl03
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -26,10 +26,11 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
|
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
apply from: rootProject.file('common.gradle')
|
if(!project.name.toLowerCase().contains("forge"))
|
||||||
|
apply from: rootProject.file('common.gradle')
|
||||||
}
|
}
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
name=CustomSkinLoader
|
name=CustomSkinLoader
|
||||||
group=customskinloader
|
group=customskinloader
|
||||||
version=14.6
|
version=14.7
|
||||||
dev_version=a
|
dev_version=
|
||||||
#RELEASE: snapshot=0
|
#RELEASE: snapshot=0
|
||||||
snapshot=0
|
snapshot=0
|
||||||
+4
-5
@@ -17,7 +17,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
|
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||||
@@ -58,10 +58,9 @@ task copySource << {
|
|||||||
def outputFile = file("src/main/java")
|
def outputFile = file("src/main/java")
|
||||||
outputFile.deleteDir()
|
outputFile.deleteDir()
|
||||||
copy {
|
copy {
|
||||||
from '../Common'
|
from '../Common/source'
|
||||||
from 'src/minecraft/'
|
from 'src/minecraft/'
|
||||||
into 'src/main/java'
|
into 'src/main/java'
|
||||||
include '**/*.java'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sourceMainJava.dependsOn copySource
|
sourceMainJava.dependsOn copySource
|
||||||
@@ -81,9 +80,8 @@ task copyResources << {
|
|||||||
def outputFile = file("src/main/resources")
|
def outputFile = file("src/main/resources")
|
||||||
outputFile.deleteDir()
|
outputFile.deleteDir()
|
||||||
copy {
|
copy {
|
||||||
from '../Common'
|
from '../Common/resource'
|
||||||
into 'src/main/resources'
|
into 'src/main/resources'
|
||||||
exclude '**/*.java'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
processResources.dependsOn copyResources
|
processResources.dependsOn copyResources
|
||||||
@@ -103,6 +101,7 @@ task afterBuild << {
|
|||||||
into '../build/libs'
|
into '../build/libs'
|
||||||
include '**/*.jar'
|
include '**/*.jar'
|
||||||
exclude '**/*-srg.jar'
|
exclude '**/*-srg.jar'
|
||||||
|
exclude '**/*-dev.jar'
|
||||||
exclude '**/*-sources.jar'
|
exclude '**/*-sources.jar'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-8
@@ -1,8 +1,5 @@
|
|||||||
//Remove Build 1.7.10
|
include "1.12-mcp940"
|
||||||
//include "1.7.10-mcp908"
|
include "1.12.1-test"
|
||||||
include "1.8-mcp910"
|
|
||||||
include "1.8.8-mcp918"
|
//Universial Forge Version for [1.8,)
|
||||||
include "1.9-mcp924"
|
include "Forge"
|
||||||
include "1.9.4-mcp928"
|
|
||||||
include "1.10-mcp931"
|
|
||||||
include "1.11-test"
|
|
||||||
Reference in new issue
Block a user