From 599476d587388afd69e2ea42ddf6939ca81cf84c Mon Sep 17 00:00:00 2001 From: Christian Date: Sun, 2 Sep 2012 12:56:08 -0400 Subject: [PATCH] Fix up trying to re-add stuff to the classpath when it's already there --- .../cpw/mods/fml/common/ModContainerFactory.java | 4 ++-- .../mods/fml/common/discovery/DirectoryDiscoverer.java | 2 +- .../cpw/mods/fml/common/discovery/JarDiscoverer.java | 2 +- .../cpw/mods/fml/common/discovery/ModCandidate.java | 10 ++++++++-- .../cpw/mods/fml/common/discovery/ModDiscoverer.java | 8 ++++---- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/fml/common/cpw/mods/fml/common/ModContainerFactory.java b/fml/common/cpw/mods/fml/common/ModContainerFactory.java index 73250dd49..b0a0b926e 100644 --- a/fml/common/cpw/mods/fml/common/ModContainerFactory.java +++ b/fml/common/cpw/mods/fml/common/ModContainerFactory.java @@ -32,7 +32,7 @@ public class ModContainerFactory } // We warn if it's not a basemod instance -- compatibility requires it to be in net.minecraft.src *sigh* - if (className.startsWith("net.minecraft.src.") && container.isClasspath()) + if (className.startsWith("net.minecraft.src.") && container.isClasspath() && !container.isMinecraftJar()) { FMLLog.severe("FML has detected a mod that is using a package name based on 'net.minecraft.src' : %s. This is generally a severe programming error. " + " There should be no mod code in the minecraft namespace. MOVE YOUR MOD! If you're in eclipse, select your source code and 'refactor' it into " @@ -43,7 +43,7 @@ public class ModContainerFactory { if (ann.getASMType().equals(Type.getType(Mod.class))) { - FMLLog.fine("Identified a FMLMod type mod %s", className); + FMLLog.fine("Identified an FMLMod type mod %s", className); return new FMLModContainer(className, modSource, ann.getValues()); } } diff --git a/fml/common/cpw/mods/fml/common/discovery/DirectoryDiscoverer.java b/fml/common/cpw/mods/fml/common/discovery/DirectoryDiscoverer.java index 1df79c186..edf90e604 100644 --- a/fml/common/cpw/mods/fml/common/discovery/DirectoryDiscoverer.java +++ b/fml/common/cpw/mods/fml/common/discovery/DirectoryDiscoverer.java @@ -60,7 +60,7 @@ public class DirectoryDiscoverer implements ITypeDiscoverer catch (Exception e) { mc = MetadataCollection.from(null,""); - FMLLog.info("No mcmod.info file found in directory %s", modDir.getName()); + FMLLog.fine("No mcmod.info file found in directory %s", modDir.getName()); } } diff --git a/fml/common/cpw/mods/fml/common/discovery/JarDiscoverer.java b/fml/common/cpw/mods/fml/common/discovery/JarDiscoverer.java index 03f63457a..6ade9bfa1 100644 --- a/fml/common/cpw/mods/fml/common/discovery/JarDiscoverer.java +++ b/fml/common/cpw/mods/fml/common/discovery/JarDiscoverer.java @@ -37,7 +37,7 @@ public class JarDiscoverer implements ITypeDiscoverer } else { - FMLLog.info("The mod container %s appears to be missing an mcmod.info file", candidate.getModContainer().getName()); + FMLLog.fine("The mod container %s appears to be missing an mcmod.info file", candidate.getModContainer().getName()); mc = MetadataCollection.from(null, ""); } for (ZipEntry ze : Collections.list(jar.entries())) diff --git a/fml/common/cpw/mods/fml/common/discovery/ModCandidate.java b/fml/common/cpw/mods/fml/common/discovery/ModCandidate.java index e883294f5..0de968a0c 100644 --- a/fml/common/cpw/mods/fml/common/discovery/ModCandidate.java +++ b/fml/common/cpw/mods/fml/common/discovery/ModCandidate.java @@ -15,16 +15,18 @@ public class ModCandidate private ContainerType sourceType; private boolean classpath; private List baseModTypes = Lists.newArrayList(); + private boolean isMinecraft; public ModCandidate(File classPathRoot, File modContainer, ContainerType sourceType) { - this(classPathRoot, modContainer, sourceType, false); + this(classPathRoot, modContainer, sourceType, false, false); } - public ModCandidate(File classPathRoot, File modContainer, ContainerType sourceType, boolean classpath) + public ModCandidate(File classPathRoot, File modContainer, ContainerType sourceType, boolean isMinecraft, boolean classpath) { this.classPathRoot = classPathRoot; this.modContainer = modContainer; this.sourceType = sourceType; + this.isMinecraft = isMinecraft; this.classpath = classpath; } @@ -59,4 +61,8 @@ public class ModCandidate { return baseModTypes; } + public boolean isMinecraftJar() + { + return isMinecraft; + } } \ No newline at end of file diff --git a/fml/common/cpw/mods/fml/common/discovery/ModDiscoverer.java b/fml/common/cpw/mods/fml/common/discovery/ModDiscoverer.java index f12f1f8c6..411eb8a9a 100644 --- a/fml/common/cpw/mods/fml/common/discovery/ModDiscoverer.java +++ b/fml/common/cpw/mods/fml/common/discovery/ModDiscoverer.java @@ -34,7 +34,7 @@ public class ModDiscoverer if (minecraftSources.length == 1 && minecraftSources[0].isFile()) { FMLLog.fine("Minecraft is a file at %s, loading", minecraftSources[0].getAbsolutePath()); - candidates.add(new ModCandidate(minecraftSources[0], minecraftSources[0], ContainerType.JAR)); + candidates.add(new ModCandidate(minecraftSources[0], minecraftSources[0], ContainerType.JAR, true, true)); } else { @@ -49,13 +49,13 @@ public class ModDiscoverer else { FMLLog.fine("Found a minecraft related file at %s, examining for mod candidates", minecraftSources[i].getAbsolutePath()); - candidates.add(new ModCandidate(minecraftSources[i], minecraftSources[i], ContainerType.JAR, i!=0)); + candidates.add(new ModCandidate(minecraftSources[i], minecraftSources[i], ContainerType.JAR, i==0, true)); } } else if (minecraftSources[i].isDirectory()) { FMLLog.fine("Found a minecraft related directory at %s, examining for mod candidates", minecraftSources[i].getAbsolutePath()); - candidates.add(new ModCandidate(minecraftSources[i], minecraftSources[i], ContainerType.DIR, i!=0)); + candidates.add(new ModCandidate(minecraftSources[i], minecraftSources[i], ContainerType.DIR, i==0, true)); } } } @@ -101,7 +101,7 @@ public class ModDiscoverer try { List mods = candidate.explore(dataTable); - if (mods.isEmpty()) + if (mods.isEmpty() && !candidate.isClasspath()) { nonModLibs.add(candidate.getModContainer()); }