Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features

This commit is contained in:
Anuken
2021-06-12 16:08:17 -04:00
2 changed files with 7 additions and 4 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ public interface Platform{
loadedClass = findClass(name); loadedClass = findClass(name);
}catch(ClassNotFoundException e){ }catch(ClassNotFoundException e){
//use parent if not found //use parent if not found
loadedClass = super.loadClass(name, resolve); return parent.loadClass(name);
} }
} }
+5 -2
View File
@@ -26,16 +26,19 @@ public class ModClassLoader extends ClassLoader{
ClassNotFoundException last = null; ClassNotFoundException last = null;
int size = children.size; int size = children.size;
inChild.set(true);
//if it doesn't exist in the main class loader, try all the children //if it doesn't exist in the main class loader, try all the children
for(int i = 0; i < size; i++){ for(int i = 0; i < size; i++){
try{ try{
try{
inChild.set(true);
return children.get(i).loadClass(name); return children.get(i).loadClass(name);
}finally{
inChild.set(false);
}
}catch(ClassNotFoundException e){ }catch(ClassNotFoundException e){
last = e; last = e;
} }
} }
inChild.set(false);
throw (last == null ? new ClassNotFoundException(name) : last); throw (last == null ? new ClassNotFoundException(name) : last);
} }