mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-21 12:42:15 +00:00
Fixed data folder
This commit is contained in:
1 parent
fcb24315e5
commit
a16c4a7b44
4 files changed
+57
-10
No files matched your search
+2
-2
@@ -1,9 +1,9 @@
|
||||
@echo off
|
||||
SET MC_VERSION=1.9.2
|
||||
SET CSL_VERSION=13.5
|
||||
SET CSL_VERSION=13.6
|
||||
cd src
|
||||
javac -source 1.6 -target 1.6 -d ../bin -cp ;../lib/commons-codec-1.9.jar;../lib/commons-io-2.4.jar;../lib/gson-2.2.4.jar;../lib/guava-17.0.jar;../lib/authlib-1.5.22.jar;../%MC_VERSION%.jar *.java
|
||||
javac -source 1.6 -target 1.6 -d ../bin -cp ;../lib/launchwrapper-1.7.jar customskinloader/tweaker/*.java
|
||||
javac -source 1.6 -target 1.6 -d ../bin -cp ;../lib/commons-io-2.4.jar;../lib/launchwrapper-1.7.jar customskinloader/tweaker/*.java
|
||||
cd ../bin
|
||||
del ../out/CustomSkinLoader_%MC_VERSION%-%CSL_VERSION%.jar
|
||||
jar cfm ../out/CustomSkinLoader_%MC_VERSION%-%CSL_VERSION%.jar META-INF/MANIFEST.MF .
|
||||
|
||||
@@ -22,6 +22,9 @@ public class MinecraftUtil {
|
||||
public static File minecraftDataFolder=null;
|
||||
private static final String MINECRAFT_DATA_FOLDER=".minecraft";
|
||||
public static File getMinecraftDataDir(){
|
||||
if(minecraftDataFolder!=null)
|
||||
return minecraftDataFolder;
|
||||
testProbe();
|
||||
if(minecraftDataFolder!=null)
|
||||
return minecraftDataFolder;
|
||||
File temp=new File("");
|
||||
@@ -33,18 +36,33 @@ public class MinecraftUtil {
|
||||
return temp;
|
||||
}
|
||||
|
||||
private final static Pattern MINECRAFT_CORE_FILE_PATTERN = Pattern.compile("^(.*?)/versions/(.*?)/(.*?).jar$");
|
||||
private static String minecraftVersion=null;
|
||||
public static String getMinecraftVersion(){
|
||||
if(minecraftVersion!=null)
|
||||
return minecraftVersion;
|
||||
testProbe();
|
||||
return minecraftVersion;
|
||||
}
|
||||
|
||||
private final static Pattern MINECRAFT_CORE_FILE_PATTERN = Pattern.compile("^(.*?)/versions/(.*?)/(.*?).jar$");
|
||||
public static void testProbe(){
|
||||
URLClassLoader ucl = (URLClassLoader)new MinecraftUtil().getClass().getClassLoader();
|
||||
URL urls[] = ucl.getURLs();
|
||||
for(URL url:urls){
|
||||
Matcher m = MINECRAFT_CORE_FILE_PATTERN.matcher(url.getPath());
|
||||
//System.out.println(m.matches()+" "+url.getPath());
|
||||
if(!m.matches())
|
||||
continue;
|
||||
return m.group(2);
|
||||
if(minecraftDataFolder==null){
|
||||
try{
|
||||
minecraftDataFolder=new File(url.getPath()).getParentFile().getParentFile().getParentFile();
|
||||
}catch(Exception e){
|
||||
minecraftDataFolder=null;
|
||||
}
|
||||
}
|
||||
System.out.println(url.getPath()+" "+minecraftDataFolder.getAbsolutePath());
|
||||
if(minecraftVersion==null)
|
||||
minecraftVersion=m.group(2);
|
||||
break;
|
||||
}
|
||||
return "Unknown Version";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,10 +28,10 @@ import customskinloader.utils.MinecraftUtil;
|
||||
/**
|
||||
* Custom skin loader mod for Minecraft.
|
||||
* @author (C) Jeremy Lam [JLChnToZ] 2013 & Alexander Xia [xfl03] 2014-2016
|
||||
* @version 13.6 (2016.4.30)
|
||||
* @version 13.7 (2016.5.7)
|
||||
*/
|
||||
public class CustomSkinLoader {
|
||||
public static final String CustomSkinLoader_VERSION="13.6";
|
||||
public static final String CustomSkinLoader_VERSION="13.7";
|
||||
public static final File DATA_DIR=new File(MinecraftUtil.getMinecraftDataDir0(),"CustomSkinLoader"),
|
||||
LOG_FILE=new File(DATA_DIR,"CustomSkinLoader.log"),
|
||||
CONFIG_FILE=new File(DATA_DIR,"CustomSkinLoader.json");
|
||||
|
||||
@@ -22,6 +22,9 @@ public class MinecraftUtil {
|
||||
public static File minecraftDataFolder=null;
|
||||
private static final String MINECRAFT_DATA_FOLDER=".minecraft";
|
||||
public static File getMinecraftDataDir(){
|
||||
if(minecraftDataFolder!=null)
|
||||
return minecraftDataFolder;
|
||||
testProbe();
|
||||
if(minecraftDataFolder!=null)
|
||||
return minecraftDataFolder;
|
||||
File temp=new File("");
|
||||
@@ -33,8 +36,34 @@ public class MinecraftUtil {
|
||||
return temp;
|
||||
}
|
||||
|
||||
private static String minecraftVersion=null;
|
||||
public static String getMinecraftVersion(){
|
||||
return net.minecraft.client.Minecraft.getMinecraft().getVersion();
|
||||
if(minecraftVersion!=null)
|
||||
return minecraftVersion;
|
||||
testProbe();
|
||||
return minecraftVersion;
|
||||
}
|
||||
|
||||
private final static Pattern MINECRAFT_CORE_FILE_PATTERN = Pattern.compile("^(.*?)/versions/(.*?)/(.*?).jar$");
|
||||
public static void testProbe(){
|
||||
URLClassLoader ucl = (URLClassLoader)new MinecraftUtil().getClass().getClassLoader();
|
||||
URL urls[] = ucl.getURLs();
|
||||
for(URL url:urls){
|
||||
Matcher m = MINECRAFT_CORE_FILE_PATTERN.matcher(url.getPath());
|
||||
if(!m.matches())
|
||||
continue;
|
||||
if(minecraftDataFolder==null){
|
||||
try{
|
||||
minecraftDataFolder=new File(url.getPath()).getParentFile().getParentFile().getParentFile();
|
||||
}catch(Exception e){
|
||||
minecraftDataFolder=null;
|
||||
}
|
||||
}
|
||||
System.out.println(url.getPath()+" "+minecraftDataFolder.getAbsolutePath());
|
||||
if(minecraftVersion==null)
|
||||
minecraftVersion=m.group(2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user