diff --git a/fml/src/main/java/net/minecraftforge/fml/client/SplashProgress.java b/fml/src/main/java/net/minecraftforge/fml/client/SplashProgress.java index 7f53da627..5370c230d 100644 --- a/fml/src/main/java/net/minecraftforge/fml/client/SplashProgress.java +++ b/fml/src/main/java/net/minecraftforge/fml/client/SplashProgress.java @@ -79,6 +79,8 @@ import net.minecraft.client.resources.IResourcePack; import net.minecraft.crash.CrashReport; import net.minecraft.launchwrapper.Launch; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.EnhancedRuntimeException; +import net.minecraftforge.fml.common.EnhancedRuntimeException.WrappedPrintStream; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.ICrashCallable; @@ -536,10 +538,62 @@ public class SplashProgress catch (Exception e) { e.printStackTrace(); - throw new RuntimeException(e); + if (disableSplash()) + { + throw new EnhancedRuntimeException(e) + { + @Override + protected void printStackTrace(WrappedPrintStream stream) + { + stream.println("SplashProgress has detected a error loading Minecraft."); + stream.println("This can sometimes be caused by bad video drivers."); + stream.println("We have automatically disabeled the new Splash Screen in config/splash.properties."); + stream.println("Try reloading minecraft before reporting any errors."); + } + }; + } + else + { + throw new EnhancedRuntimeException(e) + { + @Override + protected void printStackTrace(WrappedPrintStream stream) + { + stream.println("SplashProgress has detected a error loading Minecraft."); + stream.println("This can sometimes be caused by bad video drivers."); + stream.println("Please try disabeling the new Splash Screen in config/splash.properties."); + stream.println("After doing so, try reloading minecraft before reporting any errors."); + } + }; + } } } + private static boolean disableSplash() + { + File configFile = new File(Minecraft.getMinecraft().mcDataDir, "config/splash.properties"); + FileReader r = null; + enabled = false; + config.setProperty("enabled", "false"); + + FileWriter w = null; + try + { + w = new FileWriter(configFile); + config.store(w, "Splash screen properties"); + } + catch(IOException e) + { + FMLLog.log(Level.ERROR, e, "Could not save the splash.properties file"); + return false; + } + finally + { + IOUtils.closeQuietly(w); + } + return true; + } + private static IResourcePack createResourcePack(File file) { if(file.isDirectory()) diff --git a/fml/src/main/java/net/minecraftforge/fml/common/EnhancedRuntimeException.java b/fml/src/main/java/net/minecraftforge/fml/common/EnhancedRuntimeException.java index a52ddf845..553f6804d 100644 --- a/fml/src/main/java/net/minecraftforge/fml/common/EnhancedRuntimeException.java +++ b/fml/src/main/java/net/minecraftforge/fml/common/EnhancedRuntimeException.java @@ -44,7 +44,7 @@ public abstract class EnhancedRuntimeException extends RuntimeException this.printStackTrace(new WrappedPrintStream() { @Override - void println(String line) + public void println(String line) { buf.append(line).append('\n'); } @@ -60,7 +60,7 @@ public abstract class EnhancedRuntimeException extends RuntimeException printStackTrace(new WrappedPrintStream() { @Override - void println(String line) + public void println(String line) { s.println(line); } @@ -72,7 +72,7 @@ public abstract class EnhancedRuntimeException extends RuntimeException printStackTrace(new WrappedPrintStream() { @Override - void println(String line) + public void println(String line) { s.println(line); } @@ -84,6 +84,6 @@ public abstract class EnhancedRuntimeException extends RuntimeException public static abstract class WrappedPrintStream { - abstract void println(String line); + public abstract void println(String line); } }