Java 类cpw.mods.fml.common.discovery.ModDiscoverer 实例源码

项目:CauldronGit    文件:Loader.java   
/**
 * The primary loading code
 *
 *
 * The found resources are first loaded into the {@link #modClassLoader}
 * (always) then scanned for class resources matching the specification
 * above.
 *
 * If they provide the {@link Mod} annotation, they will be loaded as
 * "FML mods"
 *
 * Finally, if they are successfully loaded as classes, they are then added
 * to the available mod list.
 */
private ModDiscoverer identifyMods()
{
    FMLLog.fine("Building injected Mod Containers %s", injectedContainers);
    // Add in the MCP mod container
    mods.add(new InjectedModContainer(mcp,new File("minecraft.jar")));
    for (String cont : injectedContainers)
    {
        ModContainer mc;
        try
        {
            mc = (ModContainer) Class.forName(cont,true,modClassLoader).newInstance();
        }
        catch (Exception e)
        {
            FMLLog.log(Level.ERROR, e, "A problem occured instantiating the injected mod container %s", cont);
            throw new LoaderException(e);
        }
        mods.add(new InjectedModContainer(mc,mc.getSource()));
    }
    ModDiscoverer discoverer = new ModDiscoverer();
    FMLLog.fine("Attempting to load mods contained in the minecraft jar file and associated classes");
    discoverer.findClasspathMods(modClassLoader);
    FMLLog.fine("Minecraft jar mods loaded successfully");

    FMLLog.info("Searching %s for mods", canonicalModsDir.getAbsolutePath());
    discoverer.findModDirMods(canonicalModsDir);
    File versionSpecificModsDir = new File(canonicalModsDir,mccversion);
    if (versionSpecificModsDir.isDirectory())
    {
        FMLLog.info("Also searching %s for mods", versionSpecificModsDir);
        discoverer.findModDirMods(versionSpecificModsDir);
    }

    mods.addAll(discoverer.identifyMods());
    identifyDuplicates(mods);
    namedMods = Maps.uniqueIndex(mods, new ModIdFunction());
    FMLLog.info("Forge Mod Loader has identified %d mod%s to load", mods.size(), mods.size() != 1 ? "s" : "");
    return discoverer;
}
项目:Cauldron    文件:Loader.java   
/**
 * The primary loading code
 *
 *
 * The found resources are first loaded into the {@link #modClassLoader}
 * (always) then scanned for class resources matching the specification
 * above.
 *
 * If they provide the {@link Mod} annotation, they will be loaded as
 * "FML mods"
 *
 * Finally, if they are successfully loaded as classes, they are then added
 * to the available mod list.
 */
private ModDiscoverer identifyMods()
{
    FMLLog.fine("Building injected Mod Containers %s", injectedContainers);
    // Add in the MCP mod container
    mods.add(new InjectedModContainer(mcp,new File("minecraft.jar")));
    for (String cont : injectedContainers)
    {
        ModContainer mc;
        try
        {
            mc = (ModContainer) Class.forName(cont,true,modClassLoader).newInstance();
        }
        catch (Exception e)
        {
            FMLLog.log(Level.ERROR, e, "A problem occured instantiating the injected mod container %s", cont);
            throw new LoaderException(e);
        }
        mods.add(new InjectedModContainer(mc,mc.getSource()));
    }
    ModDiscoverer discoverer = new ModDiscoverer();
    FMLLog.fine("Attempting to load mods contained in the minecraft jar file and associated classes");
    discoverer.findClasspathMods(modClassLoader);
    FMLLog.fine("Minecraft jar mods loaded successfully");

    FMLLog.info("Searching %s for mods", canonicalModsDir.getAbsolutePath());
    discoverer.findModDirMods(canonicalModsDir);
    File versionSpecificModsDir = new File(canonicalModsDir,mccversion);
    if (versionSpecificModsDir.isDirectory())
    {
        FMLLog.info("Also searching %s for mods", versionSpecificModsDir);
        discoverer.findModDirMods(versionSpecificModsDir);
    }

    mods.addAll(discoverer.identifyMods());
    identifyDuplicates(mods);
    namedMods = Maps.uniqueIndex(mods, new ModIdFunction());
    FMLLog.info("Forge Mod Loader has identified %d mod%s to load", mods.size(), mods.size() != 1 ? "s" : "");
    return discoverer;
}
项目:Cauldron    文件:Loader.java   
/**
 * The primary loading code
 *
 *
 * The found resources are first loaded into the {@link #modClassLoader}
 * (always) then scanned for class resources matching the specification
 * above.
 *
 * If they provide the {@link Mod} annotation, they will be loaded as
 * "FML mods"
 *
 * Finally, if they are successfully loaded as classes, they are then added
 * to the available mod list.
 */
private ModDiscoverer identifyMods()
{
    FMLLog.fine("Building injected Mod Containers %s", injectedContainers);
    // Add in the MCP mod container
    mods.add(new InjectedModContainer(mcp,new File("minecraft.jar")));
    for (String cont : injectedContainers)
    {
        ModContainer mc;
        try
        {
            mc = (ModContainer) Class.forName(cont,true,modClassLoader).newInstance();
        }
        catch (Exception e)
        {
            FMLLog.log(Level.ERROR, e, "A problem occured instantiating the injected mod container %s", cont);
            throw new LoaderException(e);
        }
        mods.add(new InjectedModContainer(mc,mc.getSource()));
    }
    ModDiscoverer discoverer = new ModDiscoverer();
    FMLLog.fine("Attempting to load mods contained in the minecraft jar file and associated classes");
    discoverer.findClasspathMods(modClassLoader);
    FMLLog.fine("Minecraft jar mods loaded successfully");

    FMLLog.info("Searching %s for mods", canonicalModsDir.getAbsolutePath());
    discoverer.findModDirMods(canonicalModsDir);
    File versionSpecificModsDir = new File(canonicalModsDir,mccversion);
    if (versionSpecificModsDir.isDirectory())
    {
        FMLLog.info("Also searching %s for mods", versionSpecificModsDir);
        discoverer.findModDirMods(versionSpecificModsDir);
    }

    mods.addAll(discoverer.identifyMods());
    identifyDuplicates(mods);
    namedMods = Maps.uniqueIndex(mods, new ModIdFunction());
    FMLLog.info("Forge Mod Loader has identified %d mod%s to load", mods.size(), mods.size() != 1 ? "s" : "");
    return discoverer;
}
项目:Cauldron    文件:Loader.java   
/**
 * The primary loading code
 *
 *
 * The found resources are first loaded into the {@link #modClassLoader}
 * (always) then scanned for class resources matching the specification
 * above.
 *
 * If they provide the {@link Mod} annotation, they will be loaded as
 * "FML mods"
 *
 * Finally, if they are successfully loaded as classes, they are then added
 * to the available mod list.
 */
private ModDiscoverer identifyMods()
{
    FMLLog.fine("Building injected Mod Containers %s", injectedContainers);
    // Add in the MCP mod container
    mods.add(new InjectedModContainer(mcp,new File("minecraft.jar")));
    for (String cont : injectedContainers)
    {
        ModContainer mc;
        try
        {
            mc = (ModContainer) Class.forName(cont,true,modClassLoader).newInstance();
        }
        catch (Exception e)
        {
            FMLLog.log(Level.ERROR, e, "A problem occured instantiating the injected mod container %s", cont);
            throw new LoaderException(e);
        }
        mods.add(new InjectedModContainer(mc,mc.getSource()));
    }
    ModDiscoverer discoverer = new ModDiscoverer();
    FMLLog.fine("Attempting to load mods contained in the minecraft jar file and associated classes");
    discoverer.findClasspathMods(modClassLoader);
    FMLLog.fine("Minecraft jar mods loaded successfully");

    FMLLog.info("Searching %s for mods", canonicalModsDir.getAbsolutePath());
    discoverer.findModDirMods(canonicalModsDir);
    File versionSpecificModsDir = new File(canonicalModsDir,mccversion);
    if (versionSpecificModsDir.isDirectory())
    {
        FMLLog.info("Also searching %s for mods", versionSpecificModsDir);
        discoverer.findModDirMods(versionSpecificModsDir);
    }

    mods.addAll(discoverer.identifyMods());
    identifyDuplicates(mods);
    namedMods = Maps.uniqueIndex(mods, new ModIdFunction());
    FMLLog.info("Forge Mod Loader has identified %d mod%s to load", mods.size(), mods.size() != 1 ? "s" : "");
    return discoverer;
}
项目:TRHS_Club_Mod_2016    文件:ModAPIManager.java   
public void manageAPI(ModClassLoader modClassLoader, ModDiscoverer discoverer)
{
    registerDataTableAndParseAPI(discoverer.getASMTable());
    transformer = modClassLoader.addModAPITransformer(dataTable);
}
项目:TRHS_Club_Mod_2016    文件:Loader.java   
/**
 * The primary loading code
 *
 *
 * The found resources are first loaded into the {@link #modClassLoader}
 * (always) then scanned for class resources matching the specification
 * above.
 *
 * If they provide the {@link Mod} annotation, they will be loaded as
 * "FML mods"
 *
 * Finally, if they are successfully loaded as classes, they are then added
 * to the available mod list.
 */
private ModDiscoverer identifyMods()
{
    FMLLog.fine("Building injected Mod Containers %s", injectedContainers);
    // Add in the MCP mod container
    mods.add(new InjectedModContainer(mcp,new File("minecraft.jar")));
    for (String cont : injectedContainers)
    {
        ModContainer mc;
        try
        {
            mc = (ModContainer) Class.forName(cont,true,modClassLoader).newInstance();
        }
        catch (Exception e)
        {
            FMLLog.log(Level.ERROR, e, "A problem occured instantiating the injected mod container %s", cont);
            throw new LoaderException(e);
        }
        mods.add(new InjectedModContainer(mc,mc.getSource()));
    }
    ModDiscoverer discoverer = new ModDiscoverer();
    FMLLog.fine("Attempting to load mods contained in the minecraft jar file and associated classes");
    discoverer.findClasspathMods(modClassLoader);
    FMLLog.fine("Minecraft jar mods loaded successfully");

    FMLLog.getLogger().log(Level.INFO, "Found {} mods from the command line. Injecting into mod discoverer",ModListHelper.additionalMods.size());
    FMLLog.info("Searching %s for mods", canonicalModsDir.getAbsolutePath());
    discoverer.findModDirMods(canonicalModsDir, ModListHelper.additionalMods.values().toArray(new File[0]));
    File versionSpecificModsDir = new File(canonicalModsDir,mccversion);
    if (versionSpecificModsDir.isDirectory())
    {
        FMLLog.info("Also searching %s for mods", versionSpecificModsDir);
        discoverer.findModDirMods(versionSpecificModsDir);
    }

    mods.addAll(discoverer.identifyMods());
    identifyDuplicates(mods);
    namedMods = Maps.uniqueIndex(mods, new ModIdFunction());
    FMLLog.info("Forge Mod Loader has identified %d mod%s to load", mods.size(), mods.size() != 1 ? "s" : "");
    return discoverer;
}
项目:CauldronGit    文件:ModAPIManager.java   
public void manageAPI(ModClassLoader modClassLoader, ModDiscoverer discoverer)
{
    registerDataTableAndParseAPI(discoverer.getASMTable());
    transformer = modClassLoader.addModAPITransformer(dataTable);
}
项目:Cauldron    文件:ModAPIManager.java   
public void manageAPI(ModClassLoader modClassLoader, ModDiscoverer discoverer)
{
    registerDataTableAndParseAPI(discoverer.getASMTable());
    transformer = modClassLoader.addModAPITransformer(dataTable);
}
项目:Cauldron    文件:ModAPIManager.java   
public void manageAPI(ModClassLoader modClassLoader, ModDiscoverer discoverer)
{
    registerDataTableAndParseAPI(discoverer.getASMTable());
    transformer = modClassLoader.addModAPITransformer(dataTable);
}
项目:Cauldron    文件:ModAPIManager.java   
public void manageAPI(ModClassLoader modClassLoader, ModDiscoverer discoverer)
{
    registerDataTableAndParseAPI(discoverer.getASMTable());
    transformer = modClassLoader.addModAPITransformer(dataTable);
}
项目:RuneCraftery    文件:ModAPIManager.java   
public void manageAPI(ModClassLoader modClassLoader, ModDiscoverer discoverer)
{
    registerDataTableAndParseAPI(discoverer.getASMTable());
    transformer = modClassLoader.addModAPITransformer(dataTable);
}
项目:RuneCraftery    文件:Loader.java   
/**
 * The primary loading code
 *
 * This is visited during first initialization by Minecraft to scan and load
 * the mods from all sources 1. The minecraft jar itself (for loading of in
 * jar mods- I would like to remove this if possible but forge depends on it
 * at present) 2. The mods directory with expanded subdirs, searching for
 * mods named mod_*.class 3. The mods directory for zip and jar files,
 * searching for mod classes named mod_*.class again
 *
 * The found resources are first loaded into the {@link #modClassLoader}
 * (always) then scanned for class resources matching the specification
 * above.
 *
 * If they provide the {@link Mod} annotation, they will be loaded as
 * "FML mods", which currently is effectively a NO-OP. If they are
 * determined to be {@link BaseModProxy} subclasses they are loaded as such.
 *
 * Finally, if they are successfully loaded as classes, they are then added
 * to the available mod list.
 */
private ModDiscoverer identifyMods()
{
    FMLLog.fine("Building injected Mod Containers %s", injectedContainers);
    // Add in the MCP mod container
    mods.add(new InjectedModContainer(mcp,new File("minecraft.jar")));
    for (String cont : injectedContainers)
    {
        ModContainer mc;
        try
        {
            mc = (ModContainer) Class.forName(cont,true,modClassLoader).newInstance();
        }
        catch (Exception e)
        {
            FMLLog.log(Level.SEVERE, e, "A problem occured instantiating the injected mod container %s", cont);
            throw new LoaderException(e);
        }
        mods.add(new InjectedModContainer(mc,mc.getSource()));
    }
    ModDiscoverer discoverer = new ModDiscoverer();
    FMLLog.fine("Attempting to load mods contained in the minecraft jar file and associated classes");
    discoverer.findClasspathMods(modClassLoader);
    FMLLog.fine("Minecraft jar mods loaded successfully");

    FMLLog.info("Searching %s for mods", canonicalModsDir.getAbsolutePath());
    discoverer.findModDirMods(canonicalModsDir);
    File versionSpecificModsDir = new File(canonicalModsDir,mccversion);
    if (versionSpecificModsDir.isDirectory())
    {
        FMLLog.info("Also searching %s for mods", versionSpecificModsDir);
        discoverer.findModDirMods(versionSpecificModsDir);
    }

    mods.addAll(discoverer.identifyMods());
    identifyDuplicates(mods);
    namedMods = Maps.uniqueIndex(mods, new ModIdFunction());
    FMLLog.info("Forge Mod Loader has identified %d mod%s to load", mods.size(), mods.size() != 1 ? "s" : "");
    for (String modId: namedMods.keySet())
    {
        FMLLog.makeLog(modId);
    }
    return discoverer;
}
项目:RuneCraftery    文件:Loader.java   
/**
 * Called from the hook to start mod loading. We trigger the
 * {@link #identifyMods()} and Constructing, Preinitalization, and Initalization phases here. Finally,
 * the mod list is frozen completely and is consider immutable from then on.
 */
public void loadMods()
{
    initializeLoader();
    mods = Lists.newArrayList();
    namedMods = Maps.newHashMap();
    modController = new LoadController(this);
    modController.transition(LoaderState.LOADING, false);
    ModDiscoverer disc = identifyMods();
    ModAPIManager.INSTANCE.manageAPI(modClassLoader, disc);
    disableRequestedMods();
    FMLLog.fine("Reloading logging properties from %s", loggingProperties.getPath());
    FMLRelaunchLog.loadLogConfiguration(loggingProperties);
    FMLLog.fine("Reloaded logging properties");
    modController.distributeStateMessage(FMLLoadEvent.class);
    sortModList();
    ModAPIManager.INSTANCE.cleanupAPIContainers(modController.getActiveModList());
    ModAPIManager.INSTANCE.cleanupAPIContainers(mods);
    mods = ImmutableList.copyOf(mods);
    for (File nonMod : disc.getNonModLibs())
    {
        if (nonMod.isFile())
        {
            FMLLog.info("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, false);
    modController.distributeStateMessage(LoaderState.CONSTRUCTING, modClassLoader, disc.getASMTable());
    FMLLog.fine("Mod signature data");
    for (ModContainer mod : getActiveModList())
    {
        FMLLog.fine("\t%s(%s:%s): %s (%s)", mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName(), CertificateHelper.getFingerprint(mod.getSigningCertificate()));
    }
    if (getActiveModList().isEmpty())
    {
        FMLLog.fine("No user mod signature data found");
    }
    modController.transition(LoaderState.PREINITIALIZATION, false);
    modController.distributeStateMessage(LoaderState.PREINITIALIZATION, disc.getASMTable(), canonicalConfigDir);
    modController.transition(LoaderState.INITIALIZATION, false);
    GameData.validateRegistry();
}
项目:RuneCraftery    文件:ModAPIManager.java   
public void manageAPI(ModClassLoader modClassLoader, ModDiscoverer discoverer)
{
    registerDataTableAndParseAPI(discoverer.getASMTable());
    transformer = modClassLoader.addModAPITransformer(dataTable);
}
项目:RuneCraftery    文件:Loader.java   
/**
 * The primary loading code
 *
 * This is visited during first initialization by Minecraft to scan and load
 * the mods from all sources 1. The minecraft jar itself (for loading of in
 * jar mods- I would like to remove this if possible but forge depends on it
 * at present) 2. The mods directory with expanded subdirs, searching for
 * mods named mod_*.class 3. The mods directory for zip and jar files,
 * searching for mod classes named mod_*.class again
 *
 * The found resources are first loaded into the {@link #modClassLoader}
 * (always) then scanned for class resources matching the specification
 * above.
 *
 * If they provide the {@link Mod} annotation, they will be loaded as
 * "FML mods", which currently is effectively a NO-OP. If they are
 * determined to be {@link BaseModProxy} subclasses they are loaded as such.
 *
 * Finally, if they are successfully loaded as classes, they are then added
 * to the available mod list.
 */
private ModDiscoverer identifyMods()
{
    FMLLog.fine("Building injected Mod Containers %s", injectedContainers);
    // Add in the MCP mod container
    mods.add(new InjectedModContainer(mcp,new File("minecraft.jar")));
    for (String cont : injectedContainers)
    {
        ModContainer mc;
        try
        {
            mc = (ModContainer) Class.forName(cont,true,modClassLoader).newInstance();
        }
        catch (Exception e)
        {
            FMLLog.log(Level.SEVERE, e, "A problem occured instantiating the injected mod container %s", cont);
            throw new LoaderException(e);
        }
        mods.add(new InjectedModContainer(mc,mc.getSource()));
    }
    ModDiscoverer discoverer = new ModDiscoverer();
    FMLLog.fine("Attempting to load mods contained in the minecraft jar file and associated classes");
    discoverer.findClasspathMods(modClassLoader);
    FMLLog.fine("Minecraft jar mods loaded successfully");

    FMLLog.info("Searching %s for mods", canonicalModsDir.getAbsolutePath());
    discoverer.findModDirMods(canonicalModsDir);
    File versionSpecificModsDir = new File(canonicalModsDir,mccversion);
    if (versionSpecificModsDir.isDirectory())
    {
        FMLLog.info("Also searching %s for mods", versionSpecificModsDir);
        discoverer.findModDirMods(versionSpecificModsDir);
    }

    mods.addAll(discoverer.identifyMods());
    identifyDuplicates(mods);
    namedMods = Maps.uniqueIndex(mods, new ModIdFunction());
    FMLLog.info("Forge Mod Loader has identified %d mod%s to load", mods.size(), mods.size() != 1 ? "s" : "");
    for (String modId: namedMods.keySet())
    {
        FMLLog.makeLog(modId);
    }
    return discoverer;
}
项目:RuneCraftery    文件:Loader.java   
/**
 * Called from the hook to start mod loading. We trigger the
 * {@link #identifyMods()} and Constructing, Preinitalization, and Initalization phases here. Finally,
 * the mod list is frozen completely and is consider immutable from then on.
 */
public void loadMods()
{
    initializeLoader();
    mods = Lists.newArrayList();
    namedMods = Maps.newHashMap();
    modController = new LoadController(this);
    modController.transition(LoaderState.LOADING, false);
    ModDiscoverer disc = identifyMods();
    ModAPIManager.INSTANCE.manageAPI(modClassLoader, disc);
    disableRequestedMods();
    FMLLog.fine("Reloading logging properties from %s", loggingProperties.getPath());
    FMLRelaunchLog.loadLogConfiguration(loggingProperties);
    FMLLog.fine("Reloaded logging properties");
    modController.distributeStateMessage(FMLLoadEvent.class);
    sortModList();
    ModAPIManager.INSTANCE.cleanupAPIContainers(modController.getActiveModList());
    ModAPIManager.INSTANCE.cleanupAPIContainers(mods);
    mods = ImmutableList.copyOf(mods);
    for (File nonMod : disc.getNonModLibs())
    {
        if (nonMod.isFile())
        {
            FMLLog.info("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, false);
    modController.distributeStateMessage(LoaderState.CONSTRUCTING, modClassLoader, disc.getASMTable());
    FMLLog.fine("Mod signature data");
    for (ModContainer mod : getActiveModList())
    {
        FMLLog.fine("\t%s(%s:%s): %s (%s)", mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName(), CertificateHelper.getFingerprint(mod.getSigningCertificate()));
    }
    if (getActiveModList().isEmpty())
    {
        FMLLog.fine("No user mod signature data found");
    }
    modController.transition(LoaderState.PREINITIALIZATION, false);
    modController.distributeStateMessage(LoaderState.PREINITIALIZATION, disc.getASMTable(), canonicalConfigDir);
    modController.transition(LoaderState.INITIALIZATION, false);
    GameData.validateRegistry();
}
项目:BetterNutritionMod    文件:ModAPIManager.java   
public void manageAPI(ModClassLoader modClassLoader, ModDiscoverer discoverer)
{
    registerDataTableAndParseAPI(discoverer.getASMTable());
    transformer = modClassLoader.addModAPITransformer(dataTable);
}
项目:BetterNutritionMod    文件:Loader.java   
/**
 * The primary loading code
 *
 * This is visited during first initialization by Minecraft to scan and load
 * the mods from all sources 1. The minecraft jar itself (for loading of in
 * jar mods- I would like to remove this if possible but forge depends on it
 * at present) 2. The mods directory with expanded subdirs, searching for
 * mods named mod_*.class 3. The mods directory for zip and jar files,
 * searching for mod classes named mod_*.class again
 *
 * The found resources are first loaded into the {@link #modClassLoader}
 * (always) then scanned for class resources matching the specification
 * above.
 *
 * If they provide the {@link Mod} annotation, they will be loaded as
 * "FML mods", which currently is effectively a NO-OP. If they are
 * determined to be {@link BaseModProxy} subclasses they are loaded as such.
 *
 * Finally, if they are successfully loaded as classes, they are then added
 * to the available mod list.
 */
private ModDiscoverer identifyMods()
{
    FMLLog.fine("Building injected Mod Containers %s", injectedContainers);
    // Add in the MCP mod container
    mods.add(new InjectedModContainer(mcp,new File("minecraft.jar")));
    for (String cont : injectedContainers)
    {
        ModContainer mc;
        try
        {
            mc = (ModContainer) Class.forName(cont,true,modClassLoader).newInstance();
        }
        catch (Exception e)
        {
            FMLLog.log(Level.SEVERE, e, "A problem occured instantiating the injected mod container %s", cont);
            throw new LoaderException(e);
        }
        mods.add(new InjectedModContainer(mc,mc.getSource()));
    }
    ModDiscoverer discoverer = new ModDiscoverer();
    FMLLog.fine("Attempting to load mods contained in the minecraft jar file and associated classes");
    discoverer.findClasspathMods(modClassLoader);
    FMLLog.fine("Minecraft jar mods loaded successfully");

    FMLLog.info("Searching %s for mods", canonicalModsDir.getAbsolutePath());
    discoverer.findModDirMods(canonicalModsDir);
    File versionSpecificModsDir = new File(canonicalModsDir,mccversion);
    if (versionSpecificModsDir.isDirectory())
    {
        FMLLog.info("Also searching %s for mods", versionSpecificModsDir);
        discoverer.findModDirMods(versionSpecificModsDir);
    }

    mods.addAll(discoverer.identifyMods());
    identifyDuplicates(mods);
    namedMods = Maps.uniqueIndex(mods, new ModIdFunction());
    FMLLog.info("Forge Mod Loader has identified %d mod%s to load", mods.size(), mods.size() != 1 ? "s" : "");
    for (String modId: namedMods.keySet())
    {
        FMLLog.makeLog(modId);
    }
    return discoverer;
}
项目:BetterNutritionMod    文件:Loader.java   
/**
 * Called from the hook to start mod loading. We trigger the
 * {@link #identifyMods()} and Constructing, Preinitalization, and Initalization phases here. Finally,
 * the mod list is frozen completely and is consider immutable from then on.
 */
public void loadMods()
{
    initializeLoader();
    mods = Lists.newArrayList();
    namedMods = Maps.newHashMap();
    modController = new LoadController(this);
    modController.transition(LoaderState.LOADING, false);
    ModDiscoverer disc = identifyMods();
    ModAPIManager.INSTANCE.manageAPI(modClassLoader, disc);
    disableRequestedMods();
    FMLLog.fine("Reloading logging properties from %s", loggingProperties.getPath());
    FMLRelaunchLog.loadLogConfiguration(loggingProperties);
    FMLLog.fine("Reloaded logging properties");
    modController.distributeStateMessage(FMLLoadEvent.class);
    sortModList();
    ModAPIManager.INSTANCE.cleanupAPIContainers(modController.getActiveModList());
    ModAPIManager.INSTANCE.cleanupAPIContainers(mods);
    mods = ImmutableList.copyOf(mods);
    for (File nonMod : disc.getNonModLibs())
    {
        if (nonMod.isFile())
        {
            FMLLog.info("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, false);
    modController.distributeStateMessage(LoaderState.CONSTRUCTING, modClassLoader, disc.getASMTable());
    FMLLog.fine("Mod signature data");
    for (ModContainer mod : getActiveModList())
    {
        FMLLog.fine("\t%s(%s:%s): %s (%s)", mod.getModId(), mod.getName(), mod.getVersion(), mod.getSource().getName(), CertificateHelper.getFingerprint(mod.getSigningCertificate()));
    }
    if (getActiveModList().isEmpty())
    {
        FMLLog.fine("No user mod signature data found");
    }
    modController.transition(LoaderState.PREINITIALIZATION, false);
    modController.distributeStateMessage(LoaderState.PREINITIALIZATION, disc.getASMTable(), canonicalConfigDir);
    modController.transition(LoaderState.INITIALIZATION, false);
    GameData.validateRegistry();
}