cpw.mods.fml.common

## Class Loader

- java.lang.Object
- - cpw.mods.fml.common.Loader

-     public class Loader
      extends Object

  The loader class performs the actual loading of the mod code from disk.

  There are several `LoaderState`s to mod loading, triggered in two different stages from the FML handler code's hooks into the minecraft code.

  1. LOADING. Scanning the filesystem for mod containers to load (zips, jars, directories), adding them to the `modClassLoader` Scanning, the loaded containers for mod classes to load and registering them appropriately.
  2. PREINIT. The mod classes are configured, they are sorted into a load order, and instances of the mods are constructed.
  3. INIT. The mod instances are initialized. For BaseMod mods, this involves calling the load method.
  4. POSTINIT. The mod instances are post initialized. For BaseMod mods this involves calling the modsLoaded method.
  5. UP. The Loader is complete
  6. ERRORED. The loader encountered an error during the LOADING phase and dropped to this state instead. It will not complete loading from this state, but it attempts to continue loading before abandoning and giving a fatal error.
  Phase 1 code triggers the LOADING and PREINIT states. Phase 2 code triggers the INIT and POSTINIT states.
  Author:
    cpw

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ModContainer` | `activeModContainer()`
    `void` | `computeDependencies(String dependencyString, Set<ArtifactVersion> requirements, List<ArtifactVersion> dependencies, List<ArtifactVersion> dependants)`
    `List<ModContainer>` | `getActiveModList()`
    `ICrashCallable` | `getCallableCrashInformation()`
    `File` | `getConfigDir()`
    `String` | `getCrashInformation()`
    `String` | `getFMLVersionString()`
    `Map<String,ModContainer>` | `getIndexedModList()`
    `String` | `getMCPVersionString()`
    `String` | `getMCVersionString()`
    `MinecraftDummyContainer` | `getMinecraftModContainer()`
    `ClassLoader` | `getModClassLoader()`
    `List<ModContainer>` | `getModList()`
    `com.google.common.collect.BiMap<ModContainer,Object>` | `getModObjectList()`
    `LoaderState.ModState` | `getModState(ModContainer selectedMod)`
    `com.google.common.collect.BiMap<Object,ModContainer>` | `getReversedModObjectList()`
    `boolean` | `hasReachedState(LoaderState state)`
    `void` | `initializeMods()`
    `static void` | `injectData(Object... data)`
    `static Loader` | `instance()`
    `boolean` | `isInState(LoaderState state)`
    `static boolean` | `isModLoaded(String modname)` Query if we know of a mod named modname
    `void` | `loadMods()` Called from the hook to start mod loading.
    `boolean` | `serverAboutToStart(Object server)`
    `void` | `serverStarted()`
    `boolean` | `serverStarting(Object server)`
    `void` | `serverStopped()`
    `void` | `serverStopping()`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### instance

          public static Loader instance()

    - #### injectData

          public static void injectData(Object... data)

    - #### getModList

          public List<ModContainer> getModList()

    - #### loadMods

          public void loadMods()

      Called from the hook to start mod loading. We trigger the `identifyMods()` and Constructing, Preinitalization, and Initalization phases here. Finally, the mod list is frozen completely and is consider immutable from then on.

    - #### isModLoaded

          public static boolean isModLoaded(String modname)

      Query if we know of a mod named modname
      Parameters:
        `modname` -
      Returns:
        If the mod is loaded

    - #### getConfigDir

          public File getConfigDir()

    - #### getCrashInformation

          public String getCrashInformation()

    - #### getFMLVersionString

          public String getFMLVersionString()

    - #### getModClassLoader

          public ClassLoader getModClassLoader()

    - #### computeDependencies

          public void computeDependencies(String dependencyString,
                                 Set<ArtifactVersion> requirements,
                                 List<ArtifactVersion> dependencies,
                                 List<ArtifactVersion> dependants)

    - #### getIndexedModList

          public Map<String,ModContainer> getIndexedModList()

    - #### initializeMods

          public void initializeMods()

    - #### getCallableCrashInformation

          public ICrashCallable getCallableCrashInformation()

    - #### getActiveModList

          public List<ModContainer> getActiveModList()

    - #### getModState

          public LoaderState.ModState getModState(ModContainer selectedMod)

    - #### getMCVersionString

          public String getMCVersionString()

    - #### serverStarting

          public boolean serverStarting(Object server)

    - #### serverStarted

          public void serverStarted()

    - #### serverStopping

          public void serverStopping()

    - #### getModObjectList

          public com.google.common.collect.BiMap<ModContainer,Object> getModObjectList()

    - #### getReversedModObjectList

          public com.google.common.collect.BiMap<Object,ModContainer> getReversedModObjectList()

    - #### activeModContainer

          public ModContainer activeModContainer()

    - #### isInState

          public boolean isInState(LoaderState state)

    - #### getMinecraftModContainer

          public MinecraftDummyContainer getMinecraftModContainer()

    - #### hasReachedState

          public boolean hasReachedState(LoaderState state)

    - #### getMCPVersionString

          public String getMCPVersionString()

    - #### serverStopped

          public void serverStopped()

    - #### serverAboutToStart

          public boolean serverAboutToStart(Object server)