mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 00:37:52 +00:00
Filter more known libraries from potential mod canidates.
This commit is contained in:
1 parent
68efb9d6f4
commit
d14ad7dd9a
2 files changed
+59
-8
No files matched your search
@@ -86,6 +86,55 @@ public class ModClassLoader extends URLClassLoader
|
||||
return STANDARD_LIBRARIES;
|
||||
}
|
||||
|
||||
public boolean isDefaultLibrary(File file)
|
||||
{
|
||||
// Should really pull this from the json somehow, but we dont have that at runtime.
|
||||
String name = file.getName();
|
||||
if (!name.endsWith(".jar")) return false;
|
||||
String[] prefixes =
|
||||
{
|
||||
"launchwrapper-",
|
||||
"asm-all-",
|
||||
"akka-actor_2.11-",
|
||||
"config-",
|
||||
"scala-",
|
||||
"jopt-simple-",
|
||||
"lzma-",
|
||||
"realms-",
|
||||
"httpclient-",
|
||||
"httpcore-",
|
||||
"vecmath-",
|
||||
"trove4j-",
|
||||
"icu4j-core-mojang-",
|
||||
"codecjorbis-",
|
||||
"codecwav-",
|
||||
"libraryjavawound-",
|
||||
"librarylwjglopenal-",
|
||||
"soundsystem-",
|
||||
"netty-all-",
|
||||
"quava-",
|
||||
"commons-lang3-",
|
||||
"commons-compress-",
|
||||
"commons-logging-",
|
||||
"commons-io-",
|
||||
"commons-codec-",
|
||||
"jinput-",
|
||||
"jutils-",
|
||||
"gson-",
|
||||
"authlib-",
|
||||
"log4j-api-",
|
||||
"log4j-core-",
|
||||
"lwjgl-",
|
||||
"lwjgl_util-",
|
||||
"twitch-"
|
||||
};
|
||||
for (String s : prefixes)
|
||||
{
|
||||
if (name.startsWith(s)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void clearNegativeCacheFor(Set<String> classList)
|
||||
{
|
||||
mainClassLoader.clearNegativeEntries(classList);
|
||||
|
||||
@@ -60,25 +60,27 @@ public class ModDiscoverer
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < minecraftSources.length; i++)
|
||||
int i = 0;
|
||||
for (File source : minecraftSources)
|
||||
{
|
||||
if (minecraftSources[i].isFile())
|
||||
if (source.isFile())
|
||||
{
|
||||
if (knownLibraries.contains(minecraftSources[i].getName()))
|
||||
if (knownLibraries.contains(source.getName()) || modClassLoader.isDefaultLibrary(source))
|
||||
{
|
||||
FMLLog.finer("Skipping known library file %s", minecraftSources[i].getAbsolutePath());
|
||||
FMLLog.finer("Skipping known library file %s", source.getAbsolutePath());
|
||||
}
|
||||
else
|
||||
{
|
||||
FMLLog.fine("Found a minecraft related file at %s, examining for mod candidates", minecraftSources[i].getAbsolutePath());
|
||||
addCandidate(new ModCandidate(minecraftSources[i], minecraftSources[i], ContainerType.JAR, i==0, true));
|
||||
FMLLog.fine("Found a minecraft related file at %s, examining for mod candidates", source.getAbsolutePath());
|
||||
addCandidate(new ModCandidate(source, source, 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());
|
||||
addCandidate(new ModCandidate(minecraftSources[i], minecraftSources[i], ContainerType.DIR, i==0, true));
|
||||
FMLLog.fine("Found a minecraft related directory at %s, examining for mod candidates", source.getAbsolutePath());
|
||||
addCandidate(new ModCandidate(source, source, ContainerType.DIR, i==0, true));
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user