GuiLockIconButton .java

net.minecraft.client.gui.GuiLockIconButton (class, 98 lines): members: field_175231_o, func_175229_b, func_175230_c, Icon, drawButton. imports: Minecraft.

net.minecraft.client.guiclass98 linesclientextends GuiButton2.8 KB

API Surface (5)

boolean func_175230_c()
void func_175229_b(boolean p_175229_1_)
void drawButton(Minecraft mc, int mouseX, int mouseY)
int func_178910_a()
int func_178912_b()

Fields & Constants (1)

field_175231_o

Code Graph: Dependencies (3)

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

Full Source

GuiLockIconButton.java98 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.gui;
2
3
import net.minecraft.client.Minecraft;
4
import net.minecraft.client.renderer.GlStateManager;
5
6
public class GuiLockIconButton extends GuiButton
7
{
8
    private boolean field_175231_o = false;
9
10
    public GuiLockIconButton(int p_i45538_1_, int p_i45538_2_, int p_i45538_3_)
11
    {
12
        super(p_i45538_1_, p_i45538_2_, p_i45538_3_, 20, 20, "");
13
    }
14
15
    public boolean func_175230_c()
16
    {
17
        return this.field_175231_o;
18
    }
19
20
    public void func_175229_b(boolean p_175229_1_)
21
    {
22
        this.field_175231_o = p_175229_1_;
23
    }
24
25
    /**
26
     * Draws this button to the screen.
27
     */
28
    public void drawButton(Minecraft mc, int mouseX, int mouseY)
29
    {
30
        if (this.visible)
31
        {
32
            mc.getTextureManager().bindTexture(GuiButton.buttonTextures);
33
            GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
34
            boolean flag = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
35
            GuiLockIconButton.Icon guilockiconbutton$icon;
36
37
            if (this.field_175231_o)
38
            {
39
                if (!this.enabled)
40
                {
41
                    guilockiconbutton$icon = GuiLockIconButton.Icon.LOCKED_DISABLED;
42
                }
43
                else if (flag)
44
                {
45
                    guilockiconbutton$icon = GuiLockIconButton.Icon.LOCKED_HOVER;
46
                }
47
                else
48
                {
49
                    guilockiconbutton$icon = GuiLockIconButton.Icon.LOCKED;
50
                }
51
            }
52
            else if (!this.enabled)
53
            {
54
                guilockiconbutton$icon = GuiLockIconButton.Icon.UNLOCKED_DISABLED;
55
            }
56
            else if (flag)
57
            {
58
                guilockiconbutton$icon = GuiLockIconButton.Icon.UNLOCKED_HOVER;
59
            }
60
            else
61
            {
62
                guilockiconbutton$icon = GuiLockIconButton.Icon.UNLOCKED;
63
            }
64
65
            this.drawTexturedModalRect(this.xPosition, this.yPosition, guilockiconbutton$icon.func_178910_a(), guilockiconbutton$icon.func_178912_b(), this.width, this.height);
66
        }
67
    }
68
69
    static enum Icon
70
    {
71
        LOCKED(0, 146),
72
        LOCKED_HOVER(0, 166),
73
        LOCKED_DISABLED(0, 186),
74
        UNLOCKED(20, 146),
75
        UNLOCKED_HOVER(20, 166),
76
        UNLOCKED_DISABLED(20, 186);
77
78
        private final int field_178914_g;
79
        private final int field_178920_h;
80
81
        private Icon(int p_i45537_3_, int p_i45537_4_)
82
        {
83
            this.field_178914_g = p_i45537_3_;
84
            this.field_178920_h = p_i45537_4_;
85
        }
86
87
        public int func_178910_a()
88
        {
89
            return this.field_178914_g;
90
        }
91
92
        public int func_178912_b()
93
        {
94
            return this.field_178920_h;
95
        }
96
    }
97
}
98

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