public class Loader
extends java.lang.Object
There are several LoaderState
s to mod loading, triggered in two
different stages from the FML handler code's hooks into the minecraft code.
modClassLoader
Scanning, the loaded
containers for mod classes to load and registering them appropriately.Modifier and Type | Class and Description |
---|---|
private class |
Loader.ModIdComparator |
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
build |
private java.io.File |
canonicalConfigDir
The canonical configuration directory
|
private java.io.File |
canonicalModsDir |
private ModDiscoverer |
discoverer |
private com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> |
fmlBrandingProperties |
private java.io.File |
forcedModFile |
private com.google.common.collect.ListMultimap<java.lang.String,ArtifactVersion> |
injectedAfter |
private com.google.common.collect.ListMultimap<java.lang.String,ArtifactVersion> |
injectedBefore |
private static java.util.List<java.lang.String> |
injectedContainers |
private static Loader |
instance
The singleton instance
|
private static java.lang.String |
major
Build information for tracking purposes.
|
static java.lang.String |
MC_VERSION |
private static java.lang.String |
mccversion |
private MCPDummyContainer |
mcp |
private static java.lang.String |
mcpversion |
private MinecraftDummyContainer |
minecraft |
private static java.io.File |
minecraftDir |
private static java.lang.String |
minor |
private ModClassLoader |
modClassLoader
The class loader we load the mods into.
|
private LoadController |
modController |
private java.util.List<ModContainer> |
mods
The sorted list of mods.
|
private java.util.Map<java.lang.String,ModContainer> |
namedMods
A named list of mods
|
private ProgressManager.ProgressBar |
progressBar |
private static java.lang.String |
rev |
private com.google.common.collect.ListMultimap<java.lang.String,java.lang.String> |
reverseDependencies
A reverse dependency graph for mods
|
Modifier | Constructor and Description |
---|---|
private |
Loader() |
Modifier and Type | Method and Description |
---|---|
ModContainer |
activeModContainer() |
(package private) boolean |
checkRemoteModList(java.util.Map<java.lang.String,java.lang.String> modList,
Side side) |
void |
computeDependencies(java.lang.String dependencyString,
java.util.Set<ArtifactVersion> requirements,
java.util.List<ArtifactVersion> dependencies,
java.util.List<ArtifactVersion> dependants)
Deprecated.
|
private void |
disableRequestedMods() |
void |
fireRemapEvent(java.util.Map<ResourceLocation,java.util.Map<ResourceLocation,java.lang.Integer[]>> remaps,
boolean isFreezing) |
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() |
(package private) java.util.List<ArtifactVersion> |
getInjectedAfter(java.lang.String modId) |
(package private) java.util.List<ArtifactVersion> |
getInjectedBefore(java.lang.String modId) |
LoaderState |
getLoaderState() |
java.lang.String |
getMCPVersionString() |
java.lang.String |
getMCVersionString() |
MinecraftDummyContainer |
getMinecraftModContainer() |
ModClassLoader |
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) |
private void |
identifyDuplicates(java.util.List<ModContainer> mods) |
private ModDiscoverer |
identifyMods(java.util.List<java.lang.String> additionalContainers)
The primary loading code
The found resources are first loaded into the
modClassLoader
(always) then scanned for class resources matching the specification
above. |
private void |
initializeLoader() |
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 |
loadingComplete() |
void |
loadMods(java.util.List<java.lang.String> injectedModContainers)
Called from the hook to start mod loading.
|
void |
preinitializeMods() |
private void |
readInjectedDependencies() |
void |
runtimeDisableMod(java.lang.String modId) |
boolean |
serverAboutToStart(java.lang.Object server) |
void |
serverStarted() |
boolean |
serverStarting(java.lang.Object server) |
void |
serverStopped() |
void |
serverStopping() |
void |
setActiveModContainer(ModContainer container) |
void |
setupTestHarness(ModContainer... containers)
Used to setup a testharness with a single dummy mod instance for use with various testing hooks
|
private void |
sortModList()
Sort the mods into a sorted list, using dependency information from the
containers.
|
public static final java.lang.String MC_VERSION
private static Loader instance
private static java.lang.String major
private static java.lang.String minor
private static java.lang.String rev
private static java.lang.String build
private static java.lang.String mccversion
private static java.lang.String mcpversion
private ModClassLoader modClassLoader
private java.util.List<ModContainer> mods
private java.util.Map<java.lang.String,ModContainer> namedMods
private com.google.common.collect.ListMultimap<java.lang.String,java.lang.String> reverseDependencies
private java.io.File canonicalConfigDir
private java.io.File canonicalModsDir
private LoadController modController
private MinecraftDummyContainer minecraft
private MCPDummyContainer mcp
private static java.io.File minecraftDir
private static java.util.List<java.lang.String> injectedContainers
private com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> fmlBrandingProperties
private java.io.File forcedModFile
private ModDiscoverer discoverer
private ProgressManager.ProgressBar progressBar
private com.google.common.collect.ListMultimap<java.lang.String,ArtifactVersion> injectedBefore
private com.google.common.collect.ListMultimap<java.lang.String,ArtifactVersion> injectedAfter
public static Loader instance()
public static void injectData(java.lang.Object... data)
private void sortModList()
TopologicalSort
based on the pre- and post- dependency information provided by the mods.private ModDiscoverer identifyMods(java.util.List<java.lang.String> additionalContainers)
modClassLoader
(always) then scanned for class resources matching the specification
above.
If they provide the 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 void identifyDuplicates(java.util.List<ModContainer> mods)
private void initializeLoader()
public java.util.List<ModContainer> getModList()
public void setupTestHarness(ModContainer... containers)
containers
- A list of dummy containers that will be returned as "active" for all queriespublic void loadMods(java.util.List<java.lang.String> injectedModContainers)
identifyMods(List)
and Constructing, Preinitalization, and Initalization phases here. Finally,
the mod list is frozen completely and is consider immutable from then on.injectedModContainers
- containers to injectpublic void preinitializeMods()
private void disableRequestedMods()
public static boolean isModLoaded(java.lang.String modname)
modname
- public java.io.File getConfigDir()
public java.lang.String getCrashInformation()
public java.lang.String getFMLVersionString()
public ModClassLoader getModClassLoader()
@Deprecated public void computeDependencies(java.lang.String dependencyString, java.util.Set<ArtifactVersion> requirements, java.util.List<ArtifactVersion> dependencies, java.util.List<ArtifactVersion> dependants)
DependencyParser.parseDependencies(String)
public java.util.Map<java.lang.String,ModContainer> getIndexedModList()
public void initializeMods()
public ICrashCallable getCallableCrashInformation()
public java.util.List<ModContainer> getActiveModList()
public LoaderState.ModState getModState(ModContainer selectedMod)
public java.lang.String getMCVersionString()
public boolean serverStarting(java.lang.Object server)
public void serverStarted()
public void serverStopping()
public com.google.common.collect.BiMap<ModContainer,java.lang.Object> getModObjectList()
public com.google.common.collect.BiMap<java.lang.Object,ModContainer> getReversedModObjectList()
@Nullable public ModContainer activeModContainer()
public boolean isInState(LoaderState state)
public MinecraftDummyContainer getMinecraftModContainer()
public boolean hasReachedState(LoaderState state)
public java.lang.String getMCPVersionString()
public void serverStopped()
public boolean serverAboutToStart(java.lang.Object server)
public java.util.Map<java.lang.String,java.lang.String> getFMLBrandingProperties()
public java.util.Map<java.lang.String,java.lang.String> getCustomModProperties(java.lang.String modId)
boolean checkRemoteModList(java.util.Map<java.lang.String,java.lang.String> modList, Side side)
public void fireRemapEvent(java.util.Map<ResourceLocation,java.util.Map<ResourceLocation,java.lang.Integer[]>> remaps, boolean isFreezing)
public void runtimeDisableMod(java.lang.String modId)
public void loadingComplete()
private void readInjectedDependencies()
java.util.List<ArtifactVersion> getInjectedBefore(java.lang.String modId)
java.util.List<ArtifactVersion> getInjectedAfter(java.lang.String modId)
public final LoaderState getLoaderState()
public void setActiveModContainer(@Nullable ModContainer container)