Custom ClassLoader (attempt fix Forge and Fabric)
This commit is contained in:
1 parent
a4a5abba09
commit
7a62c8e1af
3 files changed
+33
-1
No files matched your search
@@ -102,17 +102,28 @@ public final class Tools
|
||||
bw.close();
|
||||
*/
|
||||
|
||||
/*
|
||||
final List<URL> urlList = new ArrayList<>();
|
||||
for (String s : launchClassPath.split(":")) {
|
||||
if (!s.isEmpty()) {
|
||||
urlList.add(new File(s).toURI().toURL());
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
new Thread(() -> { try {
|
||||
System.out.println("Args init finished. Now starting game");
|
||||
|
||||
URLClassLoader loader = new URLClassLoader(urlList.toArray(new URL[0]), ClassLoader.getSystemClassLoader());
|
||||
// URLClassLoader loader = new URLClassLoader(urlList.toArray(new URL[0]), ClassLoader.getSystemClassLoader());
|
||||
|
||||
PojavClassLoader loader = (PojavClassLoader) ClassLoader.getSystemClassLoader();
|
||||
|
||||
for (String s : launchClassPath.split(":")) {
|
||||
if (!s.isEmpty()) {
|
||||
loader.addURL(new File(s).toURI().toURL());
|
||||
}
|
||||
}
|
||||
|
||||
Class<?> clazz = loader.loadClass(versionInfo.mainClass);
|
||||
Method method = clazz.getMethod("main", String[].class);
|
||||
method.invoke(null, new Object[]{launchArgs});
|
||||
|
||||
Reference in new issue
Block a user