mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-10 12:26:16 -04:00
fix installing liteloader without tweakclass
This commit is contained in:
parent
369fe5e164
commit
482c8e50bb
@ -42,7 +42,6 @@ import org.jackhuang.hellominecraft.utils.system.MessageBox;
|
|||||||
*/
|
*/
|
||||||
public class ForgeInstaller extends Task {
|
public class ForgeInstaller extends Task {
|
||||||
|
|
||||||
private final Gson gson = new Gson();
|
|
||||||
public File gameDir;
|
public File gameDir;
|
||||||
public File forgeInstaller;
|
public File forgeInstaller;
|
||||||
public IMinecraftProvider mp;
|
public IMinecraftProvider mp;
|
||||||
@ -61,7 +60,7 @@ public class ForgeInstaller extends Task {
|
|||||||
ZipFile zipFile = new ZipFile(forgeInstaller);
|
ZipFile zipFile = new ZipFile(forgeInstaller);
|
||||||
ZipEntry entry = zipFile.getEntry("install_profile.json");
|
ZipEntry entry = zipFile.getEntry("install_profile.json");
|
||||||
String content = NetUtils.getStreamContent(zipFile.getInputStream(entry));
|
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);
|
File from = new File(gameDir, "versions" + File.separator + profile.install.minecraft);
|
||||||
if (!from.exists()) {
|
if (!from.exists()) {
|
||||||
@ -80,7 +79,7 @@ public class ForgeInstaller extends Task {
|
|||||||
FileUtils.copyFile(new File(from, profile.install.minecraft + ".jar"),
|
FileUtils.copyFile(new File(from, profile.install.minecraft + ".jar"),
|
||||||
new File(to, profile.install.target + ".jar"));
|
new File(to, profile.install.target + ".jar"));
|
||||||
HMCLog.log("Creating new version profile..." + profile.install.target + ".json");
|
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);
|
HMCLog.log("Extracting universal forge pack..." + profile.install.filePath);
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public class MinecraftForgeVersionList extends InstallerVersionList {
|
|||||||
if (!StrUtils.isBlank(v.branch))
|
if (!StrUtils.isBlank(v.branch))
|
||||||
ver = ver + "-" + v.branch;
|
ver = ver + "-" + v.branch;
|
||||||
String filename = root.artifact + "-" + ver + "-" + f[1] + "." + f[0];
|
String filename = root.artifact + "-" + ver + "-" + f[1] + "." + f[0];
|
||||||
String url = root.webpath + "/" + ver + "/" + filename;
|
String url = root.webpath + ver + "/" + filename;
|
||||||
switch (f[1]) {
|
switch (f[1]) {
|
||||||
case "installer":
|
case "installer":
|
||||||
iv.installer = url;
|
iv.installer = url;
|
||||||
|
@ -69,10 +69,8 @@ public class LiteLoaderInstaller extends Task implements PreviousResultRegistrat
|
|||||||
|
|
||||||
mv.id += "-LiteLoader" + version.selfVersion;
|
mv.id += "-LiteLoader" + version.selfVersion;
|
||||||
|
|
||||||
if (!mv.mainClass.startsWith("net.minecraft.launchwrapper.")) {
|
mv.mainClass = "net.minecraft.launchwrapper.Launch";
|
||||||
mv.mainClass = "net.minecraft.launchwrapper.Launch";
|
mv.minecraftArguments += " --tweakClass " + version.tweakClass;
|
||||||
mv.minecraftArguments += " --tweakClass " + version.tweakClass;
|
|
||||||
}
|
|
||||||
File folder = new File(profile.getCanonicalGameDir(), "versions/" + mv.id);
|
File folder = new File(profile.getCanonicalGameDir(), "versions/" + mv.id);
|
||||||
folder.mkdirs();
|
folder.mkdirs();
|
||||||
File json = new File(folder, mv.id + ".json");
|
File json = new File(folder, mv.id + ".json");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user