[FIX] MirrorHelper

This commit is contained in:
Gravita 2023-11-04 21:50:11 +07:00
parent ff3d500cc0
commit 9df116f951
2 changed files with 5 additions and 7 deletions

View file

@ -26,7 +26,8 @@
archiveClassifier.set('clean') archiveClassifier.set('clean')
manifest.attributes("Main-Class": mainClassName, manifest.attributes("Main-Class": mainClassName,
"Premain-Class": mainAgentName, "Premain-Class": mainAgentName,
"Multi-Release": "true") "Multi-Release": "true",
"Automatic-Module-Name": "GravitLauncher")
} }
tasks.register('sourcesJar', Jar) { tasks.register('sourcesJar', Jar) {

View file

@ -39,7 +39,7 @@ public ClassLoaderControl init(List<Path> files, String nativePath, LaunchOption
} catch (MalformedURLException ex) { } catch (MalformedURLException ex) {
throw new RuntimeException(ex); throw new RuntimeException(ex);
} }
}).toArray(URL[]::new), BasicLaunch.class.getClassLoader()); }).toArray(URL[]::new), ClassLoader.getPlatformClassLoader());
moduleClassLoader.nativePath = nativePath; moduleClassLoader.nativePath = nativePath;
{ {
if(options.enableHacks) { if(options.enableHacks) {
@ -163,14 +163,11 @@ private class ModuleClassLoader extends URLClassLoader {
private String nativePath; private String nativePath;
private final List<String> packages = new ArrayList<>(); private final List<String> packages = new ArrayList<>();
public ModuleClassLoader(URL[] urls) { public ModuleClassLoader(URL[] urls, ClassLoader parent) {
super(urls); super("LAUNCHER", urls, parent);
packages.add("pro.gravit.launcher."); packages.add("pro.gravit.launcher.");
packages.add("pro.gravit.utils."); packages.add("pro.gravit.utils.");
} }
public ModuleClassLoader(URL[] urls, ClassLoader parent) {
super(urls, parent);
}
@Override @Override
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {