Fix up trying to re-add stuff to the classpath when it's already there

This commit is contained in:
Christian 2012-09-02 12:56:08 -04:00
parent d538dcf06f
commit 599476d587
5 changed files with 16 additions and 10 deletions

View file

@ -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* // 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. " 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 " + " 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))) 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()); return new FMLModContainer(className, modSource, ann.getValues());
} }
} }

View file

@ -60,7 +60,7 @@ public class DirectoryDiscoverer implements ITypeDiscoverer
catch (Exception e) catch (Exception e)
{ {
mc = MetadataCollection.from(null,""); 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());
} }
} }

View file

@ -37,7 +37,7 @@ public class JarDiscoverer implements ITypeDiscoverer
} }
else 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, ""); mc = MetadataCollection.from(null, "");
} }
for (ZipEntry ze : Collections.list(jar.entries())) for (ZipEntry ze : Collections.list(jar.entries()))

View file

@ -15,16 +15,18 @@ public class ModCandidate
private ContainerType sourceType; private ContainerType sourceType;
private boolean classpath; private boolean classpath;
private List<String> baseModTypes = Lists.newArrayList(); private List<String> baseModTypes = Lists.newArrayList();
private boolean isMinecraft;
public ModCandidate(File classPathRoot, File modContainer, ContainerType sourceType) 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.classPathRoot = classPathRoot;
this.modContainer = modContainer; this.modContainer = modContainer;
this.sourceType = sourceType; this.sourceType = sourceType;
this.isMinecraft = isMinecraft;
this.classpath = classpath; this.classpath = classpath;
} }
@ -59,4 +61,8 @@ public class ModCandidate
{ {
return baseModTypes; return baseModTypes;
} }
public boolean isMinecraftJar()
{
return isMinecraft;
}
} }

View file

@ -34,7 +34,7 @@ public class ModDiscoverer
if (minecraftSources.length == 1 && minecraftSources[0].isFile()) if (minecraftSources.length == 1 && minecraftSources[0].isFile())
{ {
FMLLog.fine("Minecraft is a file at %s, loading", minecraftSources[0].getAbsolutePath()); 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 else
{ {
@ -49,13 +49,13 @@ public class ModDiscoverer
else else
{ {
FMLLog.fine("Found a minecraft related file at %s, examining for mod candidates", minecraftSources[i].getAbsolutePath()); 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()) else if (minecraftSources[i].isDirectory())
{ {
FMLLog.fine("Found a minecraft related directory at %s, examining for mod candidates", minecraftSources[i].getAbsolutePath()); 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 try
{ {
List<ModContainer> mods = candidate.explore(dataTable); List<ModContainer> mods = candidate.explore(dataTable);
if (mods.isEmpty()) if (mods.isEmpty() && !candidate.isClasspath())
{ {
nonModLibs.add(candidate.getModContainer()); nonModLibs.add(candidate.getModContainer());
} }