    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005    import java.awt.BorderLayout;
    006    import java.awt.Color;
    007    import java.awt.Font;
    008    import java.awt.Panel;
    009    import java.awt.TextArea;
    010    import java.io.File;
    011    import java.io.PrintWriter;
    012    import java.io.StringWriter;
    013    import java.text.SimpleDateFormat;
    014    import java.util.Date;
    015    import net.minecraft.client.Minecraft;
    016    import org.lwjgl.opengl.GL11;
    017
    018    @SideOnly(Side.CLIENT)
    019    public class PanelCrashReport extends Panel
    020    {
    021        public PanelCrashReport(CrashReport par1CrashReport)
    022        {
    023            this.setBackground(new Color(3028036));
    024            this.setLayout(new BorderLayout());
    025            StringWriter var2 = new StringWriter();
    026            par1CrashReport.getCrashCause().printStackTrace(new PrintWriter(var2));
    027            String var3 = var2.toString();
    028            String var4 = "";
    029            String var5 = "";
    030
    031            try
    032            {
    033                var5 = var5 + "Generated " + (new SimpleDateFormat()).format(new Date()) + "\n";
    034                var5 = var5 + "\n";
    035                var5 = var5 + par1CrashReport.func_90021_c();
    036                var4 = GL11.glGetString(GL11.GL_VENDOR);
    037            }
    038            catch (Throwable var9)
    039            {
    040                var5 = var5 + "[failed to get system properties (" + var9 + ")]\n";
    041            }
    042
    043            var5 = var5 + "\n\n";
    044            var5 = var5 + var3;
    045            String var6 = "";
    046            var6 = var6 + "\n";
    047            var6 = var6 + "\n";
    048
    049            if (var3.contains("Pixel format not accelerated"))
    050            {
    051                var6 = var6 + "      Bad video card drivers!      \n";
    052                var6 = var6 + "      -----------------------      \n";
    053                var6 = var6 + "\n";
    054                var6 = var6 + "Minecraft was unable to start because it failed to find an accelerated OpenGL mode.\n";
    055                var6 = var6 + "This can usually be fixed by updating the video card drivers.\n";
    056
    057                if (var4.toLowerCase().contains("nvidia"))
    058                {
    059                    var6 = var6 + "\n";
    060                    var6 = var6 + "You might be able to find drivers for your video card here:\n";
    061                    var6 = var6 + "  http://www.nvidia.com/\n";
    062                }
    063                else if (var4.toLowerCase().contains("ati"))
    064                {
    065                    var6 = var6 + "\n";
    066                    var6 = var6 + "You might be able to find drivers for your video card here:\n";
    067                    var6 = var6 + "  http://www.amd.com/\n";
    068                }
    069            }
    070            else
    071            {
    072                var6 = var6 + "      Minecraft has crashed!      \n";
    073                var6 = var6 + "      ----------------------      \n";
    074                var6 = var6 + "\n";
    075                var6 = var6 + "Minecraft has stopped running because it encountered a problem; " + par1CrashReport.getDescription() + "\n\n";
    076                File var7 = par1CrashReport.getFile();
    077
    078                if (var7 == null)
    079                {
    080                    par1CrashReport.saveToFile(new File(new File(Minecraft.getMinecraftDir(), "crash-reports"), "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt"));
    081                    var7 = par1CrashReport.getFile();
    082                }
    083
    084                if (var7 != null)
    085                {
    086                    String var8 = var7.getAbsolutePath();
    087                    var6 = var6 + "A full error report has been saved to " + var8 + " - Please include a copy of that file (Not this screen!) if you report this crash to anyone; without it, they will not be able to help fix the crash :(";
    088                    var5 = "Full report at:\n" + var8 + "\nPlease show that file to Mojang, NOT just this screen!\n\n" + var5;
    089                }
    090                else
    091                {
    092                    var6 = var6 + "We were unable to save this report to a file.";
    093                }
    094
    095                var6 = var6 + "\n";
    096            }
    097
    098            var6 = var6 + "\n";
    099            var6 = var6 + "\n";
    100            var6 = var6 + "\n";
    101            var6 = var6 + "--- BEGIN ERROR REPORT " + Integer.toHexString(var6.hashCode()) + " --------\n";
    102            var6 = var6 + var5;
    103            var6 = var6 + "--- END ERROR REPORT " + Integer.toHexString(var6.hashCode()) + " ----------\n";
    104            var6 = var6 + "\n";
    105            var6 = var6 + "\n";
    106            TextArea var10 = new TextArea(var6, 0, 0, 1);
    107            var10.setFont(new Font("Monospaced", 0, 12));
    108            this.add(new CanvasMojangLogo(), "North");
    109            this.add(new CanvasCrashReport(80), "East");
    110            this.add(new CanvasCrashReport(80), "West");
    111            this.add(new CanvasCrashReport(100), "South");
    112            this.add(var10, "Center");
    113        }
    114    }