mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-25 04:04:25 +00:00
Compare commits
10
Commits
12.9-archive
...
1.0.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2e4235227 | ||
|
|
d99e82224b | ||
|
|
bf69fb5d42 | ||
|
|
a7a89bb621 | ||
|
|
583c610c8d | ||
|
|
ff7fa75cfa | ||
|
|
0c9bb21145 | ||
|
|
72d381cb4f | ||
|
|
b5bce5c4be | ||
|
|
b9138676ca |
No files matched your search
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -4,7 +4,6 @@
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>CustomSkinLoaderGUI</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,11 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
@@ -1,145 +0,0 @@
|
||||
package idv.jlchntoz;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.logging.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
/**
|
||||
* Custom skin loader mod for Minecraft.
|
||||
*
|
||||
* @version 9th Revision 2014.4.15
|
||||
* @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) {
|
||||
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 = Minecraft.getMinecraft().mcDataDir;
|
||||
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.");
|
||||
F.createNewFile();
|
||||
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.");
|
||||
return str_replace("\r", "\n",
|
||||
str_replace("\r\n", "\n", new String(b))).split("\n");
|
||||
}
|
||||
} 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();
|
||||
}
|
||||
}
|
||||
-112
@@ -1,112 +0,0 @@
|
||||
package net.minecraft.client.renderer;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import javax.imageio.ImageIO;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.SimpleTexture;
|
||||
import net.minecraft.client.renderer.texture.TextureUtil;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import idv.jlchntoz.CustomSkinLoader;
|
||||
|
||||
public class ThreadDownloadImageData extends SimpleTexture
|
||||
{
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
private static final AtomicInteger field_147643_d = new AtomicInteger(0);
|
||||
private final String imageUrl;
|
||||
private final IImageBuffer imageBuffer;
|
||||
private BufferedImage bufferedImage;
|
||||
private Thread imageThread;
|
||||
private boolean textureUploaded;
|
||||
private static final String __OBFID = "CL_00001049";
|
||||
|
||||
public ThreadDownloadImageData(String par1Str, ResourceLocation par2ResourceLocation, IImageBuffer par3IImageBuffer)
|
||||
{
|
||||
super(par2ResourceLocation);
|
||||
this.imageUrl = par1Str;
|
||||
this.imageBuffer = par3IImageBuffer;
|
||||
}
|
||||
|
||||
private void func_147640_e()
|
||||
{
|
||||
if (!this.textureUploaded)
|
||||
{
|
||||
if (this.bufferedImage != null)
|
||||
{
|
||||
if (this.textureLocation != null)
|
||||
{
|
||||
this.func_147631_c();
|
||||
}
|
||||
|
||||
TextureUtil.uploadTextureImage(super.getGlTextureId(), this.bufferedImage);
|
||||
this.textureUploaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getGlTextureId()
|
||||
{
|
||||
this.func_147640_e();
|
||||
return super.getGlTextureId();
|
||||
}
|
||||
|
||||
public void func_147641_a(BufferedImage p_147641_1_)
|
||||
{
|
||||
this.bufferedImage = p_147641_1_;
|
||||
}
|
||||
|
||||
public void loadTexture(IResourceManager par1ResourceManager) throws IOException
|
||||
{
|
||||
if (this.bufferedImage == null && this.textureLocation != null)
|
||||
{
|
||||
super.loadTexture(par1ResourceManager);
|
||||
}
|
||||
|
||||
if (this.imageThread == null)
|
||||
{
|
||||
this.imageThread = new Thread("Texture Downloader #" + field_147643_d.incrementAndGet())
|
||||
{
|
||||
private static final String __OBFID = "CL_00001050";
|
||||
public void run()
|
||||
{
|
||||
|
||||
CustomSkinLoader Loader = new CustomSkinLoader();
|
||||
|
||||
try
|
||||
{
|
||||
BufferedImage var2 = ImageIO.read(Loader.getPlayerSkinStream(ThreadDownloadImageData.this.imageUrl));
|
||||
|
||||
if (ThreadDownloadImageData.this.imageBuffer != null)
|
||||
{
|
||||
var2 = ThreadDownloadImageData.this.imageBuffer.parseUserSkin(var2);
|
||||
}
|
||||
|
||||
ThreadDownloadImageData.this.func_147641_a(var2);
|
||||
}
|
||||
catch (Exception var6)
|
||||
{
|
||||
ThreadDownloadImageData.logger.error("Couldn\'t download http texture", var6);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
this.imageThread.setDaemon(true);
|
||||
this.imageThread.setName("Skin downloader: " + this.imageUrl);
|
||||
this.imageThread.start();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isTextureUploaded()
|
||||
{
|
||||
this.func_147640_e();
|
||||
return this.textureUploaded;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,3 +1,23 @@
|
||||
MCCustomSkinLoader
|
||||
==================
|
||||
MCCustomSkinLoaderGUI
|
||||
=====================
|
||||
/*
|
||||
|
||||
|
||||
版权所有(C) 2013-2014 JLChnToZ xfl03
|
||||
|
||||
这一程序是自由软件,你可以遵照自由软件基金会出版的GNU通用公共许可证条款来修改和重新发布这一程序。或者用许可证的第三版,或者(根据你的选择)用任何更新的版本。
|
||||
|
||||
发布这一程序的目的是希望它有用,但没有任何担保。甚至没有适合特定目的的隐含的担保。更详细的情况请参阅GNU通用公共许可证。
|
||||
|
||||
|
||||
Copyright(C) 2013-2014 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 distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
http://www.gnu.org/licenses/gpl.html
|
||||
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package idv.jlchntoz;
|
||||
|
||||
import idv.jlchntoz.gui.MainFrame;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class CustomSkinLoaderGUI {
|
||||
|
||||
public static final String VERSION ="1.0.3";
|
||||
|
||||
public static final Logger log=Logger.getLogger("CustomSkinLoader-GUI");
|
||||
|
||||
public static void main(String[] args) {
|
||||
log.info("Thanks for using CustomSkinLoader!");
|
||||
log.info("Version "+VERSION+" !");
|
||||
MainFrame mf=new MainFrame();
|
||||
mf.init(args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
package idv.jlchntoz.gui;
|
||||
|
||||
import idv.jlchntoz.lang.Language;
|
||||
import idv.jlchntoz.lang.DefaultLang;
|
||||
|
||||
import java.awt.Container;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
public class CloakFrame {
|
||||
private static DefaultLang lang=Language.getLanguage();
|
||||
public static boolean mod=false;
|
||||
public static final String[] urls={
|
||||
"#"+lang.minecraftOffical(),
|
||||
"http://s3.amazonaws.com/MinecraftCloaks/*.png",
|
||||
"http://skins.minecraft.net/MinecraftCloaks/*.png",
|
||||
"#MineCrack",
|
||||
"http://minecrack.fr.nf/mc/cloaksminecrackd/*.png",
|
||||
/*
|
||||
* XFL03's Skin Website Closed
|
||||
"#OpenSkin",
|
||||
"http://skin.axdt.net/MinecraftCloaks/*.png",
|
||||
*/
|
||||
"#SkinMe",
|
||||
"http://www.skinme.cc:88/MinecraftCloaks/*.png"
|
||||
|
||||
};
|
||||
|
||||
public static void main(String[] args) {
|
||||
final JFrame jf = new JFrame (lang.title()+" - "+lang.cloak()+lang.loadList());
|
||||
Container con = jf.getContentPane();
|
||||
con.setLayout(null);
|
||||
//setBounds(x,y,width,height)
|
||||
jf.setBounds(400, 200, 515, 420);
|
||||
|
||||
Font boldCourier=new Font("Courier", Font.BOLD, 30);
|
||||
|
||||
JLabel title=new JLabel();
|
||||
title.setText(lang.cloak()+lang.loadList());
|
||||
title.setFont(boldCourier);
|
||||
title.setBounds(130, 5, 370, 30);
|
||||
con.add(title);
|
||||
|
||||
final JTextArea cloakList=new JTextArea();
|
||||
cloakList.setBounds(15, 40, 470, 266);
|
||||
con.add(cloakList);
|
||||
cloakList.setText(read("capeurls.txt"));
|
||||
|
||||
JButton defaultBtn=new JButton();
|
||||
defaultBtn.setText(lang.useDefault());
|
||||
defaultBtn.setBounds(15, 310, 235, 30);
|
||||
con.add(defaultBtn);
|
||||
defaultBtn.addActionListener(new ActionListener(){ //单击事件
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e){
|
||||
String temp="";
|
||||
for(int i=0;i<=2;i++)
|
||||
temp+=urls[i]+"\n";
|
||||
cloakList.setText(temp);
|
||||
};
|
||||
});
|
||||
JButton urlBtn=new JButton();
|
||||
urlBtn.setText(lang.useRecommended());
|
||||
urlBtn.setBounds(250, 310, 235, 30);
|
||||
con.add(urlBtn);
|
||||
urlBtn.addActionListener(new ActionListener(){ //单击事件
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e){
|
||||
String temp=cloakList.getText()+"\n";
|
||||
for(int i=0;i<urls.length;i++)
|
||||
temp+=urls[i]+"\n";
|
||||
cloakList.setText(temp);
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
JButton skinBtn=new JButton();
|
||||
skinBtn.setText(lang.save());
|
||||
skinBtn.setBounds(15, 350, 235, 30);
|
||||
con.add(skinBtn);
|
||||
skinBtn.addActionListener(new ActionListener(){ //单击事件
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e){
|
||||
save(cloakList.getText());
|
||||
JOptionPane.showMessageDialog(null,lang.saved());
|
||||
};
|
||||
});
|
||||
|
||||
JButton clokeBtn=new JButton();
|
||||
clokeBtn.setText(lang.close());
|
||||
clokeBtn.setBounds(250, 350, 235, 30);
|
||||
con.add(clokeBtn);
|
||||
clokeBtn.addActionListener(new ActionListener(){ //单击事件
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e){
|
||||
jf.setVisible(false);
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
jf.setVisible(true);
|
||||
jf.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
|
||||
jf.setResizable(false);
|
||||
|
||||
}
|
||||
|
||||
public static void save(String data){
|
||||
File a=new File("capeurls.txt");
|
||||
try {
|
||||
a.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
write(a.getAbsolutePath(),data);
|
||||
}
|
||||
|
||||
public static boolean write(String FileName,String Data){
|
||||
FileWriter fw=null;
|
||||
try{
|
||||
fw = new FileWriter(FileName);
|
||||
fw.write(Data,0,Data.length());
|
||||
fw.flush();
|
||||
fw.close();
|
||||
}catch(Exception ex){
|
||||
//ex.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public static String read(String FileName){
|
||||
BufferedReader br = null;
|
||||
String data="";
|
||||
try {
|
||||
br = new BufferedReader(new FileReader(FileName));
|
||||
data = br.readLine();
|
||||
while( br.ready()){
|
||||
data += "\n"+br.readLine();
|
||||
}
|
||||
br.close();
|
||||
return data;
|
||||
} catch (Exception ex) {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package idv.jlchntoz.gui;
|
||||
|
||||
import idv.jlchntoz.lang.Language;
|
||||
import idv.jlchntoz.lang.DefaultLang;
|
||||
|
||||
import java.awt.Container;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
public class MainFrame {
|
||||
private static DefaultLang lang=Language.getLanguage();
|
||||
|
||||
public void init(String[] args) {
|
||||
|
||||
JFrame jf = new JFrame (lang.title()+lang.gui());
|
||||
Container con = jf.getContentPane();
|
||||
con.setLayout(null);
|
||||
//setBounds(x,y,width,height)
|
||||
jf.setBounds(400, 200, 400, 300);
|
||||
|
||||
Font boldCourier=new Font("Courier", Font.BOLD, 30);
|
||||
|
||||
JLabel title=new JLabel();
|
||||
title.setText(lang.title()+lang.index());
|
||||
title.setFont(boldCourier);
|
||||
title.setBounds(15, 5, 370, 30);
|
||||
con.add(title);
|
||||
|
||||
if(args.length>0 && args[0].equalsIgnoreCase("f")){
|
||||
JLabel tip1=new JLabel();
|
||||
tip1.setText(lang.first1());
|
||||
tip1.setBounds(30, 55, 370, 15);
|
||||
con.add(tip1);
|
||||
|
||||
JLabel tip2=new JLabel();
|
||||
tip2.setText(lang.first2());
|
||||
tip2.setBounds(30, 70, 370, 15);
|
||||
con.add(tip2);
|
||||
}
|
||||
if(args.length>1){
|
||||
JLabel tip3=new JLabel();
|
||||
tip3.setText(lang.yourVersion()+" "+args[1]);
|
||||
tip3.setBounds(30, 90, 370, 15);
|
||||
con.add(tip3);
|
||||
}
|
||||
|
||||
JButton skinBtn=new JButton();
|
||||
skinBtn.setText(lang.skin()+lang.loadList());
|
||||
skinBtn.setBounds(15, 180, 370, 30);
|
||||
con.add(skinBtn);
|
||||
skinBtn.addActionListener(new ActionListener(){ //µ¥»÷ʼþ
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e){
|
||||
String[] aa={};
|
||||
SkinFrame.main(aa);
|
||||
};
|
||||
});
|
||||
|
||||
JButton clokeBtn=new JButton();
|
||||
clokeBtn.setText(lang.cloak()+lang.loadList());
|
||||
clokeBtn.setBounds(15, 215, 370, 30);
|
||||
con.add(clokeBtn);
|
||||
clokeBtn.addActionListener(new ActionListener(){ //µ¥»÷ʼþ
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e){
|
||||
String[] aa={};
|
||||
CloakFrame.main(aa);
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
jf.setVisible(true);
|
||||
jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
jf.setResizable(false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
package idv.jlchntoz.gui;
|
||||
|
||||
import idv.jlchntoz.lang.Language;
|
||||
import idv.jlchntoz.lang.DefaultLang;
|
||||
|
||||
import java.awt.Container;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
public class SkinFrame {
|
||||
private static DefaultLang lang=Language.getLanguage();
|
||||
public static boolean mod=false;
|
||||
public static final String[] urls={
|
||||
"#"+lang.minecraftOffical(),
|
||||
"http://s3.amazonaws.com/MinecraftSkins/*.png",
|
||||
"http://skins.minecraft.net/MinecraftSkins/*.png",
|
||||
"#MineCrack",
|
||||
"http://minecrack.fr.nf/mc/skinsminecrackd/*.png",
|
||||
/*
|
||||
* XFL03's Skin Website Closed
|
||||
"#OpenSkin",
|
||||
"http://skin.axdt.net/MinecraftSkins/*.png",
|
||||
*/
|
||||
"#SkinMe",
|
||||
"http://www.skinme.cc:88/MinecraftSkins/*.png"
|
||||
|
||||
};
|
||||
|
||||
public static void main(String[] args) {
|
||||
final JFrame jf = new JFrame (lang.title()+" - "+lang.skin()+lang.loadList());
|
||||
Container con = jf.getContentPane();
|
||||
con.setLayout(null);
|
||||
//setBounds(x,y,width,height)
|
||||
jf.setBounds(400, 200, 515, 420);
|
||||
|
||||
Font boldCourier=new Font("Courier", Font.BOLD, 30);
|
||||
|
||||
JLabel title=new JLabel();
|
||||
title.setText(lang.skin()+lang.loadList());
|
||||
title.setFont(boldCourier);
|
||||
title.setBounds(130, 5, 370, 30);
|
||||
con.add(title);
|
||||
|
||||
final JTextArea skinList=new JTextArea();
|
||||
skinList.setBounds(15, 40, 470, 266);
|
||||
con.add(skinList);
|
||||
skinList.setText(read("skinurls.txt"));
|
||||
|
||||
JButton defaultBtn=new JButton();
|
||||
defaultBtn.setText(lang.useDefault());
|
||||
defaultBtn.setBounds(15, 310, 235, 30);
|
||||
con.add(defaultBtn);
|
||||
defaultBtn.addActionListener(new ActionListener(){ //单击事件
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e){
|
||||
String temp="";
|
||||
for(int i=0;i<=2;i++)
|
||||
temp+=urls[i]+"\r\n";
|
||||
skinList.setText(temp);
|
||||
};
|
||||
});
|
||||
JButton urlBtn=new JButton();
|
||||
urlBtn.setText(lang.useRecommended());
|
||||
urlBtn.setBounds(250, 310, 235, 30);
|
||||
con.add(urlBtn);
|
||||
urlBtn.addActionListener(new ActionListener(){ //单击事件
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e){
|
||||
String temp=skinList.getText()+"\r\n";
|
||||
for(int i=0;i<urls.length;i++)
|
||||
temp+=urls[i]+"\r\n";
|
||||
skinList.setText(temp);
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
JButton skinBtn=new JButton();
|
||||
skinBtn.setText(lang.save());
|
||||
skinBtn.setBounds(15, 350, 235, 30);
|
||||
con.add(skinBtn);
|
||||
skinBtn.addActionListener(new ActionListener(){ //单击事件
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e){
|
||||
save(skinList.getText());
|
||||
JOptionPane.showMessageDialog(null,lang.saved());
|
||||
};
|
||||
});
|
||||
|
||||
JButton clokeBtn=new JButton();
|
||||
clokeBtn.setText(lang.close());
|
||||
clokeBtn.setBounds(250, 350, 235, 30);
|
||||
con.add(clokeBtn);
|
||||
clokeBtn.addActionListener(new ActionListener(){ //单击事件
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e){
|
||||
jf.setVisible(false);
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
jf.setVisible(true);
|
||||
jf.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
|
||||
jf.setResizable(false);
|
||||
|
||||
}
|
||||
|
||||
public static void save(String data){
|
||||
File a=new File("skinurls.txt");
|
||||
try {
|
||||
a.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
write(a.getAbsolutePath(),data);
|
||||
}
|
||||
|
||||
public static boolean write(String FileName,String Data){
|
||||
FileWriter fw=null;
|
||||
try{
|
||||
fw = new FileWriter(FileName);
|
||||
fw.write(Data,0,Data.length());
|
||||
fw.flush();
|
||||
fw.close();
|
||||
}catch(Exception ex){
|
||||
//ex.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public static String read(String FileName){
|
||||
BufferedReader br = null;
|
||||
String data="";
|
||||
try {
|
||||
br = new BufferedReader(new FileReader(FileName));
|
||||
data = br.readLine();
|
||||
while( br.ready()){
|
||||
data += "\n"+br.readLine();
|
||||
}
|
||||
br.close();
|
||||
return data;
|
||||
} catch (Exception ex) {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package idv.jlchntoz.lang;
|
||||
|
||||
|
||||
public class ChineseSimpLang extends DefaultLang {
|
||||
@Override
|
||||
public String title(){
|
||||
return "自定义皮肤加载器";
|
||||
}
|
||||
@Override
|
||||
public String gui(){
|
||||
return " 图形化界面";
|
||||
}
|
||||
@Override
|
||||
public String index(){
|
||||
return " 索引";
|
||||
}
|
||||
@Override
|
||||
public String first1(){
|
||||
return "这是您第一次使用自定义皮肤加载器!";
|
||||
}
|
||||
@Override
|
||||
public String first2(){
|
||||
return "请点击下列按钮以修改设置!";
|
||||
}
|
||||
@Override
|
||||
public String skin(){
|
||||
return "皮肤";
|
||||
}
|
||||
@Override
|
||||
public String cloak(){
|
||||
return "披风";
|
||||
}
|
||||
@Override
|
||||
public String loadList(){
|
||||
return "加载列表";
|
||||
}
|
||||
@Override
|
||||
public String minecraftOffical(){
|
||||
return "Minecraft 官方[正版]";
|
||||
}
|
||||
@Override
|
||||
public String useDefault(){
|
||||
return "使用默认(官方)";
|
||||
}
|
||||
@Override
|
||||
public String useRecommended(){
|
||||
return "使用推荐";
|
||||
}
|
||||
@Override
|
||||
public String save(){
|
||||
return "保存";
|
||||
}
|
||||
@Override
|
||||
public String saved(){
|
||||
return "已保存,请重新启动游戏!";
|
||||
}
|
||||
@Override
|
||||
public String close(){
|
||||
return "关闭";
|
||||
}
|
||||
@Override
|
||||
public String yourVersion(){
|
||||
return "您的皮肤模组版本:";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package idv.jlchntoz.lang;
|
||||
|
||||
|
||||
public class ChineseTranLang extends DefaultLang {
|
||||
@Override
|
||||
public String title(){
|
||||
return "萬用皮膚模組";
|
||||
}
|
||||
@Override
|
||||
public String gui(){
|
||||
return " 用戶界面";
|
||||
}
|
||||
@Override
|
||||
public String index(){
|
||||
return " 目錄";
|
||||
}
|
||||
@Override
|
||||
public String first1(){
|
||||
return "這是您第一次使用本模組!";
|
||||
}
|
||||
@Override
|
||||
public String first2(){
|
||||
return "請單擊下列按鈕進行配置修改!";
|
||||
}
|
||||
@Override
|
||||
public String skin(){
|
||||
return "皮膚";
|
||||
}
|
||||
@Override
|
||||
public String cloak(){
|
||||
return "披風";
|
||||
}
|
||||
@Override
|
||||
public String loadList(){
|
||||
return "加載列表";
|
||||
}
|
||||
@Override
|
||||
public String minecraftOffical(){
|
||||
return "Minecraft 官方[正版]";
|
||||
}
|
||||
@Override
|
||||
public String useDefault(){
|
||||
return "使用默認(官方)";
|
||||
}
|
||||
@Override
|
||||
public String useRecommended(){
|
||||
return "使用推薦";
|
||||
}
|
||||
@Override
|
||||
public String save(){
|
||||
return "保存";
|
||||
}
|
||||
@Override
|
||||
public String saved(){
|
||||
return "已保存,請重新開啟遊戲!";
|
||||
}
|
||||
@Override
|
||||
public String close(){
|
||||
return "關閉";
|
||||
}
|
||||
@Override
|
||||
public String yourVersion(){
|
||||
return "您的皮膚模組版本:";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package idv.jlchntoz.lang;
|
||||
|
||||
public class DefaultLang {
|
||||
public String title(){
|
||||
return "CustomSkinLoader";
|
||||
}
|
||||
public String gui(){
|
||||
return " GUI";
|
||||
}
|
||||
public String index(){
|
||||
return " Index";
|
||||
}
|
||||
public String first1(){
|
||||
return "It's your first time use CustomSkinLoader!";
|
||||
}
|
||||
public String first2(){
|
||||
return "Please click buttons below to modify config!";
|
||||
}
|
||||
public String skin(){
|
||||
return "Skin";
|
||||
}
|
||||
public String cloak(){
|
||||
return "Cloak";
|
||||
}
|
||||
public String loadList(){
|
||||
return " Load List";
|
||||
}
|
||||
public String minecraftOffical(){
|
||||
return "Minecraft Offical";
|
||||
}
|
||||
public String useDefault(){
|
||||
return "Use Default(Offical)";
|
||||
}
|
||||
public String useRecommended(){
|
||||
return "Use Recommended";
|
||||
}
|
||||
public String save(){
|
||||
return "Save";
|
||||
}
|
||||
public String saved(){
|
||||
return "Saved!Restart the game, please!";
|
||||
}
|
||||
public String close(){
|
||||
return "Close";
|
||||
}
|
||||
public String yourVersion(){
|
||||
return "Your CustomSkinLoader Version:";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package idv.jlchntoz.lang;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class Language {
|
||||
|
||||
public static DefaultLang getLanguage(){
|
||||
Locale locale = Locale.getDefault();
|
||||
String l=locale.getLanguage().toLowerCase();
|
||||
String c=locale.getCountry().toLowerCase();
|
||||
if(l.equalsIgnoreCase("zh")){
|
||||
if(c.equalsIgnoreCase("cn")){
|
||||
//zh_cn
|
||||
return new ChineseSimpLang();
|
||||
}
|
||||
//zh
|
||||
return new ChineseTranLang();
|
||||
}
|
||||
//en
|
||||
return new DefaultLang();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user