fix installing liteloader without tweakclass

This commit is contained in:
huanghongxun 2015-07-28 14:08:08 +08:00
parent 369fe5e164
commit 482c8e50bb
3 changed files with 5 additions and 8 deletions

View File

@ -42,7 +42,6 @@ import org.jackhuang.hellominecraft.utils.system.MessageBox;
*/
public class ForgeInstaller extends Task {
private final Gson gson = new Gson();
public File gameDir;
public File forgeInstaller;
public IMinecraftProvider mp;
@ -61,7 +60,7 @@ public class ForgeInstaller extends Task {
ZipFile zipFile = new ZipFile(forgeInstaller);
ZipEntry entry = zipFile.getEntry("install_profile.json");
String content = NetUtils.getStreamContent(zipFile.getInputStream(entry));
InstallProfile profile = gson.fromJson(content, InstallProfile.class);
InstallProfile profile = C.gsonPrettyPrinting.fromJson(content, InstallProfile.class);
File from = new File(gameDir, "versions" + File.separator + profile.install.minecraft);
if (!from.exists()) {
@ -80,7 +79,7 @@ public class ForgeInstaller extends Task {
FileUtils.copyFile(new File(from, profile.install.minecraft + ".jar"),
new File(to, profile.install.target + ".jar"));
HMCLog.log("Creating new version profile..." + profile.install.target + ".json");
FileUtils.write(new File(to, profile.install.target + ".json"), gson.toJson(profile.versionInfo));
FileUtils.write(new File(to, profile.install.target + ".json"), C.gsonPrettyPrinting.toJson(profile.versionInfo));
HMCLog.log("Extracting universal forge pack..." + profile.install.filePath);

View File

@ -67,7 +67,7 @@ public class MinecraftForgeVersionList extends InstallerVersionList {
if (!StrUtils.isBlank(v.branch))
ver = ver + "-" + v.branch;
String filename = root.artifact + "-" + ver + "-" + f[1] + "." + f[0];
String url = root.webpath + "/" + ver + "/" + filename;
String url = root.webpath + ver + "/" + filename;
switch (f[1]) {
case "installer":
iv.installer = url;

View File

@ -69,10 +69,8 @@ public class LiteLoaderInstaller extends Task implements PreviousResultRegistrat
mv.id += "-LiteLoader" + version.selfVersion;
if (!mv.mainClass.startsWith("net.minecraft.launchwrapper.")) {
mv.mainClass = "net.minecraft.launchwrapper.Launch";
mv.minecraftArguments += " --tweakClass " + version.tweakClass;
}
mv.mainClass = "net.minecraft.launchwrapper.Launch";
mv.minecraftArguments += " --tweakClass " + version.tweakClass;
File folder = new File(profile.getCanonicalGameDir(), "versions/" + mv.id);
folder.mkdirs();
File json = new File(folder, mv.id + ".json");