register parallel capability at the right time
All checks were successful
/ Build BaseBand Loader (push) Successful in 1m12s
All checks were successful
/ Build BaseBand Loader (push) Successful in 1m12s
This commit is contained in:
parent
1da1c2d96b
commit
e8b9346aec
1 changed files with 10 additions and 4 deletions
|
@ -28,6 +28,16 @@ public class CustomClassLoader extends ClassLoader implements Util {
|
|||
private final DataKeeper<Map<String, byte[]>> binaryKeeper;
|
||||
private final DataKeeper<PermissionManager> mixinPermissionManager;
|
||||
|
||||
static {
|
||||
try {
|
||||
Method m = Arrays.stream(Class.forName("java.lang.ClassLoader").getDeclaredClasses()).filter(x -> x.getSimpleName().equalsIgnoreCase("ParallelLoaders")).findFirst().get().getDeclaredMethod("register", Class.class);
|
||||
m.setAccessible(true);
|
||||
m.invoke(null, CustomClassLoader.class);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("unable to patch ClassLoader", e);
|
||||
}
|
||||
}
|
||||
|
||||
public CustomClassLoader(Map<String, byte[]> data) {
|
||||
AccessKiller.killReflectionFor(CustomClassLoader.class, CustomMixinServer.class);
|
||||
|
||||
|
@ -68,10 +78,6 @@ public class CustomClassLoader extends ClassLoader implements Util {
|
|||
throw new IllegalStateException(MixinService.getService().getClass().toString());
|
||||
}
|
||||
|
||||
Method m = Arrays.stream(Class.forName("java.lang.ClassLoader").getDeclaredClasses()).filter(x -> x.getSimpleName().equalsIgnoreCase("ParallelLoaders")).findFirst().get().getDeclaredMethod("register", Class.class);
|
||||
m.setAccessible(true);
|
||||
m.invoke(null, CustomClassLoader.class);
|
||||
|
||||
Field parent = ClassLoader.class.getDeclaredField("parent");
|
||||
parent.setAccessible(true);
|
||||
parent.set(this, parent.get(Launch.classLoader));
|
||||
|
|
Loading…
Add table
Reference in a new issue