    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                var4 = GL11.glGetString(GL11.GL_VENDOR);
    034            }
    035            catch (Throwable var9)
    036            {
    037                var5 = var5 + "[failed to get system properties (" + var9 + ")]\n\n";
    038            }
    039
    040            var5 = var5 + var3;
    041            String var6 = "";
    042            var6 = var6 + "\n";
    043            var6 = var6 + "\n";
    044
    045            if (var3.contains("Pixel format not accelerated"))
    046            {
    047                var6 = var6 + "      Bad video card drivers!      \n";
    048                var6 = var6 + "      -----------------------      \n";
    049                var6 = var6 + "\n";
    050                var6 = var6 + "Minecraft was unable to start because it failed to find an accelerated OpenGL mode.\n";
    051                var6 = var6 + "This can usually be fixed by updating the video card drivers.\n";
    052
    053                if (var4.toLowerCase().contains("nvidia"))
    054                {
    055                    var6 = var6 + "\n";
    056                    var6 = var6 + "You might be able to find drivers for your video card here:\n";
    057                    var6 = var6 + "  http://www.nvidia.com/\n";
    058                }
    059                else if (var4.toLowerCase().contains("ati"))
    060                {
    061                    var6 = var6 + "\n";
    062                    var6 = var6 + "You might be able to find drivers for your video card here:\n";
    063                    var6 = var6 + "  http://www.amd.com/\n";
    064                }
    065            }
    066            else
    067            {
    068                var6 = var6 + "      Minecraft has crashed!      \n";
    069                var6 = var6 + "      ----------------------      \n";
    070                var6 = var6 + "\n";
    071                var6 = var6 + "Minecraft has stopped running because it encountered a problem; " + par1CrashReport.getDescription() + "\n";
    072                File var7 = par1CrashReport.getFile();
    073
    074                if (var7 == null)
    075                {
    076                    par1CrashReport.saveToFile(new File(new File(Minecraft.getMinecraftDir(), "crash-reports"), "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt"));
    077                    var7 = par1CrashReport.getFile();
    078                }
    079
    080                if (var7 != null)
    081                {
    082                    String var8 = var7.getAbsolutePath();
    083                    var6 = var6 + "A full error report has been saved to " + var8 + " for your convenience. 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 :(";
    084                    var5 = "Full report at:\n" + var8 + "\n\n" + var5;
    085                }
    086                else
    087                {
    088                    var6 = var6 + "We were unable to save this report to a file.";
    089                }
    090
    091                var6 = var6 + "\n";
    092            }
    093
    094            var6 = var6 + "\n";
    095            var6 = var6 + "\n";
    096            var6 = var6 + "\n";
    097            var6 = var6 + "--- BEGIN ERROR REPORT " + Integer.toHexString(var6.hashCode()) + " --------\n";
    098            var6 = var6 + var5;
    099            var6 = var6 + "--- END ERROR REPORT " + Integer.toHexString(var6.hashCode()) + " ----------\n";
    100            var6 = var6 + "\n";
    101            var6 = var6 + "\n";
    102            TextArea var10 = new TextArea(var6, 0, 0, 1);
    103            var10.setFont(new Font("Monospaced", 0, 12));
    104            this.add(new CanvasMojangLogo(), "North");
    105            this.add(new CanvasCrashReport(80), "East");
    106            this.add(new CanvasCrashReport(80), "West");
    107            this.add(new CanvasCrashReport(100), "South");
    108            this.add(var10, "Center");
    109        }
    110    }