Attempt to disable the new splash screen if there are errors detected finishing up. Print a slightly more helpful error message.
This commit is contained in:
parent
89994bda39
commit
e3211eec04
2 changed files with 59 additions and 5 deletions
|
@ -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())
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue