Слияние ui -> main #1

Merged
sasheg merged 145 commits from ui into main 2026-08-20 13:54:02 +00:00
Showing only changes of commit f58db7f941 - Show all commits
@@ -63,12 +63,7 @@ public class LaunchCommandBuilder {
// always use ModLauncher as main class (version.json might have
// BootstrapLauncher which breaks with Java module system)
if ("forge".equals(loaderType) || "neoforge".equals(loaderType)) {
// Build classpath from manifest libraries only.
// The forge client jar (forge-*-client.jar) on the classpath
// contains the patched Minecraft classes and has
// Automatic-Module-Name: minecraft in its MANIFEST.
// We modify the ignoreList below to NOT exclude it,
// so securejarhandler creates the "minecraft" module from it.
// Build classpath from manifest libraries.
String classpath;
if (manifest != null) {
classpath = buildClasspathFromManifest(manifest, false);
@@ -79,6 +74,25 @@ public class LaunchCommandBuilder {
classpath = buildVanillaClasspath();
}
// The forge client jar (forge-*-client.jar) is NOT listed in the
// version JSON's libraries array, so it's NOT on the classpath.
// FML discovers it by scanning the library directory, but
// securejarhandler only processes classpath entries.
// We add it explicitly so securejarhandler creates the "minecraft"
// module from its Automatic-Module-Name: minecraft.
String forgeVersion = instance.getMinecraftVersion() + "-" + instance.getLoaderVersion();
Path forgeClientJar = instance.getPath().resolve("libraries")
.resolve("net/minecraftforge/forge")
.resolve(forgeVersion)
.resolve("forge-" + forgeVersion + "-client.jar");
if (Files.exists(forgeClientJar) && isValidJar(forgeClientJar)) {
String sep = System.getProperty("os.name").toLowerCase().contains("win") ? ";" : ":";
classpath = forgeClientJar.toAbsolutePath().toString() + sep + classpath;
System.out.println(ZAnsi.green(" Added forge client jar: " + forgeClientJar.getFileName()));
} else {
System.out.println(ZAnsi.yellow(" Forge client jar not found at " + forgeClientJar));
}
command.add("-cp");
String cpFile = writeClasspathFile(classpath);
command.add(cpFile);