Skip to content

Commit 23acd4e

Browse files
committed
Update Hysentials Online List.
1 parent 06b6199 commit 23acd4e

File tree

3 files changed

+14
-125
lines changed

3 files changed

+14
-125
lines changed

src/main/java/llc/redstone/hysentials/guis/hsplayerlist/GuiOnlineList.java

Lines changed: 14 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import net.minecraft.util.EnumChatFormatting;
2727
import net.minecraft.util.IChatComponent;
2828
import net.minecraft.util.MathHelper;
29+
import net.minecraft.util.ResourceLocation;
2930
import net.minecraftforge.fml.relauncher.Side;
3031
import net.minecraftforge.fml.relauncher.SideOnly;
3132

@@ -34,35 +35,20 @@
3435
@SideOnly(Side.CLIENT)
3536
public class GuiOnlineList extends Gui {
3637
private static final Ordering<HysentialsSchema.User> field_175252_a = Ordering.from(new PlayerComparator());
38+
private static final ResourceLocation hsob = new ResourceLocation("hysentials:gui/hsob.png");
3739
private final Minecraft mc;
38-
private final GuiIngame guiIngame;
3940
private IChatComponent footer;
4041
private IChatComponent header;
41-
private long lastTimeOpened;
42-
private boolean isBeingRendered;
4342

4443
public GuiOnlineList() {
4544
this.mc = Minecraft.getMinecraft();
46-
this.guiIngame = this.mc.ingameGUI;
47-
}
48-
49-
public String getPlayerName(NetworkPlayerInfo networkPlayerInfoIn) {
50-
return networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName());
51-
}
52-
53-
public void updatePlayerList(boolean willBeRendered) {
54-
if (willBeRendered && !this.isBeingRendered) {
55-
this.lastTimeOpened = Minecraft.getSystemTime();
56-
}
57-
58-
this.isBeingRendered = willBeRendered;
45+
footer = null;
5946
}
6047

6148
public void renderPlayerlist(int width) {
6249
GlStateManager.pushMatrix();
6350
List<HysentialsSchema.User> list = field_175252_a.sortedCopy(Socket.cachedUsers.values());
6451
int i = 0;
65-
int j = 0;
6652
Iterator<HysentialsSchema.User> iterator = list.iterator();
6753
int k;
6854
while(iterator.hasNext()) {
@@ -90,6 +76,7 @@ public void renderPlayerlist(int width) {
9076
List<String> list3 = null;
9177
Iterator iterator2;
9278
String string;
79+
9380
if (this.header != null) {
9481
list2 = this.mc.fontRendererObj.listFormattedStringToWidth(this.header.getFormattedText(), width - 50);
9582

@@ -107,17 +94,17 @@ public void renderPlayerlist(int width) {
10794
}
10895

10996
int s;
110-
if (list2 != null) {
111-
drawRect(width / 2 - r / 2 - 1, q - 1, width / 2 + r / 2 + 1, q + list2.size() * this.mc.fontRendererObj.FONT_HEIGHT, Integer.MIN_VALUE);
112-
113-
for(iterator2 = list2.iterator(); iterator2.hasNext(); q += this.mc.fontRendererObj.FONT_HEIGHT) {
114-
string = (String)iterator2.next();
115-
s = this.mc.fontRendererObj.getStringWidth(string);
116-
this.mc.fontRendererObj.drawStringWithShadow(string, (float)(width / 2 - s / 2), (float)q, -1);
117-
}
97+
//draw hsob
98+
drawRect(width / 2 - r / 2 - 1, 0, width / 2 + r / 2 + 1, (int) ((r/2.688172043) + 10), Integer.MIN_VALUE);
99+
this.mc.getTextureManager().bindTexture(hsob);
100+
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
101+
GlStateManager.enableAlpha();
102+
GlStateManager.enableBlend();
103+
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
104+
drawModalRectWithCustomSizedTexture(width / 2 - (r + 10) / 2, 0, 0, 0, r + 10, (int) ((r/2.688172043) + 10), r + 10, r/3f + 10);
105+
q += (int) (r/2.688172043);
106+
this.mc.getTextureManager().bindTexture(GuiIngame.icons);
118107

119-
++q;
120-
}
121108

122109
drawRect(width / 2 - r / 2 - 1, q - 1, width / 2 + r / 2 + 1, q + m * 9, Integer.MIN_VALUE);
123110

@@ -166,103 +153,6 @@ public void renderPlayerlist(int width) {
166153
GlStateManager.popMatrix();
167154
}
168155

169-
protected void drawPing(int i, int j, int k, NetworkPlayerInfo networkPlayerInfoIn) {
170-
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
171-
this.mc.getTextureManager().bindTexture(icons);
172-
int l = 0;
173-
174-
int m;
175-
if (networkPlayerInfoIn.getResponseTime() < 0) {
176-
m = 5;
177-
} else if (networkPlayerInfoIn.getResponseTime() < 150) {
178-
m = 0;
179-
} else if (networkPlayerInfoIn.getResponseTime() < 300) {
180-
m = 1;
181-
} else if (networkPlayerInfoIn.getResponseTime() < 600) {
182-
m = 2;
183-
} else if (networkPlayerInfoIn.getResponseTime() < 1000) {
184-
m = 3;
185-
} else {
186-
m = 4;
187-
}
188-
189-
this.zLevel += 100.0F;
190-
this.drawTexturedModalRect(j + i - 11, k, 0 + l * 10, 176 + m * 8, 10, 8);
191-
this.zLevel -= 100.0F;
192-
193-
}
194-
195-
private void drawScoreboardValues(ScoreObjective scoreObjective, int i, String string, int j, int k, NetworkPlayerInfo networkPlayerInfo) {
196-
int l = scoreObjective.getScoreboard().getValueFromObjective(string, scoreObjective).getScorePoints();
197-
if (scoreObjective.getRenderType() == EnumRenderType.HEARTS) {
198-
this.mc.getTextureManager().bindTexture(icons);
199-
if (this.lastTimeOpened == networkPlayerInfo.func_178855_p()) {
200-
if (l < networkPlayerInfo.func_178835_l()) {
201-
networkPlayerInfo.func_178846_a(Minecraft.getSystemTime());
202-
networkPlayerInfo.func_178844_b((long)(this.guiIngame.getUpdateCounter() + 20));
203-
} else if (l > networkPlayerInfo.func_178835_l()) {
204-
networkPlayerInfo.func_178846_a(Minecraft.getSystemTime());
205-
networkPlayerInfo.func_178844_b((long)(this.guiIngame.getUpdateCounter() + 10));
206-
}
207-
}
208-
209-
if (Minecraft.getSystemTime() - networkPlayerInfo.func_178847_n() > 1000L || this.lastTimeOpened != networkPlayerInfo.func_178855_p()) {
210-
networkPlayerInfo.func_178836_b(l);
211-
networkPlayerInfo.func_178857_c(l);
212-
networkPlayerInfo.func_178846_a(Minecraft.getSystemTime());
213-
}
214-
215-
networkPlayerInfo.func_178843_c(this.lastTimeOpened);
216-
networkPlayerInfo.func_178836_b(l);
217-
int m = MathHelper.ceiling_float_int((float)Math.max(l, networkPlayerInfo.func_178860_m()) / 2.0F);
218-
int n = Math.max(MathHelper.ceiling_float_int((float)(l / 2)), Math.max(MathHelper.ceiling_float_int((float)(networkPlayerInfo.func_178860_m() / 2)), 10));
219-
boolean bl = networkPlayerInfo.func_178858_o() > (long)this.guiIngame.getUpdateCounter() && (networkPlayerInfo.func_178858_o() - (long)this.guiIngame.getUpdateCounter()) / 3L % 2L == 1L;
220-
if (m > 0) {
221-
float f = Math.min((float)(k - j - 4) / (float)n, 9.0F);
222-
if (f > 3.0F) {
223-
int o;
224-
for(o = m; o < n; ++o) {
225-
this.drawTexturedModalRect((float)j + (float)o * f, (float)i, bl ? 25 : 16, 0, 9, 9);
226-
}
227-
228-
for(o = 0; o < m; ++o) {
229-
this.drawTexturedModalRect((float)j + (float)o * f, (float)i, bl ? 25 : 16, 0, 9, 9);
230-
if (bl) {
231-
if (o * 2 + 1 < networkPlayerInfo.func_178860_m()) {
232-
this.drawTexturedModalRect((float)j + (float)o * f, (float)i, 70, 0, 9, 9);
233-
}
234-
235-
if (o * 2 + 1 == networkPlayerInfo.func_178860_m()) {
236-
this.drawTexturedModalRect((float)j + (float)o * f, (float)i, 79, 0, 9, 9);
237-
}
238-
}
239-
240-
if (o * 2 + 1 < l) {
241-
this.drawTexturedModalRect((float)j + (float)o * f, (float)i, o >= 10 ? 160 : 52, 0, 9, 9);
242-
}
243-
244-
if (o * 2 + 1 == l) {
245-
this.drawTexturedModalRect((float)j + (float)o * f, (float)i, o >= 10 ? 169 : 61, 0, 9, 9);
246-
}
247-
}
248-
} else {
249-
float g = MathHelper.clamp_float((float)l / 20.0F, 0.0F, 1.0F);
250-
int p = (int)((1.0F - g) * 255.0F) << 16 | (int)(g * 255.0F) << 8;
251-
String string2 = "" + (float)l / 2.0F;
252-
if (k - this.mc.fontRendererObj.getStringWidth(string2 + "hp") >= j) {
253-
string2 = string2 + "hp";
254-
}
255-
256-
this.mc.fontRendererObj.drawStringWithShadow(string2, (float)((k + j) / 2 - this.mc.fontRendererObj.getStringWidth(string2) / 2), (float)i, p);
257-
}
258-
}
259-
} else {
260-
String string3 = EnumChatFormatting.YELLOW + "" + l;
261-
this.mc.fontRendererObj.drawStringWithShadow(string3, (float)(k - this.mc.fontRendererObj.getStringWidth(string3)), (float)i, 16777215);
262-
}
263-
264-
}
265-
266156
public void setFooter(IChatComponent footerIn) {
267157
this.footer = footerIn;
268158
}

src/main/java/llc/redstone/hysentials/mixin/GuiIngameForgeMixin.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ private void cancelSelectedItem(CallbackInfo ci) {
123123
protected boolean hysentials$renderHysentialsPlayerList(int width, int height)
124124
{
125125
if (HysentialsConfig.onlinePlayersKeyBind.isActive() && Minecraft.getMinecraft().currentScreen == null) {
126-
hysentials$hysentialsOnlineList.updatePlayerList(true);
127126
ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft());
128127
hysentials$hysentialsOnlineList.renderPlayerlist(res.getScaledWidth());
129128
return true;
112 KB
Loading

0 commit comments

Comments
 (0)