Add in random jar/zip files to the classpath. UGH this is so fucking ugly it's not funny.

This commit is contained in:
Christian 2012-08-30 20:10:13 -04:00
parent 93f9cc45f9
commit 74d6437856
2 changed files with 31 additions and 1 deletions

View file

@ -16,6 +16,7 @@ package cpw.mods.fml.common;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
@ -438,6 +439,21 @@ public class Loader
modController.distributeStateMessage(FMLLoadEvent.class);
sortModList();
mods = ImmutableList.copyOf(mods);
for (File nonMod : disc.getNonModLibs())
{
if (nonMod.isFile())
{
FMLLog.severe("FML has found a non-mod file %s in your mods directory. It will now be injected into your classpath. This could severe stability issues, it should be removed if possible.", nonMod.getName());
try
{
modClassLoader.addFile(nonMod);
}
catch (MalformedURLException e)
{
FMLLog.log(Level.SEVERE, e, "Encountered a weird problem with non-mod file injection : %s", nonMod.getName());
}
}
}
modController.transition(LoaderState.CONSTRUCTING);
modController.distributeStateMessage(LoaderState.CONSTRUCTING, modClassLoader, disc.getASMTable());
modController.transition(LoaderState.PREINITIALIZATION);

View file

@ -25,6 +25,8 @@ public class ModDiscoverer
private ASMDataTable dataTable = new ASMDataTable();
private List<File> nonModLibs = Lists.newArrayList();
public void findClasspathMods(ModClassLoader modClassLoader)
{
List<String> knownLibraries = ImmutableList.<String>builder().addAll(modClassLoader.getDefaultLibraries()).addAll(RelaunchLibraryManager.getLibraries()).build();
@ -99,7 +101,14 @@ public class ModDiscoverer
try
{
List<ModContainer> mods = candidate.explore(dataTable);
modList.addAll(mods);
if (mods.isEmpty())
{
nonModLibs.add(candidate.getModContainer());
}
else
{
modList.addAll(mods);
}
}
catch (LoaderException le)
{
@ -119,4 +128,9 @@ public class ModDiscoverer
return dataTable;
}
public List<File> getNonModLibs()
{
return nonModLibs;
}
}