diff --git a/fml/src/main/java/cpw/mods/fml/client/FMLClientHandler.java b/fml/src/main/java/cpw/mods/fml/client/FMLClientHandler.java index fdf969746..46475e8c8 100644 --- a/fml/src/main/java/cpw/mods/fml/client/FMLClientHandler.java +++ b/fml/src/main/java/cpw/mods/fml/client/FMLClientHandler.java @@ -229,7 +229,25 @@ public class FMLClientHandler implements IFMLSidedHandler haltGame("There was a severe problem during mod loading that has caused the game to fail", le); return; } + finally + { + client.refreshResources(); + } + try + { + Loader.instance().preinitializeMods(); + } + catch (CustomModLoadingErrorDisplayException custom) + { + FMLLog.log(Level.ERROR, custom, "A custom exception was thrown by a mod, the game will now halt"); + customError = custom; + } + catch (LoaderException le) + { + haltGame("There was a severe problem during mod loading that has caused the game to fail", le); + return; + } Map> sharedModList = (Map>) Launch.blackboard.get("modList"); if (sharedModList == null) { @@ -566,12 +584,6 @@ public class FMLClientHandler implements IFMLSidedHandler } } - @Override - public void updateResourcePackList() - { - client.refreshResources(); - } - public IResourcePack getResourcePackFor(String modId) { return resourcePackMap.get(modId); @@ -813,7 +825,7 @@ public class FMLClientHandler implements IFMLSidedHandler public void setPlayClient(NetHandlerPlayClient netHandlerPlayClient) { playClientBlock.countDown(); - this.currentPlayClient = new WeakReference(netHandlerPlayClient); + this.currentPlayClient = new WeakReference(netHandlerPlayClient); } @Override diff --git a/fml/src/main/java/cpw/mods/fml/common/FMLCommonHandler.java b/fml/src/main/java/cpw/mods/fml/common/FMLCommonHandler.java index 44d563e01..906e8d45a 100644 --- a/fml/src/main/java/cpw/mods/fml/common/FMLCommonHandler.java +++ b/fml/src/main/java/cpw/mods/fml/common/FMLCommonHandler.java @@ -514,11 +514,6 @@ public class FMLCommonHandler sidedDelegate.addModAsResource(container); } - public void updateResourcePackList() - { - sidedDelegate.updateResourcePackList(); - } - public String getCurrentLanguage() { diff --git a/fml/src/main/java/cpw/mods/fml/common/IFMLSidedHandler.java b/fml/src/main/java/cpw/mods/fml/common/IFMLSidedHandler.java index 0d4cf8b39..3ab8795eb 100644 --- a/fml/src/main/java/cpw/mods/fml/common/IFMLSidedHandler.java +++ b/fml/src/main/java/cpw/mods/fml/common/IFMLSidedHandler.java @@ -46,8 +46,6 @@ public interface IFMLSidedHandler void addModAsResource(ModContainer container); - void updateResourcePackList(); - String getCurrentLanguage(); void serverStopped(); diff --git a/fml/src/main/java/cpw/mods/fml/common/LoadController.java b/fml/src/main/java/cpw/mods/fml/common/LoadController.java index bbee723ab..6c8b91576 100644 --- a/fml/src/main/java/cpw/mods/fml/common/LoadController.java +++ b/fml/src/main/java/cpw/mods/fml/common/LoadController.java @@ -109,7 +109,6 @@ public class LoadController } eventChannels = eventBus.build(); - FMLCommonHandler.instance().updateResourcePackList(); } public void distributeStateMessage(LoaderState state, Object... eventData) diff --git a/fml/src/main/java/cpw/mods/fml/common/Loader.java b/fml/src/main/java/cpw/mods/fml/common/Loader.java index 8320dbfda..1a14f91c2 100644 --- a/fml/src/main/java/cpw/mods/fml/common/Loader.java +++ b/fml/src/main/java/cpw/mods/fml/common/Loader.java @@ -148,6 +148,7 @@ public class Loader private static List injectedContainers; private ImmutableMap fmlBrandingProperties; private File forcedModFile; + private ModDiscoverer discoverer; public static Loader instance() { @@ -462,15 +463,15 @@ public class Loader namedMods = Maps.newHashMap(); modController = new LoadController(this); modController.transition(LoaderState.LOADING, false); - ModDiscoverer disc = identifyMods(); - ModAPIManager.INSTANCE.manageAPI(modClassLoader, disc); + discoverer = identifyMods(); + ModAPIManager.INSTANCE.manageAPI(modClassLoader, discoverer); disableRequestedMods(); modController.distributeStateMessage(FMLLoadEvent.class); sortModList(); ModAPIManager.INSTANCE.cleanupAPIContainers(modController.getActiveModList()); ModAPIManager.INSTANCE.cleanupAPIContainers(mods); mods = ImmutableList.copyOf(mods); - for (File nonMod : disc.getNonModLibs()) + for (File nonMod : discoverer.getNonModLibs()) { if (nonMod.isFile()) { @@ -486,7 +487,7 @@ public class Loader } } modController.transition(LoaderState.CONSTRUCTING, false); - modController.distributeStateMessage(LoaderState.CONSTRUCTING, modClassLoader, disc.getASMTable(), reverseDependencies); + modController.distributeStateMessage(LoaderState.CONSTRUCTING, modClassLoader, discoverer.getASMTable(), reverseDependencies); FMLLog.fine("Mod signature data"); for (ModContainer mod : getActiveModList()) { @@ -497,7 +498,11 @@ public class Loader FMLLog.fine("No user mod signature data found"); } modController.transition(LoaderState.PREINITIALIZATION, false); - modController.distributeStateMessage(LoaderState.PREINITIALIZATION, disc.getASMTable(), canonicalConfigDir); + } + + public void preinitializeMods() + { + modController.distributeStateMessage(LoaderState.PREINITIALIZATION, discoverer.getASMTable(), canonicalConfigDir); modController.transition(LoaderState.INITIALIZATION, false); } diff --git a/fml/src/main/java/cpw/mods/fml/server/FMLServerHandler.java b/fml/src/main/java/cpw/mods/fml/server/FMLServerHandler.java index 5dfcc3ad5..3692c6644 100644 --- a/fml/src/main/java/cpw/mods/fml/server/FMLServerHandler.java +++ b/fml/src/main/java/cpw/mods/fml/server/FMLServerHandler.java @@ -85,6 +85,7 @@ public class FMLServerHandler implements IFMLSidedHandler { server = minecraftServer; Loader.instance().loadMods(); + Loader.instance().preinitializeMods(); } /** @@ -220,11 +221,6 @@ public class FMLServerHandler implements IFMLSidedHandler LanguageRegistry.instance().loadLanguagesFor(container, Side.SERVER); } - @Override - public void updateResourcePackList() - { - - } @Override public String getCurrentLanguage() {