Add in a pretty sorting error screen

This commit is contained in:
Christian 2013-05-27 10:28:00 -04:00
parent e3cd509b9a
commit 8be20d6805
2 changed files with 61 additions and 2 deletions

View file

@ -71,6 +71,7 @@ import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
import cpw.mods.fml.common.registry.IThrowableEntity; import cpw.mods.fml.common.registry.IThrowableEntity;
import cpw.mods.fml.common.registry.ItemData; import cpw.mods.fml.common.registry.ItemData;
import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.common.toposort.ModSortingException;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -113,6 +114,8 @@ public class FMLClientHandler implements IFMLSidedHandler
private MissingModsException modsMissing; private MissingModsException modsMissing;
private ModSortingException modSorting;
private boolean loading; private boolean loading;
private WrongMinecraftVersionException wrongMC; private WrongMinecraftVersionException wrongMC;
@ -171,6 +174,10 @@ public class FMLClientHandler implements IFMLSidedHandler
{ {
modsMissing = missing; modsMissing = missing;
} }
catch (ModSortingException sorting)
{
modSorting = sorting;
}
catch (CustomModLoadingErrorDisplayException custom) catch (CustomModLoadingErrorDisplayException custom)
{ {
FMLLog.log(Level.SEVERE, custom, "A custom exception was thrown by a mod, the game will now halt"); FMLLog.log(Level.SEVERE, custom, "A custom exception was thrown by a mod, the game will now halt");
@ -197,7 +204,7 @@ public class FMLClientHandler implements IFMLSidedHandler
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void finishMinecraftLoading() public void finishMinecraftLoading()
{ {
if (modsMissing != null || wrongMC != null || customError!=null || dupesFound!=null) if (modsMissing != null || wrongMC != null || customError!=null || dupesFound!=null || modSorting!=null)
{ {
return; return;
} }
@ -237,7 +244,11 @@ public class FMLClientHandler implements IFMLSidedHandler
{ {
client.func_71373_a(new GuiDupesFound(dupesFound)); client.func_71373_a(new GuiDupesFound(dupesFound));
} }
else if (customError != null) else if (modSorting != null)
{
client.func_71373_a(new GuiSortingProblem(modSorting));
}
else if (customError != null)
{ {
client.func_71373_a(new GuiCustomModLoadingErrorScreen(customError)); client.func_71373_a(new GuiCustomModLoadingErrorScreen(customError));
} }

View file

@ -0,0 +1,48 @@
package cpw.mods.fml.client;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.toposort.ModSortingException;
import cpw.mods.fml.common.toposort.ModSortingException.SortingExceptionData;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
import net.minecraft.client.gui.GuiScreen;
public class GuiSortingProblem extends GuiScreen {
private ModSortingException modSorting;
private SortingExceptionData<ModContainer> failedList;
public GuiSortingProblem(ModSortingException modSorting)
{
this.modSorting = modSorting;
this.failedList = modSorting.getExceptionData();
}
@Override
public void func_73866_w_()
{
super.func_73866_w_();
}
@Override
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
{
this.func_73873_v_();
int offset = Math.max(85 - (failedList.getVisitedNodes().size() + 3) * 10, 10);
this.func_73732_a(this.field_73886_k, "Forge Mod Loader has found a problem with your minecraft installation", this.field_73880_f / 2, offset, 0xFFFFFF);
offset+=10;
this.func_73732_a(this.field_73886_k, "A mod sorting cycle was detected and loading cannot continue", this.field_73880_f / 2, offset, 0xFFFFFF);
offset+=10;
this.func_73732_a(this.field_73886_k, String.format("The first mod in the cycle is %s", failedList.getFirstBadNode()), this.field_73880_f / 2, offset, 0xFFFFFF);
offset+=10;
this.func_73732_a(this.field_73886_k, "The remainder of the cycle involves these mods", this.field_73880_f / 2, offset, 0xFFFFFF);
offset+=5;
for (ModContainer mc : failedList.getVisitedNodes())
{
offset+=10;
this.func_73732_a(this.field_73886_k, String.format("%s", mc.toString()), this.field_73880_f / 2, offset, 0xEEEEEE);
}
offset+=20;
this.func_73732_a(this.field_73886_k, "The file 'ForgeModLoader-client-0.log' contains more information", this.field_73880_f / 2, offset, 0xFFFFFF);
}
}