Expose the state of the loader

This commit is contained in:
cpw 2015-05-07 14:17:45 -04:00
parent c28794fe38
commit 76c7177553
2 changed files with 16 additions and 6 deletions

View file

@ -150,8 +150,8 @@ public class LoadController
else else
{ {
FMLLog.severe("The ForgeModLoader state engine has become corrupted. Probably, a state was missed by and invalid modification to a base class" + 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 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, especially Optifine, to see if there are fixes available.");
throw new RuntimeException("The ForgeModLoader state engine is invalid"); throw new RuntimeException("The ForgeModLoader state engine is invalid");
} }
if (toThrow != null && toThrow instanceof RuntimeException) if (toThrow != null && toThrow instanceof RuntimeException)
@ -311,9 +311,9 @@ public class LoadController
return this.state == state; return this.state == state;
} }
boolean hasReachedState(LoaderState state) { boolean hasReachedState(LoaderState state) {
return this.state.ordinal()>=state.ordinal() && this.state!=LoaderState.ERRORED; return this.state.ordinal()>=state.ordinal() && this.state!=LoaderState.ERRORED;
} }
void forceState(LoaderState newState) void forceState(LoaderState newState)
{ {
@ -352,4 +352,9 @@ public class LoadController
{ {
return accessibleManager.getStackClasses(); return accessibleManager.getStackClasses();
} }
LoaderState getState()
{
return state;
}
} }

View file

@ -681,7 +681,7 @@ public class Loader
// before elements are things we are loaded before (so they are our dependants) // before elements are things we are loaded before (so they are our dependants)
if ("required-before".equals(instruction) || "before".equals(instruction)) 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) // after elements are things that load before we do (so they are out dependencies)
else if ("required-after".equals(instruction) || "after".equals(instruction)) else if ("required-after".equals(instruction) || "after".equals(instruction))
@ -1060,4 +1060,9 @@ public class Loader
{ {
return injectedAfter.get(modId); return injectedAfter.get(modId);
} }
public final LoaderState getLoaderState()
{
return modController != null ? modController.getState() : LoaderState.NOINIT;
}
} }