cpw.mods.fml.common

## Class Loader

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

-     public class Loader
      extends java.lang.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.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ModContainer` | `activeModContainer()`
    `void` | `computeDependencies(java.lang.String dependencyString, java.util.Set<ArtifactVersion> requirements, java.util.List<ArtifactVersion> dependencies, java.util.List<ArtifactVersion> dependants)`
    `java.util.List<java.lang.String>` | `fireMissingMappingEvent(java.util.LinkedHashMap<java.lang.String,java.lang.Integer> missing, boolean isLocalWorld, GameData gameData, java.util.Map<java.lang.String,java.lang.Integer[]> remaps)` Fire a FMLMissingMappingsEvent to let mods determine how blocks/items defined in the world save, but missing from the runtime, are to be handled.
    `void` | `fireRemapEvent(java.util.Map<java.lang.String,java.lang.Integer[]> remaps)`
    `java.util.List<ModContainer>` | `getActiveModList()`
    `ICrashCallable` | `getCallableCrashInformation()`
    `java.io.File` | `getConfigDir()`
    `java.lang.String` | `getCrashInformation()`
    `java.util.Map<java.lang.String,java.lang.String>` | `getCustomModProperties(java.lang.String modId)`
    `java.util.Map<java.lang.String,java.lang.String>` | `getFMLBrandingProperties()`
    `java.lang.String` | `getFMLVersionString()`
    `java.util.Map<java.lang.String,ModContainer>` | `getIndexedModList()`
    `java.lang.String` | `getMCPVersionString()`
    `java.lang.String` | `getMCVersionString()`
    `MinecraftDummyContainer` | `getMinecraftModContainer()`
    `java.lang.ClassLoader` | `getModClassLoader()`
    `java.util.List<ModContainer>` | `getModList()`
    `com.google.common.collect.BiMap<ModContainer,java.lang.Object>` | `getModObjectList()`
    `LoaderState.ModState` | `getModState(ModContainer selectedMod)`
    `com.google.common.collect.BiMap<java.lang.Object,ModContainer>` | `getReversedModObjectList()`
    `boolean` | `hasReachedState(LoaderState state)`
    `void` | `initializeMods()`
    `static void` | `injectData(java.lang.Object... data)`
    `static Loader` | `instance()`
    `boolean` | `isInState(LoaderState state)`
    `static boolean` | `isModLoaded(java.lang.String modname)` Query if we know of a mod named modname
    `void` | `loadMods()` Called from the hook to start mod loading.
    `void` | `preinitializeMods()`
    `void` | `runtimeDisableMod(java.lang.String modId)`
    `boolean` | `serverAboutToStart(java.lang.Object server)`
    `void` | `serverStarted()`
    `boolean` | `serverStarting(java.lang.Object server)`
    `void` | `serverStopped()`
    `void` | `serverStopping()`

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

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

- - ### Method Detail

    - #### instance

          public static Loader instance()

    - #### injectData

          public static void injectData(java.lang.Object... data)

    - #### getModList

          public java.util.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.

    - #### preinitializeMods

          public void preinitializeMods()

    - #### isModLoaded

          public static boolean isModLoaded(java.lang.String modname)

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

    - #### getConfigDir

          public java.io.File getConfigDir()

    - #### getCrashInformation

          public java.lang.String getCrashInformation()

    - #### getFMLVersionString

          public java.lang.String getFMLVersionString()

    - #### getModClassLoader

          public java.lang.ClassLoader getModClassLoader()

    - #### computeDependencies

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

    - #### getIndexedModList

          public java.util.Map<java.lang.String,ModContainer> getIndexedModList()

    - #### initializeMods

          public void initializeMods()

    - #### getCallableCrashInformation

          public ICrashCallable getCallableCrashInformation()

    - #### getActiveModList

          public java.util.List<ModContainer> getActiveModList()

    - #### getModState

          public LoaderState.ModState getModState(ModContainer selectedMod)

    - #### getMCVersionString

          public java.lang.String getMCVersionString()

    - #### serverStarting

          public boolean serverStarting(java.lang.Object server)

    - #### serverStarted

          public void serverStarted()

    - #### serverStopping

          public void serverStopping()

    - #### getModObjectList

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

    - #### getReversedModObjectList

          public com.google.common.collect.BiMap<java.lang.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 java.lang.String getMCPVersionString()

    - #### serverStopped

          public void serverStopped()

    - #### serverAboutToStart

          public boolean serverAboutToStart(java.lang.Object server)

    - #### getFMLBrandingProperties

          public java.util.Map<java.lang.String,java.lang.String> getFMLBrandingProperties()

    - #### getCustomModProperties

          public java.util.Map<java.lang.String,java.lang.String> getCustomModProperties(java.lang.String modId)

    - #### fireMissingMappingEvent

          public java.util.List<java.lang.String> fireMissingMappingEvent(java.util.LinkedHashMap<java.lang.String,java.lang.Integer> missing,
                                                                 boolean isLocalWorld,
                                                                 GameData gameData,
                                                                 java.util.Map<java.lang.String,java.lang.Integer[]> remaps)

      Fire a FMLMissingMappingsEvent to let mods determine how blocks/items defined in the world save, but missing from the runtime, are to be handled.
      Parameters:
        `missing` - Map containing missing names with their associated id, blocks need to come before items for remapping.
        `isLocalWorld` - Whether this is executing for a world load (local/server) or a client.
        `gameData` - GameData instance where the new map's config is to be loaded into.
      Returns:
        List with the mapping results.

    - #### fireRemapEvent

          public void fireRemapEvent(java.util.Map<java.lang.String,java.lang.Integer[]> remaps)

    - #### runtimeDisableMod

          public void runtimeDisableMod(java.lang.String modId)