GuiOptionsRowList .java

net.minecraft.client.gui.GuiOptionsRowList (class): members: field_148184_k, Row, getListEntry, getListWidth, getScrollBarX, getSize. imports: Minecraft.

net.minecraft.client.guiclass139 linesclientextends GuiListExtended5.0 KB

API Surface (8)

GuiOptionsRowList.Row getListEntry(int index)
int getSize()
int getListWidth()
int getScrollBarX()
void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
boolean mousePressed(int slotIndex, int p_148278_2_, int p_148278_3_, int p_148278_4_, int p_148278_5_, int p_148278_6_)
void mouseReleased(int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY)
void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_)

Fields & Constants (1)

field_148184_k

Code Graph: Dependencies (4)

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

Full Source

GuiOptionsRowList.java139 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.gui;
2
3
import com.google.common.collect.Lists;
4
import java.util.List;
5
import net.minecraft.client.Minecraft;
6
import net.minecraft.client.settings.GameSettings;
7
8
public class GuiOptionsRowList extends GuiListExtended
9
{
10
    private final List<GuiOptionsRowList.Row> field_148184_k = Lists.<GuiOptionsRowList.Row>newArrayList();
11
12
    public GuiOptionsRowList(Minecraft mcIn, int p_i45015_2_, int p_i45015_3_, int p_i45015_4_, int p_i45015_5_, int p_i45015_6_, GameSettings.Options... p_i45015_7_)
13
    {
14
        super(mcIn, p_i45015_2_, p_i45015_3_, p_i45015_4_, p_i45015_5_, p_i45015_6_);
15
        this.field_148163_i = false;
16
17
        for (int i = 0; i < p_i45015_7_.length; i += 2)
18
        {
19
            GameSettings.Options gamesettings$options = p_i45015_7_[i];
20
            GameSettings.Options gamesettings$options1 = i < p_i45015_7_.length - 1 ? p_i45015_7_[i + 1] : null;
21
            GuiButton guibutton = this.func_148182_a(mcIn, p_i45015_2_ / 2 - 155, 0, gamesettings$options);
22
            GuiButton guibutton1 = this.func_148182_a(mcIn, p_i45015_2_ / 2 - 155 + 160, 0, gamesettings$options1);
23
            this.field_148184_k.add(new GuiOptionsRowList.Row(guibutton, guibutton1));
24
        }
25
    }
26
27
    private GuiButton func_148182_a(Minecraft mcIn, int p_148182_2_, int p_148182_3_, GameSettings.Options p_148182_4_)
28
    {
29
        if (p_148182_4_ == null)
30
        {
31
            return null;
32
        }
33
        else
34
        {
35
            int i = p_148182_4_.returnEnumOrdinal();
36
            return (GuiButton)(p_148182_4_.getEnumFloat() ? new GuiOptionSlider(i, p_148182_2_, p_148182_3_, p_148182_4_) : new GuiOptionButton(i, p_148182_2_, p_148182_3_, p_148182_4_, mcIn.gameSettings.getKeyBinding(p_148182_4_)));
37
        }
38
    }
39
40
    /**
41
     * Gets the IGuiListEntry object for the given index
42
     */
43
    public GuiOptionsRowList.Row getListEntry(int index)
44
    {
45
        return (GuiOptionsRowList.Row)this.field_148184_k.get(index);
46
    }
47
48
    protected int getSize()
49
    {
50
        return this.field_148184_k.size();
51
    }
52
53
    /**
54
     * Gets the width of the list
55
     */
56
    public int getListWidth()
57
    {
58
        return 400;
59
    }
60
61
    protected int getScrollBarX()
62
    {
63
        return super.getScrollBarX() + 32;
64
    }
65
66
    public static class Row implements GuiListExtended.IGuiListEntry
67
    {
68
        private final Minecraft field_148325_a = Minecraft.getMinecraft();
69
        private final GuiButton field_148323_b;
70
        private final GuiButton field_148324_c;
71
72
        public Row(GuiButton p_i45014_1_, GuiButton p_i45014_2_)
73
        {
74
            this.field_148323_b = p_i45014_1_;
75
            this.field_148324_c = p_i45014_2_;
76
        }
77
78
        public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
79
        {
80
            if (this.field_148323_b != null)
81
            {
82
                this.field_148323_b.yPosition = y;
83
                this.field_148323_b.drawButton(this.field_148325_a, mouseX, mouseY);
84
            }
85
86
            if (this.field_148324_c != null)
87
            {
88
                this.field_148324_c.yPosition = y;
89
                this.field_148324_c.drawButton(this.field_148325_a, mouseX, mouseY);
90
            }
91
        }
92
93
        public boolean mousePressed(int slotIndex, int p_148278_2_, int p_148278_3_, int p_148278_4_, int p_148278_5_, int p_148278_6_)
94
        {
95
            if (this.field_148323_b.mousePressed(this.field_148325_a, p_148278_2_, p_148278_3_))
96
            {
97
                if (this.field_148323_b instanceof GuiOptionButton)
98
                {
99
                    this.field_148325_a.gameSettings.setOptionValue(((GuiOptionButton)this.field_148323_b).returnEnumOptions(), 1);
100
                    this.field_148323_b.displayString = this.field_148325_a.gameSettings.getKeyBinding(GameSettings.Options.getEnumOptions(this.field_148323_b.id));
101
                }
102
103
                return true;
104
            }
105
            else if (this.field_148324_c != null && this.field_148324_c.mousePressed(this.field_148325_a, p_148278_2_, p_148278_3_))
106
            {
107
                if (this.field_148324_c instanceof GuiOptionButton)
108
                {
109
                    this.field_148325_a.gameSettings.setOptionValue(((GuiOptionButton)this.field_148324_c).returnEnumOptions(), 1);
110
                    this.field_148324_c.displayString = this.field_148325_a.gameSettings.getKeyBinding(GameSettings.Options.getEnumOptions(this.field_148324_c.id));
111
                }
112
113
                return true;
114
            }
115
            else
116
            {
117
                return false;
118
            }
119
        }
120
121
        public void mouseReleased(int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY)
122
        {
123
            if (this.field_148323_b != null)
124
            {
125
                this.field_148323_b.mouseReleased(x, y);
126
            }
127
128
            if (this.field_148324_c != null)
129
            {
130
                this.field_148324_c.mouseReleased(x, y);
131
            }
132
        }
133
134
        public void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_)
135
        {
136
        }
137
    }
138
}
139

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