mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-12 23:37:38 +00:00
Double layer skin support for 1.8-
Use Alex model in 1.8
This commit is contained in:
1 parent
6207dc49f5
commit
35432b9791
10 files changed
+97
-49
No files matched your search
@@ -20,12 +20,12 @@ import com.google.gson.reflect.TypeToken;
|
||||
/**
|
||||
* Custom skin loader mod for Minecraft.
|
||||
*
|
||||
* @version 12th Revision 6th Subversion 2015.8.8
|
||||
* @version 12th Revision 7th Subversion 2015.8.22
|
||||
*
|
||||
* @author (C) Jeremy Lam [JLChnToZ] 2013 & Alexander Xia [xfl03] 2014-2015
|
||||
*/
|
||||
public class CustomSkinLoader {
|
||||
public final static String VERSION="12.6";
|
||||
public final static String VERSION="12.7";
|
||||
|
||||
public final static String DefaultSkinURL = "http://skins.minecraft.net/MinecraftSkins/*.png";
|
||||
public final static String DefaultCloakURL = "http://skins.minecraft.net/MinecraftCloaks/*.png";
|
||||
@@ -69,8 +69,10 @@ public class CustomSkinLoader {
|
||||
return getPlayerSkinStream(true, m.group(3));
|
||||
}else{
|
||||
m = optifineCapeURLPattern.matcher(path);
|
||||
if(m.matches())//Optifine Cape
|
||||
if(m.matches()){//Optifine Cape
|
||||
logger.info("Ignore Optifine Cape.");
|
||||
return null;//Not Load This
|
||||
}
|
||||
}
|
||||
}
|
||||
return getStream(path, false); // Neither skin nor cloak...
|
||||
@@ -116,7 +118,7 @@ public class CustomSkinLoader {
|
||||
C.setDoInput(true);
|
||||
C.setDoOutput(false);
|
||||
C.connect();
|
||||
logger.info("RC: "+C.getResponseCode());
|
||||
logger.info("Response Code: "+C.getResponseCode());
|
||||
int respcode = C.getResponseCode() / 100;
|
||||
if (respcode != 4 && respcode != 5) { // Successful to get skin.
|
||||
if(alreadyCached && C.getLastModified()==cacheFile.lastModified()){
|
||||
|
||||
@@ -21,9 +21,15 @@ public class ImageBufferDownload implements IImageBuffer
|
||||
{
|
||||
this.imageWidth = par1BufferedImage.getWidth();//Default: 64
|
||||
this.imageHeight = par1BufferedImage.getHeight();//Default: 32
|
||||
BufferedImage var2 = new BufferedImage(this.imageWidth, this.imageHeight, 2);
|
||||
BufferedImage var2 = new BufferedImage(this.imageWidth, this.imageWidth / 2, 2);
|
||||
Graphics var3 = var2.getGraphics();
|
||||
var3.drawImage(par1BufferedImage, 0, 0, (ImageObserver)null);
|
||||
if(imageWidth == imageHeight){
|
||||
var3.drawImage(par1BufferedImage, 0, 0, this.imageWidth, this.imageWidth / 2, 0, 0, this.imageWidth, this.imageWidth / 2, (ImageObserver)null);
|
||||
var3.drawImage(par1BufferedImage, 0, this.imageWidth / 4, this.imageWidth, this.imageWidth / 2, 0, this.imageWidth / 2 , this.imageWidth, this.imageWidth / 4 * 3, (ImageObserver)null);
|
||||
imageHeight/=2;
|
||||
}else{
|
||||
var3.drawImage(par1BufferedImage, 0, 0, (ImageObserver)null);
|
||||
}
|
||||
var3.dispose();
|
||||
this.imageData = ((DataBufferInt)var2.getRaster().getDataBuffer()).getData();
|
||||
//this.setAreaOpaque(0, 0, 32, 16);
|
||||
|
||||
@@ -20,12 +20,12 @@ import com.google.gson.reflect.TypeToken;
|
||||
/**
|
||||
* Custom skin loader mod for Minecraft.
|
||||
*
|
||||
* @version 12th Revision 6th Subversion 2015.8.8
|
||||
* @version 12th Revision 7th Subversion 2015.8.22
|
||||
*
|
||||
* @author (C) Jeremy Lam [JLChnToZ] 2013 & Alexander Xia [xfl03] 2014-2015
|
||||
*/
|
||||
public class CustomSkinLoader {
|
||||
public final static String VERSION="12.6";
|
||||
public final static String VERSION="12.7";
|
||||
|
||||
public final static String DefaultSkinURL = "http://skins.minecraft.net/MinecraftSkins/*.png";
|
||||
public final static String DefaultCloakURL = "http://skins.minecraft.net/MinecraftCloaks/*.png";
|
||||
@@ -69,8 +69,10 @@ public class CustomSkinLoader {
|
||||
return getPlayerSkinStream(true, m.group(3));
|
||||
}else{
|
||||
m = optifineCapeURLPattern.matcher(path);
|
||||
if(m.matches())//Optifine Cape
|
||||
if(m.matches()){//Optifine Cape
|
||||
logger.info("Ignore Optifine Cape.");
|
||||
return null;//Not Load This
|
||||
}
|
||||
}
|
||||
}
|
||||
return getStream(path, false); // Neither skin nor cloak...
|
||||
@@ -116,7 +118,7 @@ public class CustomSkinLoader {
|
||||
C.setDoInput(true);
|
||||
C.setDoOutput(false);
|
||||
C.connect();
|
||||
logger.info("RC: "+C.getResponseCode());
|
||||
logger.info("Response Code: "+C.getResponseCode());
|
||||
int respcode = C.getResponseCode() / 100;
|
||||
if (respcode != 4 && respcode != 5) { // Successful to get skin.
|
||||
if(alreadyCached && C.getLastModified()==cacheFile.lastModified()){
|
||||
|
||||
@@ -20,19 +20,40 @@ public class ImageBufferDownload implements IImageBuffer
|
||||
}
|
||||
else
|
||||
{
|
||||
this.imageWidth = p_78432_1_.getWidth();//Default: 64
|
||||
this.imageHeight = p_78432_1_.getHeight();//Default: 32
|
||||
int ratio=p_78432_1_.getWidth()/64;
|
||||
this.imageWidth = 64 * ratio;
|
||||
this.imageHeight = 64 * ratio;
|
||||
BufferedImage var2 = new BufferedImage(this.imageWidth, this.imageHeight, 2);
|
||||
Graphics var3 = var2.getGraphics();
|
||||
var3.drawImage(p_78432_1_, 0, 0, (ImageObserver)null);
|
||||
|
||||
if (p_78432_1_.getHeight() == 32 * ratio)
|
||||
{
|
||||
var3.drawImage(var2, 24 * ratio, 48 * ratio, 20 * ratio, 52 * ratio, 4 * ratio, 16 * ratio, 8 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 28 * ratio, 48 * ratio, 24 * ratio, 52 * ratio, 8 * ratio, 16 * ratio, 12 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 20 * ratio, 52 * ratio, 16 * ratio, 64 * ratio, 8 * ratio, 20 * ratio, 12 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 24 * ratio, 52 * ratio, 20 * ratio, 64 * ratio, 4 * ratio, 20 * ratio, 8 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 28 * ratio, 52 * ratio, 24 * ratio, 64 * ratio, 0 * ratio, 20 * ratio, 4 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 32 * ratio, 52 * ratio, 28 * ratio, 64 * ratio, 12 * ratio, 20 * ratio, 16 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 40 * ratio, 48 * ratio, 36 * ratio, 52 * ratio, 44 * ratio, 16 * ratio, 48 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 44 * ratio, 48 * ratio, 40 * ratio, 52 * ratio, 48 * ratio, 16 * ratio, 52 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 36 * ratio, 52 * ratio, 32 * ratio, 64 * ratio, 48 * ratio, 20 * ratio, 52 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 40 * ratio, 52 * ratio, 36 * ratio, 64 * ratio, 44 * ratio, 20 * ratio, 48 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 44 * ratio, 52 * ratio, 40 * ratio, 64 * ratio, 40 * ratio, 20 * ratio, 44 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 48 * ratio, 52 * ratio, 44 * ratio, 64 * ratio, 52 * ratio, 20 * ratio, 56 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
}
|
||||
|
||||
var3.dispose();
|
||||
this.imageData = ((DataBufferInt)var2.getRaster().getDataBuffer()).getData();
|
||||
//this.setAreaOpaque(0, 0, 32, 16);
|
||||
//this.setAreaTransparent(32, 0, 64, 32);
|
||||
//this.setAreaOpaque(0, 16, 64, 32);
|
||||
this.setAreaOpaque(0, 0, imageWidth / 2, imageHeight / 2);
|
||||
this.setAreaTransparent(imageWidth / 2, 0, imageWidth, imageHeight);
|
||||
this.setAreaOpaque(0, imageHeight / 2, imageWidth, imageHeight);
|
||||
this.setAreaOpaque(0, 0, 32 * ratio, 16 * ratio);
|
||||
this.setAreaTransparent(32 * ratio, 0, 64 * ratio, 32 * ratio);
|
||||
this.setAreaOpaque(0, 16 * ratio, 64 * ratio, 32 * ratio);
|
||||
this.setAreaTransparent(0, 32 * ratio, 16 * ratio, 48 * ratio);
|
||||
this.setAreaTransparent(16 * ratio, 32 * ratio, 40 * ratio, 48 * ratio);
|
||||
this.setAreaTransparent(40 * ratio, 32 * ratio, 56 * ratio, 48 * ratio);
|
||||
this.setAreaTransparent(0, 48 * ratio, 16 * ratio, 64 * ratio);
|
||||
this.setAreaOpaque(16 * ratio, 48 * ratio, 48 * ratio, 64 * ratio);
|
||||
this.setAreaTransparent(48 * ratio, 48 * ratio, 64 * ratio, 64 * ratio);
|
||||
return var2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,12 +20,12 @@ import com.google.gson.reflect.TypeToken;
|
||||
/**
|
||||
* Custom skin loader mod for Minecraft.
|
||||
*
|
||||
* @version 12th Revision 6th Subversion 2015.8.8
|
||||
* @version 12th Revision 7th Subversion 2015.8.22
|
||||
*
|
||||
* @author (C) Jeremy Lam [JLChnToZ] 2013 & Alexander Xia [xfl03] 2014-2015
|
||||
*/
|
||||
public class CustomSkinLoader {
|
||||
public final static String VERSION="12.6";
|
||||
public final static String VERSION="12.7";
|
||||
|
||||
public final static String DefaultSkinURL = "http://skins.minecraft.net/MinecraftSkins/*.png";
|
||||
public final static String DefaultCloakURL = "http://skins.minecraft.net/MinecraftCloaks/*.png";
|
||||
@@ -69,8 +69,10 @@ public class CustomSkinLoader {
|
||||
return getPlayerSkinStream(true, m.group(3));
|
||||
}else{
|
||||
m = optifineCapeURLPattern.matcher(path);
|
||||
if(m.matches())//Optifine Cape
|
||||
if(m.matches()){//Optifine Cape
|
||||
logger.info("Ignore Optifine Cape.");
|
||||
return null;//Not Load This
|
||||
}
|
||||
}
|
||||
}
|
||||
return getStream(path, false); // Neither skin nor cloak...
|
||||
@@ -116,7 +118,7 @@ public class CustomSkinLoader {
|
||||
C.setDoInput(true);
|
||||
C.setDoOutput(false);
|
||||
C.connect();
|
||||
logger.info("RC: "+C.getResponseCode());
|
||||
logger.info("Response Code: "+C.getResponseCode());
|
||||
int respcode = C.getResponseCode() / 100;
|
||||
if (respcode != 4 && respcode != 5) { // Successful to get skin.
|
||||
if(alreadyCached && C.getLastModified()==cacheFile.lastModified()){
|
||||
|
||||
@@ -22,9 +22,15 @@ public class ImageBufferDownload implements IImageBuffer
|
||||
{
|
||||
this.imageWidth = par1BufferedImage.getWidth();//Default: 64
|
||||
this.imageHeight = par1BufferedImage.getHeight();//Default: 32
|
||||
BufferedImage var2 = new BufferedImage(this.imageWidth, this.imageHeight, 2);
|
||||
BufferedImage var2 = new BufferedImage(this.imageWidth, this.imageWidth / 2, 2);
|
||||
Graphics var3 = var2.getGraphics();
|
||||
var3.drawImage(par1BufferedImage, 0, 0, (ImageObserver)null);
|
||||
if(imageWidth == imageHeight){
|
||||
var3.drawImage(par1BufferedImage, 0, 0, this.imageWidth, this.imageWidth / 2, 0, 0, this.imageWidth, this.imageWidth / 2, (ImageObserver)null);
|
||||
var3.drawImage(par1BufferedImage, 0, this.imageWidth / 4, this.imageWidth, this.imageWidth / 2, 0, this.imageWidth / 2 , this.imageWidth, this.imageWidth / 4 * 3, (ImageObserver)null);
|
||||
imageHeight/=2;
|
||||
}else{
|
||||
var3.drawImage(par1BufferedImage, 0, 0, (ImageObserver)null);
|
||||
}
|
||||
var3.dispose();
|
||||
this.imageData = ((DataBufferInt)var2.getRaster().getDataBuffer()).getData();
|
||||
//this.setAreaOpaque(0, 0, 32, 16);
|
||||
|
||||
@@ -20,12 +20,12 @@ import com.google.gson.reflect.TypeToken;
|
||||
/**
|
||||
* Custom skin loader mod for Minecraft.
|
||||
*
|
||||
* @version 12th Revision 6th Subversion 2015.8.8
|
||||
* @version 12th Revision 7th Subversion 2015.8.22
|
||||
*
|
||||
* @author (C) Jeremy Lam [JLChnToZ] 2013 & Alexander Xia [xfl03] 2014-2015
|
||||
*/
|
||||
public class CustomSkinLoader {
|
||||
public final static String VERSION="12.6";
|
||||
public final static String VERSION="12.7";
|
||||
|
||||
public final static String DefaultSkinURL = "http://skins.minecraft.net/MinecraftSkins/*.png";
|
||||
public final static String DefaultCloakURL = "http://skins.minecraft.net/MinecraftCloaks/*.png";
|
||||
@@ -69,8 +69,10 @@ public class CustomSkinLoader {
|
||||
return getPlayerSkinStream(true, m.group(3));
|
||||
}else{
|
||||
m = optifineCapeURLPattern.matcher(path);
|
||||
if(m.matches())//Optifine Cape
|
||||
if(m.matches()){//Optifine Cape
|
||||
logger.info("Ignore Optifine Cape.");
|
||||
return null;//Not Load This
|
||||
}
|
||||
}
|
||||
}
|
||||
return getStream(path, false); // Neither skin nor cloak...
|
||||
@@ -116,7 +118,7 @@ public class CustomSkinLoader {
|
||||
C.setDoInput(true);
|
||||
C.setDoOutput(false);
|
||||
C.connect();
|
||||
logger.info("RC: "+C.getResponseCode());
|
||||
logger.info("Response Code: "+C.getResponseCode());
|
||||
int respcode = C.getResponseCode() / 100;
|
||||
if (respcode != 4 && respcode != 5) { // Successful to get skin.
|
||||
if(alreadyCached && C.getLastModified()==cacheFile.lastModified()){
|
||||
|
||||
@@ -67,7 +67,7 @@ public class SkinManager
|
||||
public ResourceLocation loadSkin(final MinecraftProfileTexture p_152789_1_, final Type p_152789_2_, final SkinManager.SkinAvailableCallback p_152789_3_)
|
||||
{
|
||||
//final ResourceLocation var4 = new ResourceLocation("skins/" + p_152789_1_.getHash());
|
||||
final ResourceLocation var4 = new ResourceLocation(p_152789_2_.name() + "/" + p_152789_1_.getHash());
|
||||
final ResourceLocation var4 = new ResourceLocation(p_152789_2_.name() + "/" + p_152789_1_.getHash());
|
||||
//ITextureObject var5 = this.textureManager.getTexture(var4);
|
||||
/*
|
||||
if (var5 != null)
|
||||
@@ -135,24 +135,26 @@ public class SkinManager
|
||||
{
|
||||
var1.putAll(SkinManager.this.sessionService.getTextures(SkinManager.this.sessionService.fillProfileProperties(p_152790_1_, false), false));
|
||||
}
|
||||
//CustomSkinLoader Begin
|
||||
//CustomSkinLoader Begin
|
||||
HashMap var2 = Maps.newHashMap();
|
||||
if (var1.containsKey(Type.SKIN)){
|
||||
MinecraftProfileTexture var3=((MinecraftProfileTexture)var1.get(Type.SKIN));
|
||||
String var4=var3.getMetadata("model");
|
||||
HashMap var5 = null;
|
||||
if(var4!=null){
|
||||
var5 = Maps.newHashMap();
|
||||
var5.put("model", var4);
|
||||
}
|
||||
var2.put(Type.SKIN, new MinecraftProfileTexture(var3.getUrl()+"?Skin="+p_152790_1_.getName(),var5));
|
||||
MinecraftProfileTexture var3=((MinecraftProfileTexture)var1.get(Type.SKIN));
|
||||
String var4=var3.getMetadata("model");
|
||||
HashMap var5 = null;
|
||||
if(var4!=null){
|
||||
var5 = Maps.newHashMap();
|
||||
var5.put("model", var4);
|
||||
}
|
||||
var2.put(Type.SKIN, new MinecraftProfileTexture(var3.getUrl()+"?Skin="+p_152790_1_.getName(),var5));
|
||||
}else{
|
||||
var2.put(Type.SKIN,new MinecraftProfileTexture( "http://skins.minecraft.net/MinecraftSkins/"+p_152790_1_.getName()+".png",null));
|
||||
HashMap var5 = Maps.newHashMap();
|
||||
var5.put("model", "slim");
|
||||
var2.put(Type.SKIN,new MinecraftProfileTexture( "http://skins.minecraft.net/MinecraftSkins/"+p_152790_1_.getName()+".png",var5));
|
||||
}
|
||||
if (var1.containsKey(Type.CAPE)){
|
||||
var2.put(Type.CAPE, new MinecraftProfileTexture(((MinecraftProfileTexture)var1.get(Type.CAPE)).getUrl()+"?Cloak="+p_152790_1_.getName(),null));
|
||||
var2.put(Type.CAPE, new MinecraftProfileTexture(((MinecraftProfileTexture)var1.get(Type.CAPE)).getUrl()+"?Cloak="+p_152790_1_.getName(),null));
|
||||
}else{
|
||||
var2.put(Type.CAPE,new MinecraftProfileTexture( "http://skins.minecraft.net/MinecraftCloaks/"+p_152790_1_.getName()+".png",null));
|
||||
var2.put(Type.CAPE,new MinecraftProfileTexture( "http://skins.minecraft.net/MinecraftCloaks/"+p_152790_1_.getName()+".png",null));
|
||||
}
|
||||
var1.clear();
|
||||
var1.putAll(var2);
|
||||
|
||||
@@ -24,8 +24,7 @@ public class ClassTransformer implements IClassTransformer {
|
||||
if (tempZipFile == null)
|
||||
continue;
|
||||
zipFile = tempZipFile;
|
||||
ForgeTweaker.logger.info("URL: " + url);
|
||||
ForgeTweaker.logger.info("File: " + zipFile);
|
||||
ForgeTweaker.logger.info("Jar File URL: " + url);
|
||||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -12,6 +12,9 @@ import net.minecraft.launchwrapper.LaunchClassLoader;
|
||||
public class Tweaker implements ITweaker {
|
||||
|
||||
private List args;
|
||||
private String gameDir;
|
||||
private String assetsDir;
|
||||
private String profile;
|
||||
|
||||
private static final File TWEAKER_LOG_FILE = new File("CustomSkinLoader/Tweaker.log");
|
||||
public static MainLogger logger = new MainLogger(TWEAKER_LOG_FILE);
|
||||
@@ -23,12 +26,9 @@ public class Tweaker implements ITweaker {
|
||||
public void acceptOptions(List args, File gameDir, File assetsDir, String profile) {
|
||||
logger.info("Tweaker: acceptOptions");
|
||||
this.args = new ArrayList(args);
|
||||
this.args.add("--gameDir");
|
||||
this.args.add(gameDir.getAbsolutePath());
|
||||
this.args.add("--assetsDir");
|
||||
this.args.add(assetsDir.getAbsolutePath());
|
||||
this.args.add("--version");
|
||||
this.args.add(profile);
|
||||
this.gameDir = gameDir.getAbsolutePath();
|
||||
this.assetsDir = assetsDir.getAbsolutePath();
|
||||
this.profile = profile;
|
||||
}
|
||||
|
||||
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
|
||||
@@ -43,6 +43,12 @@ public class Tweaker implements ITweaker {
|
||||
|
||||
public String[] getLaunchArguments() {
|
||||
logger.info("Tweaker: getLaunchArguments");
|
||||
this.args.add("--gameDir");
|
||||
this.args.add(gameDir);
|
||||
this.args.add("--assetsDir");
|
||||
this.args.add(assetsDir);
|
||||
this.args.add("--version");
|
||||
this.args.add(profile);
|
||||
return (String[])args.toArray(new String[args.size()]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user