GuiMemoryErrorScreen .java

net.minecraft.client.gui.GuiMemoryErrorScreen (class): members: keyTyped, actionPerformed, initGui, drawScreen. strings: "Out of memory!", "gui.toTitle".

net.minecraft.client.guiclass60 linesclientextends GuiScreen3.1 KB

API Surface (4)

void initGui()
void actionPerformed(GuiButton button)
void keyTyped(char typedChar, int keyCode)
void drawScreen(int mouseX, int mouseY, float partialTicks)

String literals (6)

"gui.toTitle"
"menu.quit"
"Out of memory!"
"Minecraft has run out of memory."
"Java Virtual Machine not being allocated enough"
"memory."

Code Graph: Dependencies (4)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

GuiMemoryErrorScreen.java60 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.gui;
2
3
import java.io.IOException;
4
import net.minecraft.client.resources.I18n;
5
6
public class GuiMemoryErrorScreen extends GuiScreen
7
{
8
    /**
9
     * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
10
     * window resizes, the buttonList is cleared beforehand.
11
     */
12
    public void initGui()
13
    {
14
        this.buttonList.clear();
15
        this.buttonList.add(new GuiOptionButton(0, this.width / 2 - 155, this.height / 4 + 120 + 12, I18n.format("gui.toTitle", new Object[0])));
16
        this.buttonList.add(new GuiOptionButton(1, this.width / 2 - 155 + 160, this.height / 4 + 120 + 12, I18n.format("menu.quit", new Object[0])));
17
    }
18
19
    /**
20
     * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
21
     */
22
    protected void actionPerformed(GuiButton button) throws IOException
23
    {
24
        if (button.id == 0)
25
        {
26
            this.mc.displayGuiScreen(new GuiMainMenu());
27
        }
28
        else if (button.id == 1)
29
        {
30
            this.mc.shutdown();
31
        }
32
    }
33
34
    /**
35
     * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
36
     * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
37
     */
38
    protected void keyTyped(char typedChar, int keyCode) throws IOException
39
    {
40
    }
41
42
    /**
43
     * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
44
     */
45
    public void drawScreen(int mouseX, int mouseY, float partialTicks)
46
    {
47
        this.drawDefaultBackground();
48
        this.drawCenteredString(this.fontRendererObj, "Out of memory!", this.width / 2, this.height / 4 - 60 + 20, 16777215);
49
        this.drawString(this.fontRendererObj, "Minecraft has run out of memory.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 0, 10526880);
50
        this.drawString(this.fontRendererObj, "This could be caused by a bug in the game or by the", this.width / 2 - 140, this.height / 4 - 60 + 60 + 18, 10526880);
51
        this.drawString(this.fontRendererObj, "Java Virtual Machine not being allocated enough", this.width / 2 - 140, this.height / 4 - 60 + 60 + 27, 10526880);
52
        this.drawString(this.fontRendererObj, "memory.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 36, 10526880);
53
        this.drawString(this.fontRendererObj, "To prevent level corruption, the current game has quit.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 54, 10526880);
54
        this.drawString(this.fontRendererObj, "We\'ve tried to free up enough memory to let you go back to", this.width / 2 - 140, this.height / 4 - 60 + 60 + 63, 10526880);
55
        this.drawString(this.fontRendererObj, "the main menu and back to playing, but this may not have worked.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 72, 10526880);
56
        this.drawString(this.fontRendererObj, "Please restart the game if you see this message again.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 81, 10526880);
57
        super.drawScreen(mouseX, mouseY, partialTicks);
58
    }
59
}
60

Deobfuscated MCP 1.8.9 source of GuiMemoryErrorScreen from Marcelektro/MavenMCP-1.8.9 (net/minecraft/client/gui/GuiMemoryErrorScreen.java), stored verbatim.