Search in sources :

Example 1 with StringCharacterVisitor

use of meteordevelopment.meteorclient.utils.misc.text.StringCharacterVisitor in project meteor-client by MeteorDevelopment.

the class ChatHudMixin method onRender.

@Inject(method = "render", at = @At("TAIL"))
private void onRender(MatrixStack matrices, int tickDelta, CallbackInfo ci) {
    if (!Modules.get().get(BetterChat.class).displayPlayerHeads())
        return;
    if (mc.options.chatVisibility == ChatVisibility.HIDDEN)
        return;
    int maxLineCount = mc.inGameHud.getChatHud().getVisibleLineCount();
    double d = mc.options.chatOpacity * 0.8999999761581421D + 0.10000000149011612D;
    double g = 9.0D * (mc.options.chatLineSpacing + 1.0D);
    double h = -8.0D * (mc.options.chatLineSpacing + 1.0D) + 4.0D * mc.options.chatLineSpacing + 8.0D;
    matrices.push();
    matrices.translate(2, -0.1f, 10);
    RenderSystem.enableBlend();
    for (int m = 0; m + this.scrolledLines < this.visibleMessages.size() && m < maxLineCount; ++m) {
        ChatHudLine<OrderedText> chatHudLine = this.visibleMessages.get(m + this.scrolledLines);
        if (chatHudLine != null) {
            int x = tickDelta - chatHudLine.getCreationTick();
            if (x < 200 || isChatFocused()) {
                double o = isChatFocused() ? 1.0D : getMessageOpacityMultiplier(x);
                if (o * d > 0.01D) {
                    double s = ((double) (-m) * g);
                    StringCharacterVisitor visitor = new StringCharacterVisitor();
                    chatHudLine.getText().accept(visitor);
                    drawIcon(matrices, visitor.result.toString(), (int) (s + h), (float) (o * d));
                }
            }
        }
    }
    RenderSystem.disableBlend();
    matrices.pop();
}
Also used : StringCharacterVisitor(meteordevelopment.meteorclient.utils.misc.text.StringCharacterVisitor) OrderedText(net.minecraft.text.OrderedText) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

StringCharacterVisitor (meteordevelopment.meteorclient.utils.misc.text.StringCharacterVisitor)1 OrderedText (net.minecraft.text.OrderedText)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1