use of meteordevelopment.meteorclient.systems.modules.misc.BetterTab in project meteor-client by MeteorDevelopment.
the class PlayerListHudMixin method renderLatencyIcon.
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;renderLatencyIcon(Lnet/minecraft/client/util/math/MatrixStack;IIILnet/minecraft/client/network/PlayerListEntry;)V"))
protected void renderLatencyIcon(PlayerListHud self, MatrixStack matrices, int width, int x, int y, PlayerListEntry entry) {
BetterTab betterTab = Modules.get().get(BetterTab.class);
if (betterTab.isActive() && betterTab.accurateLatency.get()) {
MinecraftClient mc = MinecraftClient.getInstance();
TextRenderer textRenderer = mc.textRenderer;
int latency = Utils.clamp(entry.getLatency(), 0, 9999);
int color = latency < 150 ? 0x00E970 : latency < 300 ? 0xE7D020 : 0xD74238;
String text = latency + "ms";
textRenderer.drawWithShadow(matrices, text, (float) x + width - textRenderer.getWidth(text), (float) y, color);
} else {
renderLatencyIcon(matrices, width, x, y, entry);
}
}
Aggregations