Search in sources :

Example 1 with BetterTab

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);
    }
}
Also used : BetterTab(meteordevelopment.meteorclient.systems.modules.misc.BetterTab) MinecraftClient(net.minecraft.client.MinecraftClient) TextRenderer(net.minecraft.client.font.TextRenderer) Redirect(org.spongepowered.asm.mixin.injection.Redirect)

Aggregations

BetterTab (meteordevelopment.meteorclient.systems.modules.misc.BetterTab)1 MinecraftClient (net.minecraft.client.MinecraftClient)1 TextRenderer (net.minecraft.client.font.TextRenderer)1 Redirect (org.spongepowered.asm.mixin.injection.Redirect)1