GuiIngameMenu .java

net.minecraft.client.gui.GuiIngameMenu (class): members: field_146444_f, field_146445_a, updateScreen, actionPerformed, initGui, drawScreen. imports: I18n.

net.minecraft.client.guiclass115 linesclientextends GuiScreen4.2 KB

API Surface (4)

void initGui()
void actionPerformed(GuiButton button)
void updateScreen()
void drawScreen(int mouseX, int mouseY, float partialTicks)

Fields & Constants (2)

field_146445_a
field_146444_f

String literals (8)

"menu.returnToMenu"
"menu.disconnect"
"menu.returnToGame"
"menu.options"
"menu.shareToLan"
"gui.achievements"
"gui.stats"
"menu.game"

Code Graph: Dependencies (8)

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

Full Source

GuiIngameMenu.java115 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.gui;
2
3
import java.io.IOException;
4
import net.minecraft.client.gui.achievement.GuiAchievements;
5
import net.minecraft.client.gui.achievement.GuiStats;
6
import net.minecraft.client.multiplayer.WorldClient;
7
import net.minecraft.client.resources.I18n;
8
import net.minecraft.realms.RealmsBridge;
9
10
public class GuiIngameMenu extends GuiScreen
11
{
12
    private int field_146445_a;
13
    private int field_146444_f;
14
15
    /**
16
     * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
17
     * window resizes, the buttonList is cleared beforehand.
18
     */
19
    public void initGui()
20
    {
21
        this.field_146445_a = 0;
22
        this.buttonList.clear();
23
        int i = -16;
24
        int j = 98;
25
        this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + i, I18n.format("menu.returnToMenu", new Object[0])));
26
27
        if (!this.mc.isIntegratedServerRunning())
28
        {
29
            ((GuiButton)this.buttonList.get(0)).displayString = I18n.format("menu.disconnect", new Object[0]);
30
        }
31
32
        this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 24 + i, I18n.format("menu.returnToGame", new Object[0])));
33
        this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + i, 98, 20, I18n.format("menu.options", new Object[0])));
34
        GuiButton guibutton;
35
        this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 + 2, this.height / 4 + 96 + i, 98, 20, I18n.format("menu.shareToLan", new Object[0])));
36
        this.buttonList.add(new GuiButton(5, this.width / 2 - 100, this.height / 4 + 48 + i, 98, 20, I18n.format("gui.achievements", new Object[0])));
37
        this.buttonList.add(new GuiButton(6, this.width / 2 + 2, this.height / 4 + 48 + i, 98, 20, I18n.format("gui.stats", new Object[0])));
38
        guibutton.enabled = this.mc.isSingleplayer() && !this.mc.getIntegratedServer().getPublic();
39
    }
40
41
    /**
42
     * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
43
     */
44
    protected void actionPerformed(GuiButton button) throws IOException
45
    {
46
        switch (button.id)
47
        {
48
            case 0:
49
                this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
50
                break;
51
52
            case 1:
53
                boolean flag = this.mc.isIntegratedServerRunning();
54
                boolean flag1 = this.mc.isConnectedToRealms();
55
                button.enabled = false;
56
                this.mc.theWorld.sendQuittingDisconnectingPacket();
57
                this.mc.loadWorld((WorldClient)null);
58
59
                if (flag)
60
                {
61
                    this.mc.displayGuiScreen(new GuiMainMenu());
62
                }
63
                else if (flag1)
64
                {
65
                    RealmsBridge realmsbridge = new RealmsBridge();
66
                    realmsbridge.switchToRealms(new GuiMainMenu());
67
                }
68
                else
69
                {
70
                    this.mc.displayGuiScreen(new GuiMultiplayer(new GuiMainMenu()));
71
                }
72
73
            case 2:
74
            case 3:
75
            default:
76
                break;
77
78
            case 4:
79
                this.mc.displayGuiScreen((GuiScreen)null);
80
                this.mc.setIngameFocus();
81
                break;
82
83
            case 5:
84
                this.mc.displayGuiScreen(new GuiAchievements(this, this.mc.thePlayer.getStatFileWriter()));
85
                break;
86
87
            case 6:
88
                this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter()));
89
                break;
90
91
            case 7:
92
                this.mc.displayGuiScreen(new GuiShareToLan(this));
93
        }
94
    }
95
96
    /**
97
     * Called from the main game loop to update the screen.
98
     */
99
    public void updateScreen()
100
    {
101
        super.updateScreen();
102
        ++this.field_146444_f;
103
    }
104
105
    /**
106
     * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
107
     */
108
    public void drawScreen(int mouseX, int mouseY, float partialTicks)
109
    {
110
        this.drawDefaultBackground();
111
        this.drawCenteredString(this.fontRendererObj, I18n.format("menu.game", new Object[0]), this.width / 2, 40, 16777215);
112
        super.drawScreen(mouseX, mouseY, partialTicks);
113
    }
114
}
115

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