mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 12:42:26 +00:00
Add in support for mods/<mcversion> as a mod location. Also drop coremods as a location. They go in mods too now.
This commit is contained in:
1 parent
e45767d20a
commit
a2a8f1247f
3 files changed
+29
-9
No files matched your search
@@ -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);
|
||||
|
||||
@@ -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<ModContainer> 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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user