Call some loader stuffs

This commit is contained in:
cpw 2015-04-20 23:34:36 -04:00
parent 8c54026f2d
commit 6398961c48
3 changed files with 18 additions and 1 deletions

View file

@ -74,7 +74,7 @@
"name": "com.google.code.gson:gson:2.2.4" "name": "com.google.code.gson:gson:2.2.4"
}, },
{ {
"name": "com.mojang:authlib:1.5.16" "name": "com.mojang:authlib:1.5.21"
}, },
{ {
"name": "org.apache.logging.log4j:log4j-api:2.0-beta9" "name": "org.apache.logging.log4j:log4j-api:2.0-beta9"

View file

@ -37,6 +37,7 @@ import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe; import com.google.common.eventbus.Subscribe;
import cpw.mods.fml.common.LoaderState.ModState; import cpw.mods.fml.common.LoaderState.ModState;
import cpw.mods.fml.common.ProgressManager.ProgressBar;
import cpw.mods.fml.common.event.FMLEvent; import cpw.mods.fml.common.event.FMLEvent;
import cpw.mods.fml.common.event.FMLLoadEvent; import cpw.mods.fml.common.event.FMLLoadEvent;
import cpw.mods.fml.common.event.FMLModDisabledEvent; import cpw.mods.fml.common.event.FMLModDisabledEvent;
@ -182,10 +183,16 @@ public class LoadController
{ {
modObjectList = buildModObjectList(); modObjectList = buildModObjectList();
} }
String event = stateEvent.toString();
event = event.substring(event.lastIndexOf('.') + 1);
event = event.substring(0, event.indexOf('@'));
ProgressBar bar = ProgressManager.push(event + " propagation", activeModList.size());
for (ModContainer mc : activeModList) for (ModContainer mc : activeModList)
{ {
bar.step("mod: "+mc.getName());
sendEventToModContainer(stateEvent, mc); sendEventToModContainer(stateEvent, mc);
} }
ProgressManager.pop(bar);
} }
private void sendEventToModContainer(FMLEvent stateEvent, ModContainer mc) private void sendEventToModContainer(FMLEvent stateEvent, ModContainer mc)

View file

@ -53,6 +53,7 @@ import com.google.common.collect.TreeMultimap;
import cpw.mods.fml.common.LoaderState.ModState; import cpw.mods.fml.common.LoaderState.ModState;
import cpw.mods.fml.common.ModContainer.Disableable; import cpw.mods.fml.common.ModContainer.Disableable;
import cpw.mods.fml.common.ProgressManager.ProgressBar;
import cpw.mods.fml.common.discovery.ModDiscoverer; import cpw.mods.fml.common.discovery.ModDiscoverer;
import cpw.mods.fml.common.event.FMLInterModComms; import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLLoadEvent; import cpw.mods.fml.common.event.FMLLoadEvent;
@ -152,6 +153,7 @@ public class Loader
private ImmutableMap<String, String> fmlBrandingProperties; private ImmutableMap<String, String> fmlBrandingProperties;
private File forcedModFile; private File forcedModFile;
private ModDiscoverer discoverer; private ModDiscoverer discoverer;
private ProgressBar progressBar;
public static Loader instance() public static Loader instance()
{ {
@ -460,6 +462,8 @@ public class Loader
*/ */
public void loadMods() public void loadMods()
{ {
progressBar = ProgressManager.push("FML", 5);
progressBar.step("Constructing");
initializeLoader(); initializeLoader();
mods = Lists.newArrayList(); mods = Lists.newArrayList();
namedMods = Maps.newHashMap(); namedMods = Maps.newHashMap();
@ -499,6 +503,7 @@ public class Loader
{ {
FMLLog.fine("No user mod signature data found"); FMLLog.fine("No user mod signature data found");
} }
progressBar.step("Preinitialization");
modController.transition(LoaderState.PREINITIALIZATION, false); modController.transition(LoaderState.PREINITIALIZATION, false);
} }
@ -512,6 +517,7 @@ public class Loader
ObjectHolderRegistry.INSTANCE.findObjectHolders(discoverer.getASMTable()); ObjectHolderRegistry.INSTANCE.findObjectHolders(discoverer.getASMTable());
modController.distributeStateMessage(LoaderState.PREINITIALIZATION, discoverer.getASMTable(), canonicalConfigDir); modController.distributeStateMessage(LoaderState.PREINITIALIZATION, discoverer.getASMTable(), canonicalConfigDir);
ObjectHolderRegistry.INSTANCE.applyObjectHolders(); ObjectHolderRegistry.INSTANCE.applyObjectHolders();
progressBar.step("Initialization");
modController.transition(LoaderState.INITIALIZATION, false); modController.transition(LoaderState.INITIALIZATION, false);
} }
@ -689,15 +695,19 @@ public class Loader
{ {
// Mod controller should be in the initialization state here // Mod controller should be in the initialization state here
modController.distributeStateMessage(LoaderState.INITIALIZATION); modController.distributeStateMessage(LoaderState.INITIALIZATION);
progressBar.step("Postinitialization");
modController.transition(LoaderState.POSTINITIALIZATION, false); modController.transition(LoaderState.POSTINITIALIZATION, false);
modController.distributeStateMessage(FMLInterModComms.IMCEvent.class); modController.distributeStateMessage(FMLInterModComms.IMCEvent.class);
modController.distributeStateMessage(LoaderState.POSTINITIALIZATION); modController.distributeStateMessage(LoaderState.POSTINITIALIZATION);
progressBar.step("Finishing up");
modController.transition(LoaderState.AVAILABLE, false); modController.transition(LoaderState.AVAILABLE, false);
modController.distributeStateMessage(LoaderState.AVAILABLE); modController.distributeStateMessage(LoaderState.AVAILABLE);
GameData.freezeData(); GameData.freezeData();
// Dump the custom registry data map, if necessary // Dump the custom registry data map, if necessary
GameData.dumpRegistry(minecraftDir); GameData.dumpRegistry(minecraftDir);
FMLLog.info("Forge Mod Loader has successfully loaded %d mod%s", mods.size(), mods.size() == 1 ? "" : "s"); FMLLog.info("Forge Mod Loader has successfully loaded %d mod%s", mods.size(), mods.size() == 1 ? "" : "s");
ProgressManager.pop(progressBar);
progressBar = null;
} }
public ICrashCallable getCallableCrashInformation() public ICrashCallable getCallableCrashInformation()