1.7.6 supported..........Test only

This commit is contained in:
xfl03 committed 2014-04-25 20:14:00 +08:00
1 parent e702945538
commit a5c7413f99
5 files changed
+473

No files matched your search

+128
View File
@@ -0,0 +1,128 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SourceFile
import java.awt.Graphics;
import java.awt.image.*;
public class bom
implements boh
{
private int a[];
private int w23;
private int h23;
public bom()
{
}
public BufferedImage a(BufferedImage bufferedimage)
{
if (bufferedimage == null)
return null;
w23 = bufferedimage.getWidth(null);
h23 = bufferedimage.getHeight(null);
BufferedImage bufferedimage1 = new BufferedImage(w23, h23, 2);
Graphics g = bufferedimage1.getGraphics();
g.drawImage(bufferedimage, 0, 0, null);
g.dispose();
a = ((DataBufferInt)bufferedimage1.getRaster().getDataBuffer()).getData();
if (w23 == 128 && h23 == 64)
{
b(0, 0, 0, 0);
a(32, 0, 128, 64);
b(0, 16, 0, 0);
} else
if (w23 == 256 && h23 == 128)
{
b(0, 0, 0, 0);
a(32, 0, 256, 128);
b(0, 16, 0, 0);
} else
if (w23 == 512 && h23 == 256)
{
b(0, 0, 32, 16);
a(32, 0, 512, 256);
b(0, 16, 0, 0);
} else
{
b(0, 0, 32, 16);
a(32, 0, 64, 32);
b(0, 16, 64, 32);
}
boolean flag = false;
for (int i = 32; i < 64; i++)
{
for (int k = 0; k < 16; k++)
{
int i1 = a[i + k * 64];
if ((i1 >> 24 & 0xff) < 128)
flag = true;
}
}
if (!flag)
{
for (int j = 32; j < 64; j++)
{
for (int l = 0; l < 16; l++)
{
int j1 = a[j + l * 64];
boolean flag1;
if ((j1 >> 24 & 0xff) < 128)
flag1 = true;
}
}
}
return bufferedimage1;
}
public void a()
{
}
private void a(int i, int j, int k, int l)
{
if (c(i, j, k, l))
return;
for (int i1 = i; i1 < k; i1++)
{
for (int j1 = j; j1 < l; j1++)
a[i1 + j1 * w23] &= 0xffffff;
}
}
private void b(int i, int j, int k, int l)
{
for (int i1 = i; i1 < k; i1++)
{
for (int j1 = j; j1 < l; j1++)
a[i1 + j1 * w23] |= 0xff000000;
}
}
private boolean c(int i, int j, int k, int l)
{
for (int i1 = i; i1 < k; i1++)
{
for (int j1 = j; j1 < l; j1++)
{
int k1 = a[i1 + j1 * w23];
if ((k1 >> 24 & 0xff) < 128)
return true;
}
}
return false;
}
}
+105
View File
@@ -0,0 +1,105 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SourceFile
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
import javax.imageio.ImageIO;
public class bsb extends bse
{
private static final AtomicInteger d = new AtomicInteger(0);
private final File e;
private final String f;
private final boh g;
private BufferedImage h;
private Thread i;
private boolean j;
public bsb(File file, String s, bth bth, boh boh1)
{
super(bth);
e = file;
f = s;
g = boh1;
}
private void f()
{
if (j)
return;
if (h != null)
{
if (b != null)
c();
bss.a(super.b(), h);
j = true;
}
}
public int b()
{
f();
return super.b();
}
public void a(BufferedImage bufferedimage)
{
h = bufferedimage;
if (g != null)
g.a();
}
public void a(bti bti1)
{
if (h == null && b != null)
super.a(bti1);
if (i == null)
if (e != null && e.isFile())
{
try
{
h = ImageIO.read(e);
if (g != null)
a(g.a(h));
}
catch (IOException ioexception)
{
a();
}
} else
{
a();
}
}
protected void a()
{
i = new bsc(this, (new StringBuilder()).append("Texture Downloader #").append(d.incrementAndGet()).toString());
i.setDaemon(true);
i.start();
}
static String a(bsb bsb1)
{
return bsb1.f;
}
static File b(bsb bsb1)
{
return bsb1.e;
}
static boh c(bsb bsb1)
{
return bsb1.g;
}
}
+37
View File
@@ -0,0 +1,37 @@
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SourceFile
import java.awt.image.BufferedImage;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.imageio.ImageIO;
import idv.jlchntoz.CustomSkinLoader;
class bsc extends Thread
{
final bsb a;
bsc(bsb bsb1, String s)
{
a = bsb1;
}
public void run()
{
CustomSkinLoader Loader = new CustomSkinLoader();
try
{
BufferedImage var2 = ImageIO.read(Loader.getPlayerSkinStream(bsb.a(a)));
a.a(var2);
}
catch (Exception var6)
{
return;
}
}
}
+14
View File
@@ -0,0 +1,14 @@
@echo off
title CustomSkinLoader 1.7.6 Builder
echo Please Build with Minecraft 1.7.6 classes
echo Building CustomSkinLoader.java[Main]
cd idv/jlchntoz
javac CustomSkinLoader.java
cd ../..
echo Building bom.java[For HD Skin]
javac bom.java
echo Building bsb.java[DownloadImage]
javac bsb.java
echo Building bsc.java[ThreadDownloadImage]
javac bsc.java
pause
+189
View File
@@ -0,0 +1,189 @@
package idv.jlchntoz;
import java.io.*;
import java.net.*;
import java.util.logging.*;
import java.util.regex.*;
/**
* Custom skin loader mod for Minecraft.
*
* @version 10th Revision 1st Subversion 2014.4.20
* @author (C) Jeremy Lam [JLChnToZ] 2013 & Alexander Xia [xfl03] 2014
*/
public class CustomSkinLoader {
public final static String DefaultSkinURL = "http://skins.minecraft.net/MinecraftSkins/*.png";
public final static String DefaultCloakURL = "http://skins.minecraft.net/MinecraftCloaks/*.png";
private final static Pattern newURLPattern = Pattern.compile("^http://skins.minecraft.net/Minecraft(Skin|Cloak)s/(.*?).png$"),
oldURLPattern = Pattern.compile("^http://s3.amazonaws.com/Minecraft(Skin|Cloak)s/(.*?).png$");
private final static Logger logger = Logger
.getLogger(CustomSkinLoader.class.getName());
private static String[] cloakURLs = null, skinURLs = null;
private HttpURLConnection C = null;
public InputStream getPlayerSkinStream(String path) {
Matcher m = newURLPattern.matcher(path);
if (!m.matches())//Is not new url
{
m = oldURLPattern.matcher(path);//If is old url
}
if (m.matches()) {
if (m.group(1).contains("Skin")) // Skin
return getPlayerSkinStream(false, m.group(2));
else if (m.group(1).contains("Cloak")) // Cloak
return getPlayerSkinStream(true, m.group(2));
}
return getStream(path, false); // Neither skin nor cloak...
}
public InputStream getPlayerSkinStream(Boolean isCloak, String playerName) {
if (skinURLs == null || cloakURLs == null || skinURLs.length <= 0
|| cloakURLs.length <= 0)
refreshSkinURL(); // If the list is blank or null, try to load
// again.
for (String l : isCloak ? cloakURLs : skinURLs) {
if(l==null||l.equalsIgnoreCase(""))
continue;
String loc = str_replace("*", playerName, l);
logger.log(Level.INFO, "Try to load " + (isCloak ? "cloak" : "skin") + " in " + loc);
InputStream S = getStream(loc, true);
if (S == null)
logger.log(Level.INFO, "No " + (isCloak ? "cloak" : "skin")
+ " found in " + loc);
else
return S;
}
logger.log(Level.INFO, "Try to load skin in default URL instead.");
return getStream(str_replace("*", playerName, isCloak ? DefaultCloakURL : DefaultSkinURL), true);
}
private InputStream getStream(String URL, Boolean CheckPNG) {
try {
URL U = new URL(URL);
C = (HttpURLConnection) U.openConnection();
C.setDoInput(true);
C.setDoOutput(false);
C.connect();
int respcode = C.getResponseCode() / 100;
if (respcode != 4 && respcode != 5) { // Successful (?) to get skin.
BufferedInputStream IS = new BufferedInputStream(
C.getInputStream());
if (!CheckPNG) // If no need to check PNG header, just skip it.
return IS;
IS.mark(0);
byte[] ib = new byte[4];
IS.read(ib);
if (ib[1] == (byte) 'P' && ib[2] == (byte) 'N'
&& ib[3] == (byte) 'G') { // Check PNG Header if needed
IS.reset();
return IS;
}
}
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
} finally {
disconnect();
}
return null;
}
public void disconnect() {
if (C != null)
C.disconnect();
}
private static void refreshSkinURL() {
try {
File mcdir = new File("");
skinURLs = readAllLines(mcdir, "skinurls.txt");
cloakURLs = readAllLines(mcdir, "capeurls.txt");
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
} finally {
logger.log(Level.INFO, "Skin URLs Refreshed. Skin count = "
+ skinURLs.length + ", Cloak count = " + cloakURLs.length);
}
}
private static String[] readAllLines(File mcdir, String path) {
try {
File F = new File(mcdir, path);
logger.log(Level.INFO, "Config file: " + F.getAbsolutePath());
if (!F.exists()) {
logger.log(Level.INFO, "Config file not found, create new one.");
de(mcdir);
return new String[0];
} else if (F.length() <= 0) {
logger.log(Level.INFO, "Config file is blank, skipped.");
return new String[0];
} else {
byte[] b = new byte[(int) F.length()];
BufferedInputStream S = new BufferedInputStream(
new FileInputStream(F));
S.read(b);
S.close();
logger.log(Level.INFO, "Config file loaded.");
String[] re= str_replace("\r", "\n",
str_replace("\r\n", "\n", new String(b))).split("\n");
for(int i=0;i<re.length;i++){
if(re[i].startsWith("#"))
re[i]=null;
else{
for(int g=0;g<re.length;g++){
if(i==g)
continue;
if(re[i].equalsIgnoreCase(re[g])){
re[i]=null;
break;
}
}
}
}
return re;
}
} catch (Exception ex) {
logger.log(Level.WARNING, ex.getMessage());
return new String[0];
}
}
private static String str_replace(String search, String replace,
String subject) {
StringBuffer result = new StringBuffer(subject);
int pos;
while ((pos = result.indexOf(search)) != -1)
result.replace(pos, pos + search.length(), replace);
return result.toString();
}
public static void de(File mcdir){
File a=new File(mcdir,"CustomSkinLoaderGUI.jar");
if(!a.exists())
downloadFile("https://raw.githubusercontent.com/JLChnToZ/MCCustomSkinLoader/GUI/CustomSkinLoaderGUI.jar",a.getAbsolutePath());
try{
Runtime.getRuntime().exec("java -jar \""+a.getAbsolutePath()+"\" f");
}catch(Exception e){
}
}
public static boolean downloadFile(String remote,String local){
try {
int byteRead = 0;
URL url = new URL(remote);
URLConnection conn = url.openConnection();
InputStream inStream = conn.getInputStream();
FileOutputStream fs = new FileOutputStream(local);
byte[] buffer = new byte[1204];
while (( byteRead = inStream.read(buffer)) != -1) {
fs.write(buffer, 0, byteRead);
}
fs.close();
return new File(local).exists();
}catch (Exception e) {
return false;
}
}
}