Skip to content

Commit

Permalink
Fix dependency class loading on newer Minecraft versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Almighty-Satan committed Sep 6, 2024
1 parent dd29d92 commit 98ca785
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ public HackClassLoader() {
super(new URL[0]);
}

@Override
public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
try {
return super.loadClass(name, resolve);
} catch (ClassNotFoundException e) {
return HackClassLoader.class.getClassLoader().loadClass(name);
}
}

public Class<?> superLoadClass(String name, boolean resolve) throws ClassNotFoundException {
return super.loadClass(name, resolve);
}

@Override
protected void addURL(URL url) {
super.addURL(url);
Expand Down Expand Up @@ -110,7 +123,7 @@ public V get(Object key) {
if (parentObject != null)
return parentObject;
try {
return (V) this.classLoader.loadClass((String) key);
return (V) this.classLoader.superLoadClass((String) key, false);
} catch (ClassNotFoundException e) {
return null;
}
Expand Down

0 comments on commit 98ca785

Please sign in to comment.