Skip to content
This repository has been archived by the owner on May 26, 2018. It is now read-only.

Commit

Permalink
Expose the state of the loader
Browse files Browse the repository at this point in the history
  • Loading branch information
cpw committed May 7, 2015
1 parent 450b82c commit 0b84b6a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
15 changes: 10 additions & 5 deletions src/main/java/cpw/mods/fml/common/LoadController.java
Expand Up @@ -150,8 +150,8 @@ else if (toThrow == null)
else
{
FMLLog.severe("The ForgeModLoader state engine has become corrupted. Probably, a state was missed by and invalid modification to a base class" +
"ForgeModLoader depends on. This is a critical error and not recoverable. Investigate any modifications to base classes outside of" +
"ForgeModLoader, especially Optifine, to see if there are fixes available.");
"ForgeModLoader depends on. This is a critical error and not recoverable. Investigate any modifications to base classes outside of" +
"ForgeModLoader, especially Optifine, to see if there are fixes available.");
throw new RuntimeException("The ForgeModLoader state engine is invalid");
}
if (toThrow != null && toThrow instanceof RuntimeException)
Expand Down Expand Up @@ -311,9 +311,9 @@ public boolean isInState(LoaderState state)
return this.state == state;
}

boolean hasReachedState(LoaderState state) {
return this.state.ordinal()>=state.ordinal() && this.state!=LoaderState.ERRORED;
}
boolean hasReachedState(LoaderState state) {
return this.state.ordinal()>=state.ordinal() && this.state!=LoaderState.ERRORED;
}

void forceState(LoaderState newState)
{
Expand Down Expand Up @@ -352,4 +352,9 @@ Class<?>[] getCallingStack()
{
return accessibleManager.getStackClasses();
}

LoaderState getState()
{
return state;
}
}
7 changes: 6 additions & 1 deletion src/main/java/cpw/mods/fml/common/Loader.java
Expand Up @@ -681,7 +681,7 @@ public void computeDependencies(String dependencyString, Set<ArtifactVersion> re
// before elements are things we are loaded before (so they are our dependants)
if ("required-before".equals(instruction) || "before".equals(instruction))
{
dependants.add(VersionParser.parseVersionReference(target));
dependants.add(VersionParser.parseVersionReference(target));
}
// after elements are things that load before we do (so they are out dependencies)
else if ("required-after".equals(instruction) || "after".equals(instruction))
Expand Down Expand Up @@ -1060,4 +1060,9 @@ List<ArtifactVersion> getInjectedAfter(String modId)
{
return injectedAfter.get(modId);
}

public final LoaderState getLoaderState()
{
return modController != null ? modController.getState() : LoaderState.NOINIT;
}
}

0 comments on commit 0b84b6a

Please sign in to comment.