From 3a200e901e34ade679e4485307f57bee725bbe94 Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 6 Jul 2013 20:51:00 -0400 Subject: [PATCH] Fix coremod injection into main system. Should stop double-dipping coremods. --- .../fml/common/discovery/ModDiscoverer.java | 7 ++++-- .../mods/fml/relauncher/CoreModManager.java | 24 ++++--------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/common/cpw/mods/fml/common/discovery/ModDiscoverer.java b/common/cpw/mods/fml/common/discovery/ModDiscoverer.java index 1e4ab0ca3e..610bb3629f 100644 --- a/common/cpw/mods/fml/common/discovery/ModDiscoverer.java +++ b/common/cpw/mods/fml/common/discovery/ModDiscoverer.java @@ -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 knownLibraries = ImmutableList.builder().addAll(modClassLoader.getDefaultLibraries()).addAll(CoreModManager.getLibraries()).build(); + List knownLibraries = ImmutableList.builder() + .addAll(modClassLoader.getDefaultLibraries()) + .addAll(CoreModManager.getLoadedCoremods()) + .build(); File[] minecraftSources = modClassLoader.getParentSources(); if (minecraftSources.length == 1 && minecraftSources[0].isFile()) { diff --git a/common/cpw/mods/fml/relauncher/CoreModManager.java b/common/cpw/mods/fml/relauncher/CoreModManager.java index a57f9163ce..994063fb41 100644 --- a/common/cpw/mods/fml/relauncher/CoreModManager.java +++ b/common/cpw/mods/fml/relauncher/CoreModManager.java @@ -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 loadedLibraries = new ArrayList(); + private static List loadedCoremods = new ArrayList(); private static Map pluginLocations; private static List 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 getLibraries() + public static List getLoadedCoremods() { - return loadedLibraries; + return loadedCoremods; } }