mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[FEATURE] Support compat classes in client debug
This commit is contained in:
parent
c1df548258
commit
0f36dfec16
1 changed files with 14 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
|||
import pro.gravit.launcher.Launcher;
|
||||
import pro.gravit.launcher.LauncherEngine;
|
||||
import pro.gravit.launcher.api.AuthService;
|
||||
import pro.gravit.launcher.api.ClientService;
|
||||
import pro.gravit.launcher.events.request.AuthRequestEvent;
|
||||
import pro.gravit.launcher.events.request.ProfilesRequestEvent;
|
||||
import pro.gravit.launcher.gui.RuntimeProvider;
|
||||
|
@ -17,6 +18,9 @@
|
|||
|
||||
import java.io.File;
|
||||
import java.io.Reader;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
|
@ -126,7 +130,16 @@ public void run(String[] args) {
|
|||
} else {
|
||||
options = new LaunchOptions();
|
||||
}
|
||||
launch.init(classpath, nativesDir, options);
|
||||
ClassLoaderControl classLoaderControl = launch.init(classpath, nativesDir, options);
|
||||
ClientService.classLoaderControl = classLoaderControl;
|
||||
if(compatClasses != null) {
|
||||
String[] compatClassesList = compatClasses.split(",");
|
||||
for (String e : compatClassesList) {
|
||||
Class<?> clazz = classLoaderControl.getClass(e);
|
||||
MethodHandle runMethod = MethodHandles.lookup().findStatic(clazz, "run", MethodType.methodType(void.class, ClassLoaderControl.class));
|
||||
runMethod.invoke(classLoaderControl);
|
||||
}
|
||||
}
|
||||
launch.launch(mainClass, mainModule, Arrays.asList(args));
|
||||
} catch (Throwable e) {
|
||||
LogHelper.error(e);
|
||||
|
|
Loading…
Reference in a new issue