Split loadmods into loadmods and preinitmods, to allow resource loading to occur *always* between the two phases. This should fix
mods not being able to access resources during preinit. PS: I'm still not modding.
This commit is contained in:
parent
0b795b8bab
commit
b286cb6a57
6 changed files with 30 additions and 25 deletions
|
@ -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<String,Map<String,String>> sharedModList = (Map<String, Map<String, String>>) 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>(netHandlerPlayClient);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -514,11 +514,6 @@ public class FMLCommonHandler
|
|||
sidedDelegate.addModAsResource(container);
|
||||
}
|
||||
|
||||
public void updateResourcePackList()
|
||||
{
|
||||
sidedDelegate.updateResourcePackList();
|
||||
}
|
||||
|
||||
public String getCurrentLanguage()
|
||||
{
|
||||
|
||||
|
|
|
@ -46,8 +46,6 @@ public interface IFMLSidedHandler
|
|||
|
||||
void addModAsResource(ModContainer container);
|
||||
|
||||
void updateResourcePackList();
|
||||
|
||||
String getCurrentLanguage();
|
||||
|
||||
void serverStopped();
|
||||
|
|
|
@ -109,7 +109,6 @@ public class LoadController
|
|||
}
|
||||
|
||||
eventChannels = eventBus.build();
|
||||
FMLCommonHandler.instance().updateResourcePackList();
|
||||
}
|
||||
|
||||
public void distributeStateMessage(LoaderState state, Object... eventData)
|
||||
|
|
|
@ -148,6 +148,7 @@ public class Loader
|
|||
private static List<String> injectedContainers;
|
||||
private ImmutableMap<String, String> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue