File tree Expand file tree Collapse file tree 1 file changed +4
-16
lines changed
src/main/java/com/falsepattern/lib/internal/impl/mixin Expand file tree Collapse file tree 1 file changed +4
-16
lines changed Original file line number Diff line number Diff line change 22
22
package com .falsepattern .lib .internal .impl .mixin ;
23
23
24
24
import lombok .val ;
25
- import sun .misc .URLClassPath ;
26
25
27
26
import net .minecraft .launchwrapper .Launch ;
28
27
import net .minecraft .launchwrapper .LaunchClassLoader ;
31
30
import java .io .IOException ;
32
31
33
32
public final class UCPImpl {
34
- private static final URLClassPath ucp ;
35
33
private static final boolean GRIMOIRE ;
36
34
37
35
static {
@@ -49,24 +47,14 @@ public final class UCPImpl {
49
47
}
50
48
}
51
49
GRIMOIRE = grimoire ;
52
- if (!GRIMOIRE ) {
53
- try {
54
- val ucpField = LaunchClassLoader .class .getSuperclass ().getDeclaredField ("ucp" );
55
- ucpField .setAccessible (true );
56
-
57
- ucp = (URLClassPath ) ucpField .get (Launch .classLoader );
58
- } catch (NoSuchFieldException | IllegalAccessException e ) {
59
- throw new RuntimeException (e .getMessage ());
60
- }
61
- } else {
62
- ucp = null ;
63
- System .err .println ("Grimoire detected, disabling jar loading utility" );
64
- }
65
50
}
66
51
67
52
public static void addJar (File pathToJar ) throws Exception {
68
53
if (!GRIMOIRE ) {
69
- ucp .addURL (pathToJar .toURI ().toURL ());
54
+ final LaunchClassLoader loader = Launch .classLoader ;
55
+ loader .addURL (pathToJar .toURI ().toURL ());
56
+ // Act as-if we only added the mod to ucp
57
+ loader .getSources ().remove (loader .getSources ().size () - 1 );
70
58
}
71
59
}
72
60
}
You can’t perform that action at this time.
0 commit comments