Update GuiPlayerTabOverlayMixin.java

This commit is contained in:
kirillsaint 2023-08-31 18:13:43 +06:00
parent b68a6906ac
commit 33d00ed6cc

View File

@ -183,6 +183,22 @@ public abstract class GuiPlayerTabOverlayMixin {
String s1 = this.getPlayerName(networkplayerinfo1);
GameProfile gameprofile = networkplayerinfo1.getGameProfile();
boolean isSilent = false;
try {
EntityPlayer entityplayer = gameprofile.getName().equalsIgnoreCase(Client.getInstance().getAccount().getUsername()) ? this.mc.thePlayer : this.mc.theWorld.getPlayerEntityByUUID(gameprofile.getId());
if(entityplayer != null) {
isSilent = Boolean.parseBoolean(Players.getPlayerStatus(gameprofile.getName().equalsIgnoreCase(Client.getInstance().getAccount().getUsername()), gameprofile.getName(), entityplayer.getUniqueID(), (AbstractClientPlayer) entityplayer));
}
if(isSilent && entityplayer != null && Client.getInstance().getModInstances().getModByClass(TabMod.class).isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(TabMod.class, "Show Nametag Icons").getValBoolean()) {
this.mc.getTextureManager().bindTexture(((AbstractClientPlayerExt) entityplayer).silent$getPlayerIcon().getLocation());
GlStateManager.color(1.0f, 1.0f, 1.0f);
drawModalRectWithCustomSizedTexture(j2 + 0.5F, k2, 0.0f, 0.0f, 8.0f, 8.0f, 8.0f, 8.0f);
j2 += 9;
}
} catch (Exception err) {
}
if (flag)
{
EntityPlayer entityplayer = this.mc.theWorld.getPlayerEntityByUUID(gameprofile.getId());
@ -201,21 +217,6 @@ public abstract class GuiPlayerTabOverlayMixin {
j2 += 9;
}
boolean isSilent = false;
try {
EntityPlayer entityplayer = gameprofile.getName().equalsIgnoreCase(Client.getInstance().getAccount().getUsername()) ? this.mc.thePlayer : this.mc.theWorld.getPlayerEntityByUUID(gameprofile.getId());
if(entityplayer != null) {
isSilent = Boolean.parseBoolean(Players.getPlayerStatus(gameprofile.getName().equalsIgnoreCase(Client.getInstance().getAccount().getUsername()), gameprofile.getName(), entityplayer.getUniqueID(), (AbstractClientPlayer) entityplayer));
}
if(isSilent && entityplayer != null && Client.getInstance().getModInstances().getModByClass(TabMod.class).isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(TabMod.class, "Show Nametag Icons").getValBoolean()) {
this.mc.getTextureManager().bindTexture(((AbstractClientPlayerExt) entityplayer).silent$getPlayerIcon().getLocation());
GlStateManager.color(1.0f, 1.0f, 1.0f);
drawModalRectWithCustomSizedTexture((float)(j2 + this.mc.fontRendererObj.getStringWidth(s1)) + 1, k2, 0.0f, 0.0f, 8.0f, 8.0f, 8.0f, 8.0f);
}
} catch (Exception err) {
}
if (networkplayerinfo1.getGameType() == WorldSettings.GameType.SPECTATOR)
{
s1 = EnumChatFormatting.ITALIC + s1;
@ -237,7 +238,7 @@ public abstract class GuiPlayerTabOverlayMixin {
}
}
this.drawPing(i1, j2 - (flag ? 9 : 0), k2, networkplayerinfo1);
this.drawPing(i1, j2 - (flag ? 9 : 0) - (isSilent && Client.getInstance().getModInstances().getModByClass(TabMod.class).isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(TabMod.class, "Show Nametag Icons").getValBoolean() ? 9 : 0), k2, networkplayerinfo1);
}
}
@ -256,7 +257,7 @@ public abstract class GuiPlayerTabOverlayMixin {
}
}
} catch(Exception err) {
Client.logger.error("TAB RENDERER ERROR: " + err.getMessage());
Client.logger.catching(err);
}
}
@ -275,6 +276,23 @@ public abstract class GuiPlayerTabOverlayMixin {
tessellator.draw();
}
private int getPingWidth(NetworkPlayerInfo networkPlayerInfoIn) {
if(!Client.getInstance().getModInstances().getModByClass(TabMod.class).isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(TabMod.class, "Show Ping Numbers").getValBoolean()) {
return 10;
}
int ping = 0;
EntityPlayer entityplayer = this.mc.theWorld.getPlayerEntityByUUID(networkPlayerInfoIn.getGameProfile().getId());
if(entityplayer == null || entityplayer != mc.thePlayer) {
ping = networkPlayerInfoIn.getResponseTime();
}
if(entityplayer != null && entityplayer == mc.thePlayer) {
ping = Client.getInstance().ping;
}
return mc.fontRendererObj.getStringWidth(String.valueOf(ping));
}
@Inject(method = "drawPing", at = @At("HEAD"), cancellable = true)
public void numbersPing(int p_175245_1_, int p_175245_2_, int p_175245_3_, NetworkPlayerInfo networkPlayerInfoIn, CallbackInfo ci) {
if(Client.getInstance().getModInstances().getModByClass(TabMod.class).isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(TabMod.class, "Show Ping Numbers").getValBoolean()) {