Fixed ClassCastException when loading ModLoader mods
This commit is contained in:
parent
7e87a2e18f
commit
b2ef2bed36
1 changed files with 15 additions and 2 deletions
|
@ -81,8 +81,21 @@ public class ModClassLoader extends URLClassLoader
|
||||||
|
|
||||||
public Class<? extends BaseModProxy> loadBaseModClass(String modClazzName) throws Exception
|
public Class<? extends BaseModProxy> loadBaseModClass(String modClazzName) throws Exception
|
||||||
{
|
{
|
||||||
AccessTransformer transformer = (AccessTransformer)mainClassLoader.getTransformers().get(0);
|
AccessTransformer accessTransformer = null;
|
||||||
transformer.ensurePublicAccessFor(modClazzName);
|
for (IClassTransformer transformer : mainClassLoader.getTransformers())
|
||||||
|
{
|
||||||
|
if (transformer instanceof AccessTransformer)
|
||||||
|
{
|
||||||
|
accessTransformer = (AccessTransformer) transformer;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (accessTransformer == null)
|
||||||
|
{
|
||||||
|
FMLLog.log(Level.SEVERE, "No access transformer found");
|
||||||
|
throw new LoaderException();
|
||||||
|
}
|
||||||
|
accessTransformer.ensurePublicAccessFor(modClazzName);
|
||||||
return (Class<? extends BaseModProxy>) Class.forName(modClazzName, true, this);
|
return (Class<? extends BaseModProxy>) Class.forName(modClazzName, true, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue