Add in "FMLCorePluginContainsMod" in the manifest. If this value is

present, FML will attempt to parse your mod jar file as a normal mod
file as well, instantiating mod containers there.
This commit is contained in:
Christian 2013-08-17 12:44:59 -04:00
parent 8f9b54a97a
commit 643e3d441a
2 changed files with 19 additions and 1 deletions

View file

@ -42,8 +42,12 @@ public class ModDiscoverer
public void findClasspathMods(ModClassLoader modClassLoader)
{
List<String> knownLibraries = ImmutableList.<String>builder()
// skip default libs
.addAll(modClassLoader.getDefaultLibraries())
// skip loaded coremods
.addAll(CoreModManager.getLoadedCoremods())
// skip reparse coremods here
.addAll(CoreModManager.getReparseableCoremods())
.build();
File[] minecraftSources = modClassLoader.getParentSources();
if (minecraftSources.length == 1 && minecraftSources[0].isFile())
@ -85,6 +89,7 @@ public class ModDiscoverer
for (File modFile : modList)
{
// skip loaded coremods
if (CoreModManager.getLoadedCoremods().contains(modFile.getName()))
{
FMLLog.finer("Skipping already parsed coremod or tweaker %s", modFile.getName());

View file

@ -51,6 +51,7 @@ public class CoreModManager
private static boolean deobfuscatedEnvironment;
private static FMLTweaker tweaker;
private static File mcDir;
private static List<String> reparsedCoremods;
private static class FMLPluginWrapper
{
@ -210,7 +211,14 @@ public class CoreModManager
try
{
classLoader.addURL(coreMod.toURI().toURL());
loadedCoremods.add(coreMod.getName());
if (!mfAttributes.containsValue("FMLCorePluginContainsFMLMod"))
{
loadedCoremods.add(coreMod.getName());
}
else
{
reparsedCoremods.add(coreMod.getName());
}
}
catch (MalformedURLException e)
{
@ -267,6 +275,11 @@ public class CoreModManager
return loadedCoremods;
}
public static List<String> getReparseableCoremods()
{
return reparsedCoremods;
}
private static FMLPluginWrapper loadCoreMod(LaunchClassLoader classLoader, String coreModClass, File location)
{
String coreModName = coreModClass.substring(coreModClass.lastIndexOf('.')+1);