    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.getSections();
    036                var4 = GL11.glGetString(GL11.GL_VENDOR);
    037            }
    038            catch (Throwable var8)
    039            {
    040                var5 = var5 + "[failed to get system properties (" + var8 + ")]\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";
    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                    var6 = var6 + "This error has been saved to " + var7.getAbsolutePath() + " for your convenience. Please include a copy of this file if you report this crash to anyone.";
    087                }
    088                else
    089                {
    090                    var6 = var6 + "We were unable to save this report to a file.";
    091                }
    092
    093                var6 = var6 + "\n";
    094            }
    095
    096            var6 = var6 + "\n";
    097            var6 = var6 + "\n";
    098            var6 = var6 + "\n";
    099            var6 = var6 + "--- BEGIN ERROR REPORT " + Integer.toHexString(var6.hashCode()) + " --------\n";
    100            var6 = var6 + var5;
    101            var6 = var6 + "--- END ERROR REPORT " + Integer.toHexString(var6.hashCode()) + " ----------\n";
    102            var6 = var6 + "\n";
    103            var6 = var6 + "\n";
    104            TextArea var9 = new TextArea(var6, 0, 0, 1);
    105            var9.setFont(new Font("Monospaced", 0, 12));
    106            this.add(new CanvasMojangLogo(), "North");
    107            this.add(new CanvasCrashReport(80), "East");
    108            this.add(new CanvasCrashReport(80), "West");
    109            this.add(new CanvasCrashReport(100), "South");
    110            this.add(var9, "Center");
    111        }
    112    }