Fix coremod injection into main system. Should stop double-dipping coremods.

This commit is contained in:
Christian committed 2013-07-06 20:51:00 -04:00
1 parent 54e06e841d
commit 3a200e901e
2 files changed
+9 -22

No files matched your search

@@ -5,7 +5,7 @@
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
*
* Contributors:
* cpw - implementation
*/
@@ -41,7 +41,10 @@ public class ModDiscoverer
public void findClasspathMods(ModClassLoader modClassLoader)
{
List<String> knownLibraries = ImmutableList.<String>builder().addAll(modClassLoader.getDefaultLibraries()).addAll(CoreModManager.getLibraries()).build();
List<String> knownLibraries = ImmutableList.<String>builder()
.addAll(modClassLoader.getDefaultLibraries())
.addAll(CoreModManager.getLoadedCoremods())
.build();
File[] minecraftSources = modClassLoader.getParentSources();
if (minecraftSources.length == 1 && minecraftSources[0].isFile())
{
@@ -48,7 +48,7 @@ import cpw.mods.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions;
public class CoreModManager
{
private static String[] rootPlugins = { "cpw.mods.fml.relauncher.FMLCorePlugin" , "net.minecraftforge.classloading.FMLForgePlugin" };
private static List<String> loadedLibraries = new ArrayList<String>();
private static List<String> loadedCoremods = new ArrayList<String>();
private static Map<IFMLLoadingPlugin, File> pluginLocations;
private static List<IFMLLoadingPlugin> loadPlugins;
private static boolean deobfuscatedEnvironment;
@@ -248,26 +248,10 @@ public class CoreModManager
continue;
}
// String className = fmlCorePlugin.replace('.', '/').concat(".class");
// JarEntry ent = jar.getJarEntry(className);
// if (ent ==null)
// {
// FMLLog.severe("The coremod %s specified %s as it's loading class but it does not include it - it will be ignored", coreMod.getName(), fmlCorePlugin);
// continue;
// }
// try
// {
// Class<?> coreModClass = Class.forName(fmlCorePlugin, false, classLoader);
// FMLLog.severe("The coremods %s specified a class %s that is already present in the classpath - it will be ignored", coreMod.getName(), fmlCorePlugin);
// continue;
// }
// catch (ClassNotFoundException cnfe)
// {
// // didn't find it, good
// }
try
{
classLoader.addURL(coreMod.toURI().toURL());
loadedCoremods.add(coreMod.getName());
}
catch (MalformedURLException e)
{
@@ -356,8 +340,8 @@ public class CoreModManager
return coreModDir;
}
public static List<String> getLibraries()
public static List<String> getLoadedCoremods()
{
return loadedLibraries;
return loadedCoremods;
}
}