Skip to content

Commit a4c093b

Browse files
committed
[FIX] Forge 1.18+ without patches bug fixes
1 parent d1f91d7 commit a4c093b

4 files changed

Lines changed: 8 additions & 11 deletions

File tree

components/launcher-api/src/main/java/pro/gravit/launcher/base/profiles/ClientProfile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ public enum ClassLoaderConfig {
423423
}
424424

425425
public enum CompatibilityFlags {
426-
LEGACY_NATIVES_DIR, CLASS_CONTROL_API, ENABLE_HACKS, WAYLAND_USE_CUSTOM_GLFW, DONT_ADD_YOURSELF_TO_CLASSPATH_PROPERTY
426+
LEGACY_NATIVES_DIR, CLASS_CONTROL_API, ENABLE_HACKS, WAYLAND_USE_CUSTOM_GLFW, HIDE_SYSTEM_ARGS_CLASSPATH
427427
}
428428

429429
public static class Version implements Comparable<Version> {

components/launcher-client/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,7 @@ private static void realMain(String[] args) throws Throwable {
190190
ClientService.baseURLs = classLoaderControl.getURLs();
191191
} else if (classLoaderConfig == ClientProfile.ClassLoaderConfig.SYSTEM_ARGS) {
192192
launch = new BasicLaunch();
193-
if(profile.hasFlag(ClientProfile.CompatibilityFlags.DONT_ADD_YOURSELF_TO_CLASSPATH_PROPERTY)) {
194-
List<String> split = new ArrayList<>(List.of(System.getProperty("java.class.path").split(File.pathSeparator)));
195-
String pathToLauncher = IOHelper.getCodeSource(ClientLauncherEntryPoint.class).toAbsolutePath().toString();
196-
split.removeIf(e -> e.equals(pathToLauncher));
197-
System.setProperty("java.class.path", String.join(File.pathSeparator, split));
198-
}
193+
System.setProperty("java.class.path", classpath.stream().map(Path::toString).collect(Collectors.joining(File.pathSeparator)));
199194
classLoaderControl = launch.init(classpath, params.nativesDir, options);
200195
ClientService.baseURLs = classpathURLs.toArray(new URL[0]);
201196
} else {

components/launcher-runtime/src/main/java/pro/gravit/launcher/runtime/client/ClientLauncherProcess.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,11 @@ public void start(boolean pipeOutput) throws IOException, InterruptedException {
186186
}
187187
}
188188
}
189-
systemClassPath.addAll(ClientLauncherEntryPoint.resolveClassPath(ignorePath, workDir, params.actions, params.profile)
190-
.map(Path::toString)
191-
.toList());
189+
if(!params.profile.hasFlag(ClientProfile.CompatibilityFlags.HIDE_SYSTEM_ARGS_CLASSPATH)) {
190+
systemClassPath.addAll(ClientLauncherEntryPoint.resolveClassPath(ignorePath, workDir, params.actions, params.profile)
191+
.map(Path::toString)
192+
.toList());
193+
}
192194
}
193195
if (Launcher.getConfig().environment != LauncherConfig.LauncherEnvironment.PROD) {
194196
processArgs.add(JVMHelper.jvmProperty(LogHelper.DEV_PROPERTY, String.valueOf(LogHelper.isDevEnabled())));

0 commit comments

Comments
 (0)