From dc27fc04aa3d1b5dbb6e8eb9c35bcbd223923076 Mon Sep 17 00:00:00 2001 From: Gravita Date: Thu, 7 Apr 2022 22:09:20 +0700 Subject: [PATCH] [FIX] Forge 1.17+ exit crash --- .../client/ClientLauncherEntryPoint.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java index 44d2c495..af76d9f9 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java @@ -349,19 +349,19 @@ private static void launch(ClientProfile profile, ClientLauncherProcess.ClientPa } FMLPatcher.apply(); LauncherEngine.modulesManager.invokeEvent(new ClientProcessPreInvokeMainClassEvent(params, profile, args)); - { - List compatClasses = profile.getCompatClasses(); - for (String e : compatClasses) { - Class clazz = classLoader.loadClass(e); - MethodHandle runMethod = MethodHandles.publicLookup().findStatic(clazz, "run", MethodType.methodType(void.class)); - runMethod.invoke(); - } - } - MethodHandle mainMethod = MethodHandles.lookup().findStatic(mainClass, "main", MethodType.methodType(void.class, String[].class)).asFixedArity(); - Launcher.LAUNCHED.set(true); - JVMHelper.fullGC(); // Invoke main method try { + { + List compatClasses = profile.getCompatClasses(); + for (String e : compatClasses) { + Class clazz = classLoader.loadClass(e); + MethodHandle runMethod = MethodHandles.publicLookup().findStatic(clazz, "run", MethodType.methodType(void.class)); + runMethod.invoke(); + } + } + MethodHandle mainMethod = MethodHandles.lookup().findStatic(mainClass, "main", MethodType.methodType(void.class, String[].class)).asFixedArity(); + Launcher.LAUNCHED.set(true); + JVMHelper.fullGC(); mainMethod.invokeWithArguments((Object) args.toArray(new String[0])); LogHelper.debug("Main exit successful"); } catch (Throwable e) {