GuiListButton .java

net.minecraft.client.gui.GuiListButton (class): members: localizationStr, field_175216_o, func_175212_b, guiResponder, mousePressed. strings: "gui.yes".

net.minecraft.client.guiclass59 linesclientextends GuiButton1.9 KB

API Surface (2)

void func_175212_b(boolean p_175212_1_)
boolean mousePressed(Minecraft mc, int mouseX, int mouseY)

Fields & Constants (3)

field_175216_o
localizationStr
guiResponder

String literals (2)

"gui.yes"
"gui.no"

Code Graph: Dependencies (4)

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

Full Source

GuiListButton.java59 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.gui;
2
3
import net.minecraft.client.Minecraft;
4
import net.minecraft.client.resources.I18n;
5
6
public class GuiListButton extends GuiButton
7
{
8
    private boolean field_175216_o;
9
10
    /** The localization string used by this control. */
11
    private String localizationStr;
12
13
    /** The GuiResponder Object reference. */
14
    private final GuiPageButtonList.GuiResponder guiResponder;
15
16
    public GuiListButton(GuiPageButtonList.GuiResponder responder, int p_i45539_2_, int p_i45539_3_, int p_i45539_4_, String p_i45539_5_, boolean p_i45539_6_)
17
    {
18
        super(p_i45539_2_, p_i45539_3_, p_i45539_4_, 150, 20, "");
19
        this.localizationStr = p_i45539_5_;
20
        this.field_175216_o = p_i45539_6_;
21
        this.displayString = this.buildDisplayString();
22
        this.guiResponder = responder;
23
    }
24
25
    /**
26
     * Builds the localized display string for this GuiListButton
27
     */
28
    private String buildDisplayString()
29
    {
30
        return I18n.format(this.localizationStr, new Object[0]) + ": " + (this.field_175216_o ? I18n.format("gui.yes", new Object[0]) : I18n.format("gui.no", new Object[0]));
31
    }
32
33
    public void func_175212_b(boolean p_175212_1_)
34
    {
35
        this.field_175216_o = p_175212_1_;
36
        this.displayString = this.buildDisplayString();
37
        this.guiResponder.func_175321_a(this.id, p_175212_1_);
38
    }
39
40
    /**
41
     * Returns true if the mouse has been pressed on this control. Equivalent of MouseListener.mousePressed(MouseEvent
42
     * e).
43
     */
44
    public boolean mousePressed(Minecraft mc, int mouseX, int mouseY)
45
    {
46
        if (super.mousePressed(mc, mouseX, mouseY))
47
        {
48
            this.field_175216_o = !this.field_175216_o;
49
            this.displayString = this.buildDisplayString();
50
            this.guiResponder.func_175321_a(this.id, this.field_175216_o);
51
            return true;
52
        }
53
        else
54
        {
55
            return false;
56
        }
57
    }
58
}
59

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