Fix CustomModLoadingErrorDisplayScreen not being handled during init or preinit. (#4320)

This commit is contained in:
Benjamin K authored and LexManos committed 2017-09-06 14:14:50 -07:00
1 parent dadc715e7d
commit 45c2ff5329
3 files changed
+78 -22

No files matched your search

@@ -265,16 +265,21 @@ public class FMLClientHandler implements IFMLSidedHandler
{
Loader.instance().preinitializeMods();
}
catch (CustomModLoadingErrorDisplayException custom)
{
FMLLog.log.error("A custom exception was thrown by a mod, the game will now halt", custom);
customError = custom;
}
catch (LoaderException le)
{
haltGame("There was a severe problem during mod loading that has caused the game to fail", le);
return;
if (le.getCause() instanceof CustomModLoadingErrorDisplayException)
{
CustomModLoadingErrorDisplayException custom = (CustomModLoadingErrorDisplayException) le.getCause();
FMLLog.log.error("A custom exception was thrown by a mod, the game will now halt", custom);
customError = custom;
}
else
{
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)
{
@@ -342,17 +347,19 @@ public class FMLClientHandler implements IFMLSidedHandler
{
Loader.instance().initializeMods();
}
catch (CustomModLoadingErrorDisplayException custom)
{
FMLLog.log.error("A custom exception was thrown by a mod, the game will now halt", custom);
customError = custom;
SplashProgress.finish();
return;
}
catch (LoaderException le)
{
haltGame("There was a severe problem during mod loading that has caused the game to fail", le);
return;
if (le.getCause() instanceof CustomModLoadingErrorDisplayException)
{
CustomModLoadingErrorDisplayException custom = (CustomModLoadingErrorDisplayException) le.getCause();
FMLLog.log.error("A custom exception was thrown by a mod, the game will now halt", custom);
customError = custom;
}
else
{
haltGame("There was a severe problem during mod loading that has caused the game to fail", le);
return;
}
}
// This call is being phased out for performance reasons in 1.12,
@@ -390,7 +397,8 @@ public class FMLClientHandler implements IFMLSidedHandler
}
loading = false;
client.gameSettings.loadOptions(); //Reload options to load any mod added keybindings.
Loader.instance().loadingComplete();
if (customError == null)
Loader.instance().loadingComplete();
SplashProgress.finish();
}
@@ -19,27 +19,24 @@
package net.minecraftforge.fml.client;
import net.minecraft.client.gui.GuiErrorScreen;
public class GuiCustomModLoadingErrorScreen extends GuiErrorScreen
public class GuiCustomModLoadingErrorScreen extends GuiErrorBase
{
private CustomModLoadingErrorDisplayException customException;
public GuiCustomModLoadingErrorScreen(CustomModLoadingErrorDisplayException customException)
{
super(null,null);
this.customException = customException;
}
@Override
public void initGui()
{
super.initGui();
this.buttonList.clear();
this.customException.initGui(this, fontRenderer);
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
this.drawDefaultBackground();
super.drawScreen(mouseX, mouseY, partialTicks);
this.customException.drawScreen(this, fontRenderer, mouseX, mouseY, partialTicks);
}
}