Java 类net.minecraftforge.fml.common.ModClassLoader 实例源码

项目:CustomWorldGen    文件:ModDiscoverer.java   
public void findClasspathMods(ModClassLoader modClassLoader)
{
    List<String> knownLibraries = ImmutableList.<String>builder()
            // skip default libs
            .addAll(modClassLoader.getDefaultLibraries())
            // skip loaded coremods
            .addAll(CoreModManager.getIgnoredMods())
            // skip reparse coremods here
            .addAll(CoreModManager.getReparseableCoremods())
            .build();
    File[] minecraftSources = modClassLoader.getParentSources();
    if (minecraftSources.length == 1 && minecraftSources[0].isFile())
    {
        FMLLog.fine("Minecraft is a file at %s, loading", minecraftSources[0].getAbsolutePath());
        addCandidate(new ModCandidate(minecraftSources[0], minecraftSources[0], ContainerType.JAR, true, true));
    }
    else
    {
        int i = 0;
        for (File source : minecraftSources)
        {
            if (source.isFile())
            {
                if (knownLibraries.contains(source.getName()) || modClassLoader.isDefaultLibrary(source))
                {
                    FMLLog.finer("Skipping known library file %s", source.getAbsolutePath());
                }
                else
                {
                    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", source.getAbsolutePath());
                addCandidate(new ModCandidate(source, source, ContainerType.DIR, i==0, true));
            }
            i++;
        }
    }

}
项目:CustomWorldGen    文件:FMLConstructionEvent.java   
@SuppressWarnings("unchecked")
public FMLConstructionEvent(Object... eventData)
{
    this.modClassLoader = (ModClassLoader)eventData[0];
    this.asmData = (ASMDataTable) eventData[1];
    this.reverseDependencies = (ListMultimap<String, String>) eventData[2];
}
项目:MercuriusUpdater    文件:MercuriusUpdaterMod.java   
private ClassLoader addClassPath(ClassLoader loader, File file) throws IOException
{
    if (loader instanceof LaunchClassLoader)
    {
        ((LaunchClassLoader)loader).addURL(file.toURI().toURL());
        return loader;
    }
    else if (loader instanceof ModClassLoader)
    {
        ((ModClassLoader)loader).addFile(file);
        return loader;
    }
    ClassLoader parent = loader.getParent();
    return parent == null ? null : addClassPath(parent, file);
}
项目:MercuriusUpdater    文件:MercuriusUpdaterMod.java   
private ClassLoader addClassPath(ClassLoader loader, File file) throws IOException
{
    if (loader instanceof LaunchClassLoader)
    {
        ((LaunchClassLoader)loader).addURL(file.toURI().toURL());
        return loader;
    }
    else if (loader instanceof ModClassLoader)
    {
        ((ModClassLoader)loader).addFile(file);
        return loader;
    }
    ClassLoader parent = loader.getParent();
    return parent == null ? null : addClassPath(parent, file);
}
项目:MercuriusUpdater    文件:MercuriusUpdaterMod.java   
private ClassLoader addClassPath(ClassLoader loader, File file) throws IOException
{
    if (loader instanceof LaunchClassLoader)
    {
        ((LaunchClassLoader)loader).addURL(file.toURI().toURL());
        return loader;
    }
    else if (loader instanceof ModClassLoader)
    {
        ((ModClassLoader)loader).addFile(file);
        return loader;
    }
    ClassLoader parent = loader.getParent();
    return parent == null ? null : addClassPath(parent, file);
}
项目:MercuriusUpdater    文件:MercuriusUpdaterMod.java   
private ClassLoader addClassPath(ClassLoader loader, File file) throws IOException
{
    if (loader instanceof LaunchClassLoader)
    {
        ((LaunchClassLoader)loader).addURL(file.toURI().toURL());
        return loader;
    }
    else if (loader instanceof ModClassLoader)
    {
        ((ModClassLoader)loader).addFile(file);
        return loader;
    }
    ClassLoader parent = loader.getParent();
    return parent == null ? null : addClassPath(parent, file);
}
项目:MercuriusUpdater    文件:MercuriusUpdaterMod.java   
private ClassLoader addClassPath(ClassLoader loader, File file) throws IOException
{
    if (loader instanceof LaunchClassLoader)
    {
        ((LaunchClassLoader)loader).addURL(file.toURI().toURL());
        return loader;
    }
    else if (loader instanceof ModClassLoader)
    {
        ((ModClassLoader)loader).addFile(file);
        return loader;
    }
    ClassLoader parent = loader.getParent();
    return parent == null ? null : addClassPath(parent, file);
}
项目:CustomWorldGen    文件:FMLConstructionEvent.java   
public ModClassLoader getModClassLoader()
{
    return modClassLoader;
}