More reporting on old APIs on crashes

* Re-added AE2 rv1; it can be pulled in by other mods than AE2
* Added old RF API; e.g. via Buildcraft
* Added source of the bad APIs to the message
* Fixed conditional plural wording in messages
This commit is contained in:
HenryLoenwind committed 2015-09-08 13:54:05 +02:00
1 parent 3e25064d38
commit 437f767a3c
1 file changed
+32 -9
@@ -14,37 +14,60 @@ import crazypants.enderio.EnderIO;
public class EnderIOCrashCallable implements ICrashCallable {
private static boolean hasOptifine = false;
private static boolean hasUnknownAE2 = false;
private static String hasUnknownAE2 = null;
private static String hasOldAE2 = null;
private static String hasOldRF = null;
public static void create() {
boolean register = false;
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
hasOptifine = FMLClientHandler.instance().hasOptifine();
register = hasOptifine = FMLClientHandler.instance().hasOptifine();
}
for (ModContainer modContainer : ModAPIManager.INSTANCE.getAPIList()) {
if ("appliedenergistics2|API".equals(modContainer.getModId())) {
if (!"rv2".equals(modContainer.getVersion())) {
hasUnknownAE2 = true;
if ("rv1".equals(modContainer.getVersion())) {
hasOldAE2 = modContainer.getVersion() + " from " + modContainer.getSource().getName();
register = true;
} else if (!"rv2".equals(modContainer.getVersion())) {
hasUnknownAE2 = modContainer.getVersion() + " from " + modContainer.getSource().getName();
register = true;
}
} else if ("CoFHAPI|energy".equals(modContainer.getModId())) {
if ("1.7.10R1.0.0".equals(modContainer.getVersion()) || "1.7.10R1.0.1".equals(modContainer.getVersion())) {
hasOldRF = modContainer.getVersion() + " from " + modContainer.getSource().getName();
register = true;
}
}
}
if (hasOptifine || hasUnknownAE2) {
if (register) {
FMLCommonHandler.instance().registerCrashCallable(new EnderIOCrashCallable());
}
throw new RuntimeException("foo");
}
@Override
public String call() throws Exception {
String msg = "Found the following problems with your installation: ";
String msg = "Found the following problem(s) with your installation: ";
if (hasOptifine) {
msg += "\"Optifine is installed. This is NOT supported.\" ";
}
if (hasUnknownAE2) {
msg += "\"An unknown AE2 API is installed. Ender IO was build against API version rv2.\" ";
if (hasOldRF != null) {
msg += "\"An unsupportted old RF API is installed (" + hasOldRF
+ "). Ender IO needs at least 1.7.10R1.0.2 and will NOT work with older versions.\" ";
}
msg += "This may have caused the error. Try reproducing the crash WITHOUT this/these mods before reporting it.";
if (hasOldAE2 != null) {
msg += "\"An unsupportted old AE2 API is installed (" + hasOldAE2
+ "). Ender IO was build against API version rv2 and will NOT work with older versions.\" ";
}
if (hasUnknownAE2 != null) {
msg += "\"An unknown AE2 API is installed (" + hasUnknownAE2
+ "). Ender IO was build against API version rv2.\" ";
}
msg += "This may have caused the error. Try reproducing the crash WITHOUT this/these mod(s) before reporting it.";
return msg;
}