Skip to content

Commit

Permalink
Add to classloader before clearing invalid/negative classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
LunNova committed Feb 8, 2016
1 parent bf7d177 commit 957a30a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/me/nallar/modpatcher/ModPatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,12 @@ private static void addToCurrentClassLoader() {
LaunchClassLoader lcl = (LaunchClassLoader) cl;
final String package_ = "me.nallar.modpatcher";
lcl.addTransformerExclusion(package_);
lcl.addURL(url);

Set<String> invalidClasses = ReflectionHelper.<Set<String>, LaunchClassLoader>getPrivateValue(LaunchClassLoader.class, lcl, "invalidClasses");
Set<String> negativeResources = ReflectionHelper.<Set<String>, LaunchClassLoader>getPrivateValue(LaunchClassLoader.class, lcl, "negativeResourceCache");
invalidClasses.removeIf(it -> it.startsWith(package_));
negativeResources.removeIf(it -> it.startsWith(package_));
lcl.addURL(url);
} else {
Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
method.setAccessible(true);
Expand Down

0 comments on commit 957a30a

Please sign in to comment.