fix: legacy Forge not launching
This commit is contained in:
parent
dd9eadd0e7
commit
b4ef3875af
9 changed files with 43 additions and 20 deletions
|
@ -10,5 +10,6 @@ This changelog only contains the changes that are unreleased. For changes for in
|
|||
- Do launch checking on old Forge FML libraries and cache downloads
|
||||
|
||||
### Fixes
|
||||
- Legacy Forge not launching
|
||||
|
||||
### Misc
|
||||
|
|
14
legacy-launch/build.gradle
Normal file
14
legacy-launch/build.gradle
Normal file
|
@ -0,0 +1,14 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
id 'application'
|
||||
}
|
||||
|
||||
sourceCompatibility = '1.8'
|
||||
targetCompatibility = '1.8'
|
||||
|
||||
group = 'com.atlauncher'
|
||||
version = rootProject.file('src/main/resources/version').text.trim().replace('.Beta', '')
|
||||
|
||||
application {
|
||||
mainClass = 'com.atlauncher.mclauncher.legacy.LegacyMCLauncher'
|
||||
}
|
|
@ -24,14 +24,12 @@ import java.lang.reflect.Field;
|
|||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
import com.atlauncher.constants.Constants;
|
||||
|
||||
public class LegacyMCLauncher {
|
||||
public static void main(String[] args) {
|
||||
String workingDirectory = args[0];
|
||||
String username = args[1];
|
||||
String session = args[2];
|
||||
String instanceName = args[3];
|
||||
String frameTitle = args[3];
|
||||
int screenWidth = Integer.parseInt(args[4]);
|
||||
int screenHeight = Integer.parseInt(args[5]);
|
||||
boolean maximize = Boolean.parseBoolean(args[6]);
|
||||
|
@ -74,7 +72,7 @@ public class LegacyMCLauncher {
|
|||
try {
|
||||
Class<?> MCAppletClass = cl.loadClass("net.minecraft.client.MinecraftApplet");
|
||||
Applet mcappl = (Applet) MCAppletClass.newInstance();
|
||||
MCFrame mcWindow = new MCFrame(Constants.LAUNCHER_NAME + " - " + instanceName);
|
||||
MCFrame mcWindow = new MCFrame(frameTitle);
|
||||
mcWindow.start(mcappl, username, session, winSize, maximize);
|
||||
} catch (InstantiationException e) {
|
||||
System.out.println("Applet wrapper failed! Falling back " + "to compatibility mode.");
|
|
@ -6,3 +6,4 @@
|
|||
*/
|
||||
rootProject.name = name
|
||||
include('app')
|
||||
include('legacy-launch')
|
||||
|
|
|
@ -84,6 +84,21 @@ public final class FileSystem {
|
|||
renameDirectories();
|
||||
|
||||
createDirectories();
|
||||
|
||||
copyResourcesOutJar();
|
||||
}
|
||||
|
||||
public static void copyResourcesOutJar() throws IOException {
|
||||
Path legacyLaunchLibrariesJar = FileSystem.LIBRARIES.resolve("launcher/legacy-launch.jar");
|
||||
|
||||
if (!Files.exists(legacyLaunchLibrariesJar) || Files.size(legacyLaunchLibrariesJar) != 8368l) {
|
||||
if (!Files.isDirectory(FileSystem.LIBRARIES.resolve("launcher"))) {
|
||||
Files.createDirectory(FileSystem.LIBRARIES.resolve("launcher"));
|
||||
}
|
||||
|
||||
Files.copy(FileSystem.class.getResourceAsStream("/legacy-launch-jar"),
|
||||
legacyLaunchLibrariesJar, StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
}
|
||||
|
||||
private static void deleteOldThings() throws IOException {
|
||||
|
|
|
@ -19,8 +19,6 @@ package com.atlauncher.mclauncher;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
@ -44,7 +42,6 @@ import com.atlauncher.data.minecraft.LoggingClient;
|
|||
import com.atlauncher.data.minecraft.PropertyMapSerializer;
|
||||
import com.atlauncher.managers.LWJGLManager;
|
||||
import com.atlauncher.managers.LogManager;
|
||||
import com.atlauncher.mclauncher.legacy.LegacyMCLauncher;
|
||||
import com.atlauncher.network.ErrorReporting;
|
||||
import com.atlauncher.utils.Java;
|
||||
import com.atlauncher.utils.OS;
|
||||
|
@ -249,21 +246,18 @@ public class MCLauncher {
|
|||
}
|
||||
|
||||
if (instance.usesLegacyLaunch()) {
|
||||
cpb.append(File.pathSeparator);
|
||||
Path legacyLaunchJarPath = FileSystem.LIBRARIES.resolve("launcher/legacy-launch.jar");
|
||||
|
||||
File thisFile = new File(MCLauncher.class.getProtectionDomain().getCodeSource().getLocation().getPath());
|
||||
String pathh = null;
|
||||
try {
|
||||
pathh = thisFile.getCanonicalPath();
|
||||
pathh = URLDecoder.decode(pathh, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
pathh = System.getProperty("java.class.path");
|
||||
LogManager.logStackTrace(e);
|
||||
if (!Files.exists(legacyLaunchJarPath) || Files.size(legacyLaunchJarPath) != 8368l) {
|
||||
FileSystem.copyResourcesOutJar();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
pathh = System.getProperty("java.class.path");
|
||||
LogManager.logStackTrace(e);
|
||||
LogManager.logStackTrace("Failed to copy legacy-launch.jar to libraries folder", e);
|
||||
}
|
||||
cpb.append(pathh);
|
||||
|
||||
cpb.append(File.pathSeparator);
|
||||
cpb.append(legacyLaunchJarPath.toAbsolutePath().toString());
|
||||
}
|
||||
|
||||
List<String> arguments = new ArrayList<>();
|
||||
|
@ -384,12 +378,12 @@ public class MCLauncher {
|
|||
}
|
||||
|
||||
if (instance.usesLegacyLaunch()) {
|
||||
arguments.add(LegacyMCLauncher.class.getCanonicalName());
|
||||
arguments.add("com.atlauncher.mclauncher.legacy.LegacyMCLauncher");
|
||||
// Start or passed in arguments
|
||||
arguments.add(instance.getRootDirectory().getAbsolutePath()); // Path
|
||||
arguments.add(username); // Username
|
||||
arguments.add(account.getSessionToken()); // Session
|
||||
arguments.add(instance.getName()); // Instance Name
|
||||
arguments.add(Constants.LAUNCHER_NAME + " - " + instance.getName()); // Frame title
|
||||
arguments.add(App.settings.windowWidth + ""); // Window Width
|
||||
arguments.add(App.settings.windowHeight + ""); // Window Height
|
||||
if (App.settings.maximiseMinecraft) {
|
||||
|
|
BIN
src/main/resources/legacy-launch-jar
Normal file
BIN
src/main/resources/legacy-launch-jar
Normal file
Binary file not shown.
Loading…
Reference in a new issue