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.mojang:authlib:1.5.16"
"name": "com.mojang:authlib:1.5.21"
},
{
"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 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.FMLLoadEvent;
import cpw.mods.fml.common.event.FMLModDisabledEvent;
@ -182,10 +183,16 @@ public class LoadController
{
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)
{
bar.step("mod: "+mc.getName());
sendEventToModContainer(stateEvent, mc);
}
ProgressManager.pop(bar);
}
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.ModContainer.Disableable;
import cpw.mods.fml.common.ProgressManager.ProgressBar;
import cpw.mods.fml.common.discovery.ModDiscoverer;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLLoadEvent;
@ -152,6 +153,7 @@ public class Loader
private ImmutableMap<String, String> fmlBrandingProperties;
private File forcedModFile;
private ModDiscoverer discoverer;
private ProgressBar progressBar;
public static Loader instance()
{
@ -460,6 +462,8 @@ public class Loader
*/
public void loadMods()
{
progressBar = ProgressManager.push("FML", 5);
progressBar.step("Constructing");
initializeLoader();
mods = Lists.newArrayList();
namedMods = Maps.newHashMap();
@ -499,6 +503,7 @@ public class Loader
{
FMLLog.fine("No user mod signature data found");
}
progressBar.step("Preinitialization");
modController.transition(LoaderState.PREINITIALIZATION, false);
}
@ -512,6 +517,7 @@ public class Loader
ObjectHolderRegistry.INSTANCE.findObjectHolders(discoverer.getASMTable());
modController.distributeStateMessage(LoaderState.PREINITIALIZATION, discoverer.getASMTable(), canonicalConfigDir);
ObjectHolderRegistry.INSTANCE.applyObjectHolders();
progressBar.step("Initialization");
modController.transition(LoaderState.INITIALIZATION, false);
}
@ -689,15 +695,19 @@ public class Loader
{
// Mod controller should be in the initialization state here
modController.distributeStateMessage(LoaderState.INITIALIZATION);
progressBar.step("Postinitialization");
modController.transition(LoaderState.POSTINITIALIZATION, false);
modController.distributeStateMessage(FMLInterModComms.IMCEvent.class);
modController.distributeStateMessage(LoaderState.POSTINITIALIZATION);
progressBar.step("Finishing up");
modController.transition(LoaderState.AVAILABLE, false);
modController.distributeStateMessage(LoaderState.AVAILABLE);
GameData.freezeData();
// Dump the custom registry data map, if necessary
GameData.dumpRegistry(minecraftDir);
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()