SpectatorMenu .java

net.minecraft.client.gui.spectator.SpectatorMenu (class): members: EndSpectatorObject, MoveMenuObject, field_178651_f, field_178652_g, field_178653_d.

net.minecraft.client.gui.spectatorclass184 linesclient5.7 KB

API Surface (21)

void func_178661_a(SpectatorMenu menu)
IChatComponent getSpectatorName()
void func_178663_a(float p_178663_1_, int alpha)
boolean func_178662_A_()
ISpectatorMenuObject func_178643_a(int p_178643_1_)
List<ISpectatorMenuObject> func_178642_a()
ISpectatorMenuObject func_178645_b()
ISpectatorMenuView func_178650_c()
void func_178644_b(int p_178644_1_)
void func_178641_d()
int func_178648_e()
void func_178647_a(ISpectatorMenuView p_178647_1_)
SpectatorDetails func_178646_f()
void func_178661_a(SpectatorMenu menu)
IChatComponent getSpectatorName()
void func_178663_a(float p_178663_1_, int alpha)
boolean func_178662_A_()
void func_178661_a(SpectatorMenu menu)
IChatComponent getSpectatorName()
void func_178663_a(float p_178663_1_, int alpha)
boolean func_178662_A_()

Fields & Constants (10)

field_178655_b
field_178656_c
field_178653_d
field_178654_e
field_178657_a
field_178651_f
field_178652_g
field_178659_h
field_178660_i
field_178658_j

String literals (3)

"Close menu"
"Previous Page"
"Next Page"

Full Source

SpectatorMenu.java184 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.gui.spectator;
2
3
import com.google.common.base.Objects;
4
import com.google.common.collect.Lists;
5
import java.util.List;
6
import net.minecraft.client.Minecraft;
7
import net.minecraft.client.gui.Gui;
8
import net.minecraft.client.gui.GuiSpectator;
9
import net.minecraft.client.gui.spectator.categories.SpectatorDetails;
10
import net.minecraft.util.ChatComponentText;
11
import net.minecraft.util.IChatComponent;
12
13
public class SpectatorMenu
14
{
15
    private static final ISpectatorMenuObject field_178655_b = new SpectatorMenu.EndSpectatorObject();
16
    private static final ISpectatorMenuObject field_178656_c = new SpectatorMenu.MoveMenuObject(-1, true);
17
    private static final ISpectatorMenuObject field_178653_d = new SpectatorMenu.MoveMenuObject(1, true);
18
    private static final ISpectatorMenuObject field_178654_e = new SpectatorMenu.MoveMenuObject(1, false);
19
    public static final ISpectatorMenuObject field_178657_a = new ISpectatorMenuObject()
20
    {
21
        public void func_178661_a(SpectatorMenu menu)
22
        {
23
        }
24
        public IChatComponent getSpectatorName()
25
        {
26
            return new ChatComponentText("");
27
        }
28
        public void func_178663_a(float p_178663_1_, int alpha)
29
        {
30
        }
31
        public boolean func_178662_A_()
32
        {
33
            return false;
34
        }
35
    };
36
    private final ISpectatorMenuRecipient field_178651_f;
37
    private final List<SpectatorDetails> field_178652_g = Lists.<SpectatorDetails>newArrayList();
38
    private ISpectatorMenuView field_178659_h = new BaseSpectatorGroup();
39
    private int field_178660_i = -1;
40
    private int field_178658_j;
41
42
    public SpectatorMenu(ISpectatorMenuRecipient p_i45497_1_)
43
    {
44
        this.field_178651_f = p_i45497_1_;
45
    }
46
47
    public ISpectatorMenuObject func_178643_a(int p_178643_1_)
48
    {
49
        int i = p_178643_1_ + this.field_178658_j * 6;
50
        return this.field_178658_j > 0 && p_178643_1_ == 0 ? field_178656_c : (p_178643_1_ == 7 ? (i < this.field_178659_h.func_178669_a().size() ? field_178653_d : field_178654_e) : (p_178643_1_ == 8 ? field_178655_b : (i >= 0 && i < this.field_178659_h.func_178669_a().size() ? (ISpectatorMenuObject)Objects.firstNonNull(this.field_178659_h.func_178669_a().get(i), field_178657_a) : field_178657_a)));
51
    }
52
53
    public List<ISpectatorMenuObject> func_178642_a()
54
    {
55
        List<ISpectatorMenuObject> list = Lists.<ISpectatorMenuObject>newArrayList();
56
57
        for (int i = 0; i <= 8; ++i)
58
        {
59
            list.add(this.func_178643_a(i));
60
        }
61
62
        return list;
63
    }
64
65
    public ISpectatorMenuObject func_178645_b()
66
    {
67
        return this.func_178643_a(this.field_178660_i);
68
    }
69
70
    public ISpectatorMenuView func_178650_c()
71
    {
72
        return this.field_178659_h;
73
    }
74
75
    public void func_178644_b(int p_178644_1_)
76
    {
77
        ISpectatorMenuObject ispectatormenuobject = this.func_178643_a(p_178644_1_);
78
79
        if (ispectatormenuobject != field_178657_a)
80
        {
81
            if (this.field_178660_i == p_178644_1_ && ispectatormenuobject.func_178662_A_())
82
            {
83
                ispectatormenuobject.func_178661_a(this);
84
            }
85
            else
86
            {
87
                this.field_178660_i = p_178644_1_;
88
            }
89
        }
90
    }
91
92
    public void func_178641_d()
93
    {
94
        this.field_178651_f.func_175257_a(this);
95
    }
96
97
    public int func_178648_e()
98
    {
99
        return this.field_178660_i;
100
    }
101
102
    public void func_178647_a(ISpectatorMenuView p_178647_1_)
103
    {
104
        this.field_178652_g.add(this.func_178646_f());
105
        this.field_178659_h = p_178647_1_;
106
        this.field_178660_i = -1;
107
        this.field_178658_j = 0;
108
    }
109
110
    public SpectatorDetails func_178646_f()
111
    {
112
        return new SpectatorDetails(this.field_178659_h, this.func_178642_a(), this.field_178660_i);
113
    }
114
115
    static class EndSpectatorObject implements ISpectatorMenuObject
116
    {
117
        private EndSpectatorObject()
118
        {
119
        }
120
121
        public void func_178661_a(SpectatorMenu menu)
122
        {
123
            menu.func_178641_d();
124
        }
125
126
        public IChatComponent getSpectatorName()
127
        {
128
            return new ChatComponentText("Close menu");
129
        }
130
131
        public void func_178663_a(float p_178663_1_, int alpha)
132
        {
133
            Minecraft.getMinecraft().getTextureManager().bindTexture(GuiSpectator.field_175269_a);
134
            Gui.drawModalRectWithCustomSizedTexture(0, 0, 128.0F, 0.0F, 16, 16, 256.0F, 256.0F);
135
        }
136
137
        public boolean func_178662_A_()
138
        {
139
            return true;
140
        }
141
    }
142
143
    static class MoveMenuObject implements ISpectatorMenuObject
144
    {
145
        private final int field_178666_a;
146
        private final boolean field_178665_b;
147
148
        public MoveMenuObject(int p_i45495_1_, boolean p_i45495_2_)
149
        {
150
            this.field_178666_a = p_i45495_1_;
151
            this.field_178665_b = p_i45495_2_;
152
        }
153
154
        public void func_178661_a(SpectatorMenu menu)
155
        {
156
            menu.field_178658_j = this.field_178666_a;
157
        }
158
159
        public IChatComponent getSpectatorName()
160
        {
161
            return this.field_178666_a < 0 ? new ChatComponentText("Previous Page") : new ChatComponentText("Next Page");
162
        }
163
164
        public void func_178663_a(float p_178663_1_, int alpha)
165
        {
166
            Minecraft.getMinecraft().getTextureManager().bindTexture(GuiSpectator.field_175269_a);
167
168
            if (this.field_178666_a < 0)
169
            {
170
                Gui.drawModalRectWithCustomSizedTexture(0, 0, 144.0F, 0.0F, 16, 16, 256.0F, 256.0F);
171
            }
172
            else
173
            {
174
                Gui.drawModalRectWithCustomSizedTexture(0, 0, 160.0F, 0.0F, 16, 16, 256.0F, 256.0F);
175
            }
176
        }
177
178
        public boolean func_178662_A_()
179
        {
180
            return this.field_178665_b;
181
        }
182
    }
183
}
184

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