diff --git a/fml/common/cpw/mods/fml/common/Loader.java b/fml/common/cpw/mods/fml/common/Loader.java index c1acbf3dba..9b5bc35676 100644 --- a/fml/common/cpw/mods/fml/common/Loader.java +++ b/fml/common/cpw/mods/fml/common/Loader.java @@ -344,6 +344,12 @@ public class Loader FMLLog.info("Searching %s for mods", canonicalModsDir.getAbsolutePath()); discoverer.findModDirMods(canonicalModsDir); + File versionSpecificModsDir = new File(canonicalModsDir,mccversion); + if (versionSpecificModsDir.isDirectory()) + { + FMLLog.info("Also searching %s for mods", versionSpecificModsDir); + discoverer.findModDirMods(versionSpecificModsDir); + } mods.addAll(discoverer.identifyMods()); identifyDuplicates(mods); diff --git a/fml/common/cpw/mods/fml/common/discovery/JarDiscoverer.java b/fml/common/cpw/mods/fml/common/discovery/JarDiscoverer.java index efcf2a05f4..136e6ae722 100644 --- a/fml/common/cpw/mods/fml/common/discovery/JarDiscoverer.java +++ b/fml/common/cpw/mods/fml/common/discovery/JarDiscoverer.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 */ @@ -14,10 +14,10 @@ package cpw.mods.fml.common.discovery; import java.util.Collections; import java.util.List; +import java.util.jar.JarFile; import java.util.logging.Level; import java.util.regex.Matcher; import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; import com.google.common.collect.Lists; @@ -35,11 +35,16 @@ public class JarDiscoverer implements ITypeDiscoverer { List foundMods = Lists.newArrayList(); FMLLog.fine("Examining file %s for potential mods", candidate.getModContainer().getName()); - ZipFile jar = null; + JarFile jar = null; try { - jar = new ZipFile(candidate.getModContainer()); + jar = new JarFile(candidate.getModContainer()); + if (jar.getManifest()!=null && jar.getManifest().getMainAttributes().get("FMLCorePlugin") != null) + { + FMLLog.finest("Ignoring coremod %s", candidate.getModContainer()); + return foundMods; + } ZipEntry modInfo = jar.getEntry("mcmod.info"); MetadataCollection mc = null; if (modInfo != null) diff --git a/fml/common/cpw/mods/fml/relauncher/CoreModManager.java b/fml/common/cpw/mods/fml/relauncher/CoreModManager.java index 2e5c7789dc..a57f9163ce 100644 --- a/fml/common/cpw/mods/fml/relauncher/CoreModManager.java +++ b/fml/common/cpw/mods/fml/relauncher/CoreModManager.java @@ -37,6 +37,8 @@ import java.util.jar.Attributes; import java.util.jar.JarFile; import java.util.logging.Level; +import com.google.common.collect.ObjectArrays; + import net.minecraft.launchwrapper.LaunchClassLoader; import cpw.mods.fml.common.CertificateHelper; @@ -209,11 +211,18 @@ public class CoreModManager } }; File[] coreModList = coreMods.listFiles(ff); + File versionedModDir = new File(coreMods,FMLInjectionData.mccversion); + if (versionedModDir.isDirectory()) + { + File[] versionedCoreMods = versionedModDir.listFiles(ff); + coreModList = ObjectArrays.concat(coreModList,versionedCoreMods, File.class); + } + Arrays.sort(coreModList); for (File coreMod : coreModList) { - FMLRelaunchLog.fine("Found a candidate coremod %s", coreMod.getName()); + FMLRelaunchLog.fine("Examining for coremod candidacy %s", coreMod.getName()); JarFile jar; Attributes mfAttributes; try @@ -221,21 +230,21 @@ public class CoreModManager jar = new JarFile(coreMod); if (jar.getManifest() == null) { - FMLRelaunchLog.warning("Found an un-manifested jar file in the coremods folder : %s, it will be ignored.", coreMod.getName()); + // Not a coremod continue; } mfAttributes = jar.getManifest().getMainAttributes(); } catch (IOException ioe) { - FMLRelaunchLog.log(Level.SEVERE, ioe, "Unable to read the coremod jar file %s - ignoring", coreMod.getName()); + FMLRelaunchLog.log(Level.SEVERE, ioe, "Unable to read the jar file %s - ignoring", coreMod.getName()); continue; } String fmlCorePlugin = mfAttributes.getValue("FMLCorePlugin"); if (fmlCorePlugin == null) { - FMLRelaunchLog.severe("The coremod %s does not contain a valid jar manifest- it will be ignored", coreMod.getName()); + // Not a coremod continue; } @@ -327,7 +336,7 @@ public class CoreModManager */ private static File setupCoreModDir(File mcDir) { - File coreModDir = new File(mcDir,"coremods"); + File coreModDir = new File(mcDir,"mods"); try { coreModDir = coreModDir.getCanonicalFile();