Подписывайтесь на наш Telegram и не пропускайте важные новости! Перейти

Часть функционала Skid arbuz hud | from my cheat

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
26 Мар 2026
Сообщения
26
Реакции
0
Выберите загрузчик игры
  1. Vanilla
  2. Forge
  3. Fabric
Попытка заскидить старый худ абузика можно настроить прозрачность, размер. Надеюсь оцените (nuclear beta base)

ss
1775538964585.png


hud2:
Expand Collapse Copy
package social.module.impl.render;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Vector3d;
import social.Social;
import social.control.Manager;
import social.control.drag.Dragging;
import social.control.events.Event;
import social.control.events.impl.render.EventRender;
import social.module.TypeList;
import social.module.api.Annotation;
import social.module.api.Module;
import social.module.settings.imp.BooleanSetting;
import social.module.settings.imp.MultiBoxSetting;
import social.module.settings.imp.SliderSetting;
import social.utils.ClientUtils;
import social.utils.anim.Animation;
import social.utils.anim.Direction;
import social.utils.anim.impl.DecelerateAnimation;
import social.utils.anim.impl.EaseBackIn;
import social.utils.font.Fonts;
import social.utils.font.styled.StyledFont;
import social.utils.misc.TimerUtil;
import social.utils.render.ColorUtils;
import social.utils.render.RenderUtils;
import social.utils.render.StencilUtils;
import social.utils.render.animation.AnimationMath;

import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

import static social.ui.clickgui.Panel.getColorByName;

@Annotation(name = "Hud2", type = TypeList.Render, desc = "второйхудепты")
public class Hud2 extends Module {

    public MultiBoxSetting elements = new MultiBoxSetting("Elements",
            new BooleanSetting("Watermark", true),
            new BooleanSetting("Keybinds", true),
            new BooleanSetting("Potions", true),
            new BooleanSetting("Target HUD", true));

    public SliderSetting size      = new SliderSetting("Scale",      1,   0.8f, 1.2f, 0.05f);
    public SliderSetting bgOpacity = new SliderSetting("BG Opacity", 200, 0,    255,   5);

    public final Dragging watermark = Social.createDrag(this, "H2Watermark", 7,   7);
    public final Dragging keyBinds  = Social.createDrag(this, "H2KeyBinds",  7,  30);
    public final Dragging potionHUD = Social.createDrag(this, "H2Potion",    7,  80);
    public final Dragging targetHUD = Social.createDrag(this, "H2Target",  300, 200);

    private float wmHue = 0f;

    private float animatedWidth   = 70f;
    private float lastTargetWidth = 0f;
    private float startWidth      = 70f;
    private final Animation kbAlpha   = new DecelerateAnimation(250, 1.0);
    private final Animation widthAnim = new DecelerateAnimation(250, 1.0);

    private final Map<Integer, Animation>      potionAnimations = new HashMap<>();
    private final Map<Integer, EffectInstance> lastKnownEffects = new HashMap<>();
    private float animatedPotionWidth = 75f;
    private final Animation potionAlphaAnim = new EaseBackIn(300, 1, 1.5f);

    private LivingEntity target                 = null;
    private boolean      allow                  = false;
    private boolean      particlesSpawnedThisHit = false;
    private float        health = 0, health2 = 0;
    private float        healthplus = 0, healthplus2 = 0;
    private final Animation thudAlpha   = new DecelerateAnimation(250, 1.0);
    private final TimerUtil targetTimer = new TimerUtil();

    private static class LocalParticle {
        Vector3d pos;
        final Vector3d end;
        final long time;
        float alpha;

        LocalParticle(Vector3d origin) {
            this.pos   = origin;
            this.end   = origin.add(
                    ThreadLocalRandom.current().nextDouble(-40, 40),
                    ThreadLocalRandom.current().nextDouble(-40, 40),
                    0);
            this.time  = System.currentTimeMillis();
            this.alpha = 0f;
        }

        void update() {
            alpha = MathHelper.lerp(alpha, 1f, 0.1f);
            pos   = AnimationMath.fast(pos, end, 0.5f);
        }
    }

    private final List<LocalParticle> particles = new ArrayList<>();

    public Hud2() {
        addSettings(elements, size, bgOpacity);
    }

    private float getScale() {
        return size.getValue().floatValue();
    }

    private int getBgOpacity(float alpha) {
        return (int)(bgOpacity.getValue().floatValue() * alpha);
    }

    private StyledFont font(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.newcode.length - 1));
        if (Fonts.newcode[s] != null) return Fonts.newcode[s];
        for (int i = s; i >= 10; i--)
            if (i < Fonts.newcode.length && Fonts.newcode[i] != null) return Fonts.newcode[i];
        return Fonts.newcode[Math.min(14, Fonts.newcode.length - 1)];
    }

    private int iconSz(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.icon.length - 1));
        if (Fonts.icon[s] != null) return s;
        for (int i = s; i >= 10; i--)
            if (i < Fonts.icon.length && Fonts.icon[i] != null) return i;
        return Math.min(15, Fonts.icon.length - 1);
    }

    private int icon2Sz(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.icon2.length - 1));
        if (Fonts.icon2[s] != null) return s;
        for (int i = s; i >= 10; i--)
            if (i < Fonts.icon2.length && Fonts.icon2[i] != null) return i;
        return Math.min(15, Fonts.icon2.length - 1);
    }

    @Override
    public boolean onEvent(Event event) {
        if (!(event instanceof EventRender er) || !er.isRender2D()) return false;
        MatrixStack stack = er.matrixStack;
        if (mc.gameSettings.showDebugInfo) return false;
        if (elements.get(0)) renderWatermark(stack);
        if (elements.get(1)) renderKeyBinds(stack);
        if (elements.get(2)) renderPotions(stack);
        if (elements.get(3)) renderTarget(stack);
        return false;
    }

    private void renderWatermark(MatrixStack stack) {
        if (mc.player == null) return;
        float scale = getScale();
        float x = watermark.getX(), y = watermark.getY();
        float h = 13f * scale, r = 3f * scale, pad = 5f * scale;

        StyledFont f = font(13);

        wmHue += 0.005f;
        if (wmHue > 1f) wmHue -= 1f;
        float hue = 0.611f + (float)(Math.sin(wmHue * Math.PI * 2) * 0.5 + 0.5) * 0.056f;
        int arbuzColor = Color.HSBtoRGB(hue, 0.65f, 1.00f) | 0xFF000000;

        String clientName = "social";
        String gap        = "    ";
        String serverIp   = getServerIp();
        String playerName = mc.player.getName().getString();

        float nameW   = f.getWidth(clientName);
        float gapW    = f.getWidth(gap);
        float ipW     = f.getWidth(serverIp);
        float playerW = f.getWidth(playerName);
        float totalW  = pad + nameW + gapW + ipW + gapW + playerW + pad;

        int fonColor  = ColorUtils.setAlpha(getColorByName("fonColor"), getBgOpacity(1f));
        int textColor = getColorByName("textColor");
        int dotColor  = ColorUtils.setAlpha(textColor, 130);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(x, y, totalW, h, r, fonColor, 1f);

        float fontH = f.getFontHeight() / 2f;
        float ty    = y + (h - fontH) / 2f;
        float dotY  = y + h / 2f;
        float dotR  = 1.2f * scale;

        float cx = x + pad;

        f.drawString(stack, clientName, cx, ty, arbuzColor);
        cx += nameW + gapW / 2f;

        RenderUtils.Render2D.drawCircle2(cx, dotY - 0.5f * scale, dotR * 0.55f, dotColor);
        cx += gapW / 2f;

        f.drawString(stack, serverIp, cx, ty, textColor);
        cx += ipW + gapW / 2f;

        RenderUtils.Render2D.drawCircle2(cx, dotY - 0.5f * scale, dotR * 0.55f, dotColor);
        cx += gapW / 2f;

        f.drawString(stack, playerName, cx, ty, textColor);

        watermark.setWidth(totalW);
        watermark.setHeight(h);
    }

    private String getServerIp() {
        if (mc.getCurrentServerData() != null) {
            String ip = mc.getCurrentServerData().serverIP;
            return (ip != null && !ip.isEmpty()) ? ip : "singleplayer";
        }
        return "singleplayer";
    }

    private void renderKeyBinds(MatrixStack stack) {
        if (Manager.FUNCTION_MANAGER == null) return;
        float scale = getScale();
        boolean isChatOpen = mc.currentScreen instanceof ChatScreen;

        StyledFont nameFont = font(13), bindFont = font(11);
        int i2sz = icon2Sz(15);

        List<Module> activeBinds = new ArrayList<>();
        float maxW = 0;

        for (Module f : Manager.FUNCTION_MANAGER.getFunctions()) {
            if (f == null) continue;
            f.animation.setDirection(f.state && f.bind != 0 ? Direction.FORWARDS : Direction.BACKWARDS);
            if (!f.animation.isDone() || (f.state && f.bind != 0)) {
                activeBinds.add(f);
                String bind = formatBind(f.bind);
                float w = nameFont.getWidth(f.name) + bindFont.getWidth(bind) + 24f * scale;
                if (w > maxW) maxW = w;
            }
        }

        kbAlpha.setDirection((!activeBinds.isEmpty() || isChatOpen) ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) kbAlpha.getOutput();
        if (alpha <= 0.01f) { animatedWidth = 70f * scale; return; }

        float targetW = Math.max(70f * scale, maxW);
        if (targetW != lastTargetWidth) {
            startWidth = animatedWidth; lastTargetWidth = targetW; widthAnim.reset();
        }
        animatedWidth = widthAnim.isDone()
                ? targetW
                : startWidth + (targetW - startWidth) * (float) widthAnim.getOutput();

        float posX = keyBinds.getX(), posY = keyBinds.getY();
        float headerH = 15f * scale, itemH = 9f * scale;

        float yOff = 0;
        for (Module f : activeBinds) yOff += itemH * f.animation.getOutput();
        float winH = headerH + (activeBinds.isEmpty() ? (isChatOpen ? 3f * scale : 0f) : yOff + 4f * scale);

        int elAlpha   = (int)(255 * alpha);
        int fonColor  = ColorUtils.setAlpha(getColorByName("fonColor"),  getBgOpacity(alpha));
        int infoColor = ColorUtils.setAlpha(getColorByName("infoColor"), elAlpha);
        int iconColor = ColorUtils.setAlpha(getColorByName("iconColor"), elAlpha);
        int textColor = ColorUtils.setAlpha(getColorByName("textColor"), elAlpha);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(posX, posY, animatedWidth, winH, 4f * scale, fonColor, alpha);

        String headerIcon = "f";
        float iconW = Fonts.icon2[i2sz].getWidth(headerIcon);
        Fonts.icon2[i2sz].drawString(stack, headerIcon, posX + 4f * scale, posY + 5.5f * scale, iconColor);
        font(14).drawString(stack, "Binds", posX + 4f * scale + iconW + 3f * scale, posY + 6f * scale, infoColor);

        float renderY = posY + headerH + 1f * scale;
        for (Module f : activeBinds) {
            float anim = (float) f.animation.getOutput();
            if (anim > 0.01f) {
                stack.push();
                float cy = renderY + itemH / 2f;
                stack.translate(posX + animatedWidth / 2f, cy, 0);
                stack.scale(1f, anim, 1f);
                stack.translate(-(posX + animatedWidth / 2f), -cy, 0);

                nameFont.drawString(stack, f.name, posX + 6f * scale, renderY + 3f * scale,
                        ColorUtils.setAlpha(textColor, (int)(220 * anim)));

                String bind = formatBind(f.bind);
                float bw = bindFont.getWidth(bind);
                bindFont.drawString(stack, bind, posX + animatedWidth - bw - 5f * scale, renderY + 3.5f * scale,
                        ColorUtils.setAlpha(textColor, (int)(160 * anim)));

                stack.pop();
                renderY += itemH * anim;
            }
        }

        keyBinds.setWidth(animatedWidth);
        keyBinds.setHeight(winH);
    }

    private String formatBind(int bind) {
        String b = ClientUtils.getKey(bind)
                .replace("MOUSE",   "M")
                .replace("CONTROL", "C")
                .replace("LEFT",    "L")
                .replace("RIGHT",   "R")
                .replace("_",       "");
        return b.substring(0, Math.min(b.length(), 4)).toUpperCase();
    }

    private void renderPotions(MatrixStack stack) {
        if (mc.player == null) return;
        float scale = getScale();
        float posX = potionHUD.getX(), posY = potionHUD.getY();
        float headerH = 15f * scale, itemH = 9f * scale;

        Collection<EffectInstance> current = mc.player.getActivePotionEffects();
        for (EffectInstance eff : current) {
            int id = System.identityHashCode(eff);
            lastKnownEffects.put(id, eff);
            potionAnimations.computeIfAbsent(id, k -> new EaseBackIn(300, 1, 1.5f))
                    .setDirection(Direction.FORWARDS);
        }
        potionAnimations.forEach((id, anim) -> {
            if (current.stream().noneMatch(e -> System.identityHashCode(e) == id))
                anim.setDirection(Direction.BACKWARDS);
        });

        List<Integer> toRender = new ArrayList<>();
        float maxW = 0;
        StyledFont effFont = font(13), durFont = font(12);

        for (Map.Entry<Integer, Animation> e : potionAnimations.entrySet()) {
            int id = e.getKey();
            if (!e.getValue().isDone() || e.getValue().getDirection() == Direction.FORWARDS) {
                EffectInstance inst = lastKnownEffects.get(id);
                if (inst != null) {
                    toRender.add(id);
                    float w = effFont.getWidth(I18n.format(inst.getEffectName()))
                            + durFont.getWidth(EffectUtils.getPotionDurationString(inst, 1f))
                            + 35f * scale;
                    if (w > maxW) maxW = w;
                }
            }
        }

        boolean isChatOpen = mc.currentScreen instanceof ChatScreen;
        potionAlphaAnim.setDirection((!toRender.isEmpty() || isChatOpen) ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) Math.max(0, Math.min(1, potionAlphaAnim.getOutput()));
        if (alpha <= 0f) { animatedPotionWidth = 75f * scale; return; }

        float targetW = Math.max(75f * scale, maxW);
        animatedPotionWidth += (targetW - animatedPotionWidth) * 0.15f;

        int elAlpha     = (int)(255 * alpha);
        int fonColor    = ColorUtils.setAlpha(getColorByName("fonColor"),    getBgOpacity(alpha));
        int infoColor   = ColorUtils.setAlpha(getColorByName("infoColor"),   elAlpha);
        int iconColor   = ColorUtils.setAlpha(getColorByName("iconColor"),   elAlpha);
        int textColor   = ColorUtils.setAlpha(getColorByName("textColor"),   elAlpha);
        int iconnoColor = ColorUtils.setAlpha(getColorByName("iconnoColor"), (int)(30 * alpha));

        float yOff = 0;
        for (int id : toRender)
            yOff += itemH * (float) Math.max(0, potionAnimations.get(id).getOutput());
        float winH = headerH + (toRender.isEmpty() ? (isChatOpen ? 3f * scale : 0f) : yOff + 4f * scale);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(posX, posY, animatedPotionWidth, winH, 4f * scale, fonColor, alpha);

        int i2sz = icon2Sz(15);
        Fonts.icon2[i2sz].drawString(stack, "e", posX + 4f * scale, posY + 5.5f * scale, iconColor);
        font(14).drawString(stack, "Potions",
                posX + 4f * scale + Fonts.icon2[i2sz].getWidth("e") + 3f * scale,
                posY + 6f * scale, infoColor);

        float renderY = posY + headerH + 1f * scale;
        for (int id : toRender) {
            EffectInstance inst = lastKnownEffects.get(id);
            Animation anim = potionAnimations.get(id);
            float animP = (float) Math.max(0, anim.getOutput());
            if (animP > 0.001f) {
                float flash = (inst.getDuration() > 0 && inst.getDuration() <= 100)
                        ? 0.4f + (float)(Math.sin(System.currentTimeMillis() / 150.0) + 1.0) / 3.33f
                        : 1f;

                stack.push();
                float cy = renderY + itemH / 2f;
                stack.translate(posX + animatedPotionWidth / 2f, cy, 0);
                stack.scale(1f, animP, 1f);
                stack.translate(-(posX + animatedPotionWidth / 2f), -cy, 0);

                float slide = (1f - animP) * 10f * scale;
                int fAlpha = Math.max(0, Math.min(255, (int)(elAlpha * animP * flash)));
                Effect eff = inst.getPotion();
                String text = I18n.format(inst.getEffectName());
                String dur  = EffectUtils.getPotionDurationString(inst, 1f);
                String lvl  = inst.getAmplifier() != 0 ? " " + (inst.getAmplifier() + 1) : "";
                int effColor = !eff.isBeneficial()
                        ? new Color(182, 35, 35, fAlpha).getRGB()
                        : ColorUtils.setAlpha(textColor, (int)(220 * animP * flash));

                RenderSystem.depthMask(false);
                RenderSystem.enableBlend();
                RenderSystem.defaultBlendFunc();
                TextureAtlasSprite sprite = mc.getPotionSpriteUploader().getSprite(eff);
                mc.getTextureManager().bindTexture(sprite.getAtlasTexture().getTextureLocation());
                blitSprite(stack, posX + 4.5f * scale - slide, renderY + 1f * scale, 10,
                        (int)(7 * scale), (int)(7 * scale), sprite, fAlpha / 255f);
                RenderSystem.depthMask(true);

                effFont.drawString(stack, text, posX + 13f * scale - slide, renderY + 3f * scale, effColor);
                if (inst.getAmplifier() != 0)
                    durFont.drawString(stack, lvl,
                            posX + 13f * scale + effFont.getWidth(text) - slide,
                            renderY + 3f * scale,
                            ColorUtils.setAlpha(textColor, (int)(200 * animP * flash)));

                float tw = durFont.getWidth(dur);
                float tx = posX + animatedPotionWidth - tw - 6f * scale + slide;
                RenderUtils.Render2D.drawRoundedRect(tx - 2f * scale, renderY + 0.5f * scale,
                        tw + 4f * scale, 8f * scale, 1.5f * scale,
                        ColorUtils.setAlpha(iconnoColor, (int)(fAlpha * 0.4f)));
                durFont.drawString(stack, dur, tx, renderY + 3.5f * scale,
                        ColorUtils.setAlpha(textColor, (int)(180 * animP * flash)));

                stack.pop();
                renderY += itemH * animP;
            }
        }

        potionAnimations.entrySet().removeIf(e -> {
            if (e.getValue().isDone() && e.getValue().getDirection() == Direction.BACKWARDS) {
                lastKnownEffects.remove(e.getKey());
                return true;
            }
            return false;
        });

        potionHUD.setWidth(animatedPotionWidth);
        potionHUD.setHeight(winH);
    }

    private void renderTarget(MatrixStack stack) {
        if (mc.player == null || Manager.FUNCTION_MANAGER == null) return;
        float scale = getScale();
        target = resolveTarget(target);
        if (target == null) return;

        thudAlpha.setDirection(allow ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) thudAlpha.getOutput();

        if (target.hurtTime > 0 && !particlesSpawnedThisHit) {
            spawnParticles(); particlesSpawnedThisHit = true;
        } else if (target.hurtTime == 0) {
            particlesSpawnedThisHit = false;
        }

        if (alpha <= 0f) { target = null; return; }

        float x = targetHUD.getX(), y = targetHUD.getY();
        float w = 90f * scale;

        int firstColor = getColorByName("primaryColor");
        int textColor  = getColorByName("textColor");
        int iconColor  = getColorByName("iconColor");
        int goldColor  = getColorByName("goldColor");
        int elAlpha    = (int)(255 * alpha);
        int fonColor   = ColorUtils.setAlpha(getColorByName("fonColor"), getBgOpacity(alpha));

        float faceSize = 24f * scale;
        float itemRowH = 10f * scale;
        float infoH    = faceSize;
        float h        = itemRowH + infoH + 6f * scale;
      
        RenderUtils.Render2D.drawBlurredRoundedRectangle(x, y + itemRowH, w, infoH + 6f * scale,
                4f * scale, fonColor, alpha);
      
      
        renderItemRow(stack, target, x, y, w, scale, elAlpha);

        float contentY = y + itemRowH;
        float faceX    = x + 3f * scale;
        float faceY    = contentY + 3f * scale;

        if (target instanceof AbstractClientPlayerEntity acp) {
            RenderUtils.Render2D.drawRoundFace(faceX, faceY, (int) faceSize, (int) faceSize,
                    3f * scale, alpha, acp);
            if (target.hurtTime > 0)
                RenderUtils.Render2D.drawRoundedRect(
                        faceX - 0.3f * scale, faceY - 0.3f * scale,
                        faceSize + 0.6f * scale, faceSize + 0.6f * scale, 2.5f * scale,
                        new Color(255, 0, 0, (int)(target.hurtTime / 10f * alpha * 100)).getRGB());
        } else {
            StencilUtils.initStencilToWrite();
            RenderUtils.Render2D.drawRoundedRect(faceX, faceY, faceSize, faceSize, 3f * scale,
                    ColorUtils.rgba(21, 21, 21, (int)(190 * alpha)));
            StencilUtils.readStencilBuffer(1);
            int fSz = iconSz(50);
            float iw = Fonts.icon[fSz].getWidth(">");
            Fonts.icon[fSz].drawString(stack, ">",
                    faceX + (faceSize - iw) / 2f, faceY + 2.5f * scale,
                    ColorUtils.setAlpha(iconColor, elAlpha));
            StencilUtils.uninitStencilBuffer();
        }

        float textX = x + faceSize + 6f * scale;
        float textY = contentY + 4f * scale;

        font(13).drawScissorString(stack, target.getName().getString(), textX, textY,
                ColorUtils.setAlpha(textColor, elAlpha), (int)(w - faceSize - 9f * scale));

        health      = MathHelper.clamp(AnimationMath.fast(health,      target.getHealth() / target.getMaxHealth(),           12),   0, 1);
        health2     = MathHelper.clamp(AnimationMath.fast(health2,     target.getHealth() / target.getMaxHealth(),           4.5f), 0, 1);
        healthplus  = MathHelper.clamp(AnimationMath.fast(healthplus,  target.getAbsorptionAmount() / target.getMaxHealth(), 12),   0, 1);
        healthplus2 = MathHelper.clamp(AnimationMath.fast(healthplus2, target.getAbsorptionAmount() / target.getMaxHealth(), 4.5f), 0, 1);

        Color bc = new Color(firstColor);
        float[] hsb = Color.RGBtoHSB(bc.getRed(), bc.getGreen(), bc.getBlue(), null);
        int darker   = Color.getHSBColor(hsb[0], hsb[1], Math.max(0f, hsb[2] - 0.4f)).getRGB();
        Color gC     = new Color(goldColor);
        int darkGold = new Color((int)(gC.getRed()*0.6f),(int)(gC.getGreen()*0.6f),(int)(gC.getBlue()*0.6f)).getRGB();

        String hpStr = (int)(health * target.getMaxHealth()) + " HP";
        Color tc2 = new Color(textColor);
        float[] hsbt = Color.RGBtoHSB(tc2.getRed(), tc2.getGreen(), tc2.getBlue(), null);
        int dimText = ColorUtils.setAlpha(
                Color.getHSBColor(hsbt[0], hsbt[1], Math.max(0f, hsbt[2] - 0.15f)).getRGB(), elAlpha);
        font(11).drawString(stack, hpStr, textX, textY + 9f * scale, dimText);

        float barX = textX;
        float barY = contentY + infoH - 5f * scale;
        float barW = w - faceSize - 9f * scale;
        float barH = 4f * scale;
      
        RenderUtils.Render2D.drawRoundedRect(barX, barY, barW, barH, 2f * scale,
                ColorUtils.setAlpha(firstColor, (int)(55 * alpha)));
      
        if (health >= healthplus) {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health2,  barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(firstColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darker,     (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health,   barH, 2f * scale,
                    ColorUtils.setAlpha(firstColor, elAlpha),
                    ColorUtils.setAlpha(darker,     elAlpha));
        } else {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * healthplus2, barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(goldColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darkGold,  (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * healthplus,  barH, 2f * scale,
                    ColorUtils.setAlpha(goldColor, elAlpha),
                    ColorUtils.setAlpha(darkGold,  elAlpha));
        }
        if (health < healthplus && healthplus > 0) {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health2,  barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(firstColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darker,     (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health,   barH, 2f * scale,
                    ColorUtils.setAlpha(firstColor, elAlpha),
                    ColorUtils.setAlpha(darker,     elAlpha));
        }

        particles.removeIf(p -> System.currentTimeMillis() - p.time > 2000L);
        for (LocalParticle p : particles) {
            p.update();
            float life = 1f - (float)(System.currentTimeMillis() - p.time) / 2000f;
            float ps   = life * 3f * scale;
            if (ps > 0)
                RenderUtils.Render2D.drawRoundedCorner((float) p.pos.x, (float) p.pos.y,
                        ps, ps, ps / 2f,
                        ColorUtils.setAlpha(firstColor, (int)(255f * p.alpha * life)));
        }

        targetHUD.setWidth(w);
        targetHUD.setHeight(h);
    }

    private void renderItemRow(MatrixStack stack, LivingEntity entity,
                               float x, float y, float w, float scale, int elAlpha) {
        float itemSz = 9f * scale;
        float rowH   = 10f * scale;
        float itemY  = y + (rowH - itemSz) / 2f;

        List<ItemStack> all = new ArrayList<>();

        ItemStack offHand = entity.getHeldItemOffhand();
        if (!offHand.isEmpty()) all.add(offHand);

        List<ItemStack> armor = new ArrayList<>();
        for (ItemStack s : entity.getArmorInventoryList()) armor.add(s);
        all.addAll(armor);

        ItemStack mainHand = entity.getHeldItemMainhand();
        if (!mainHand.isEmpty()) all.add(mainHand);

        int count = (int) all.stream().filter(s -> !s.isEmpty()).count();
        if (count == 0) return;

        float totalItemW = count * itemSz + (count - 1) * scale;
        float startX     = x + (w - totalItemW) / 2f;
        float sc         = itemSz / 16f;

        com.mojang.blaze3d.platform.GlStateManager.pushMatrix();
        com.mojang.blaze3d.platform.GlStateManager.scaled(sc, sc, 1.0);

        float cx = startX;
        for (ItemStack s : all) {
            if (s.isEmpty()) continue;
            Hud.drawItemStack(s, cx / sc, itemY / sc, "", false);
            cx += itemSz + scale;
        }

        com.mojang.blaze3d.platform.GlStateManager.popMatrix();
    }

    private LivingEntity resolveTarget(LivingEntity prev) {
        if (Manager.FUNCTION_MANAGER == null) return null;
        LivingEntity t = prev;
        Object auraTarget = Manager.FUNCTION_MANAGER.auraFunction.getTarget();
        if (auraTarget instanceof LivingEntity le) {
            t = le; targetTimer.reset(); allow = true;
        } else if (mc.currentScreen instanceof ChatScreen) {
            t = mc.player; targetTimer.reset(); allow = true;
        } else if (allow && targetTimer.isReached(200)) {
            allow = false;
        }
        return t;
    }

    private void spawnParticles() {
        float hx = targetHUD.getX() + 12f * getScale();
        float hy = targetHUD.getY() + 20f * getScale();
        for (int i = 0; i < 8; i++)
            particles.add(new LocalParticle(new Vector3d(hx, hy, 0)));
    }

    private void blitSprite(MatrixStack ms, float x, float y, int blitOffset,
                            int width, int height, TextureAtlasSprite sprite, float alpha) {
        Matrix4f matrix = ms.getLast().getMatrix();
        BufferBuilder bb = Tessellator.getInstance().getBuffer();
        int a = (int)(alpha * 255);
        bb.begin(7, DefaultVertexFormats.POSITION_COLOR_TEX);
        bb.pos(matrix, x,         y + height, blitOffset).color(255,255,255,a).tex(sprite.getMinU(), sprite.getMaxV()).endVertex();
        bb.pos(matrix, x + width, y + height, blitOffset).color(255,255,255,a).tex(sprite.getMaxU(), sprite.getMaxV()).endVertex();
        bb.pos(matrix, x + width, y,          blitOffset).color(255,255,255,a).tex(sprite.getMaxU(), sprite.getMinV()).endVertex();
        bb.pos(matrix, x,         y,          blitOffset).color(255,255,255,a).tex(sprite.getMinU(), sprite.getMinV()).endVertex();
        bb.finishDrawing();
        RenderSystem.enableBlend();
        RenderSystem.defaultBlendFunc();
        WorldVertexBufferUploader.draw(bb);
    }
}
 
Попытка заскидить старый худ абузика можно настроить прозрачность, размер. Надеюсь оцените (nuclear beta base)

ss
Посмотреть вложение 332592

hud2:
Expand Collapse Copy
package social.module.impl.render;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Vector3d;
import social.Social;
import social.control.Manager;
import social.control.drag.Dragging;
import social.control.events.Event;
import social.control.events.impl.render.EventRender;
import social.module.TypeList;
import social.module.api.Annotation;
import social.module.api.Module;
import social.module.settings.imp.BooleanSetting;
import social.module.settings.imp.MultiBoxSetting;
import social.module.settings.imp.SliderSetting;
import social.utils.ClientUtils;
import social.utils.anim.Animation;
import social.utils.anim.Direction;
import social.utils.anim.impl.DecelerateAnimation;
import social.utils.anim.impl.EaseBackIn;
import social.utils.font.Fonts;
import social.utils.font.styled.StyledFont;
import social.utils.misc.TimerUtil;
import social.utils.render.ColorUtils;
import social.utils.render.RenderUtils;
import social.utils.render.StencilUtils;
import social.utils.render.animation.AnimationMath;

import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

import static social.ui.clickgui.Panel.getColorByName;

@Annotation(name = "Hud2", type = TypeList.Render, desc = "второйхудепты")
public class Hud2 extends Module {

    public MultiBoxSetting elements = new MultiBoxSetting("Elements",
            new BooleanSetting("Watermark", true),
            new BooleanSetting("Keybinds", true),
            new BooleanSetting("Potions", true),
            new BooleanSetting("Target HUD", true));

    public SliderSetting size      = new SliderSetting("Scale",      1,   0.8f, 1.2f, 0.05f);
    public SliderSetting bgOpacity = new SliderSetting("BG Opacity", 200, 0,    255,   5);

    public final Dragging watermark = Social.createDrag(this, "H2Watermark", 7,   7);
    public final Dragging keyBinds  = Social.createDrag(this, "H2KeyBinds",  7,  30);
    public final Dragging potionHUD = Social.createDrag(this, "H2Potion",    7,  80);
    public final Dragging targetHUD = Social.createDrag(this, "H2Target",  300, 200);

    private float wmHue = 0f;

    private float animatedWidth   = 70f;
    private float lastTargetWidth = 0f;
    private float startWidth      = 70f;
    private final Animation kbAlpha   = new DecelerateAnimation(250, 1.0);
    private final Animation widthAnim = new DecelerateAnimation(250, 1.0);

    private final Map<Integer, Animation>      potionAnimations = new HashMap<>();
    private final Map<Integer, EffectInstance> lastKnownEffects = new HashMap<>();
    private float animatedPotionWidth = 75f;
    private final Animation potionAlphaAnim = new EaseBackIn(300, 1, 1.5f);

    private LivingEntity target                 = null;
    private boolean      allow                  = false;
    private boolean      particlesSpawnedThisHit = false;
    private float        health = 0, health2 = 0;
    private float        healthplus = 0, healthplus2 = 0;
    private final Animation thudAlpha   = new DecelerateAnimation(250, 1.0);
    private final TimerUtil targetTimer = new TimerUtil();

    private static class LocalParticle {
        Vector3d pos;
        final Vector3d end;
        final long time;
        float alpha;

        LocalParticle(Vector3d origin) {
            this.pos   = origin;
            this.end   = origin.add(
                    ThreadLocalRandom.current().nextDouble(-40, 40),
                    ThreadLocalRandom.current().nextDouble(-40, 40),
                    0);
            this.time  = System.currentTimeMillis();
            this.alpha = 0f;
        }

        void update() {
            alpha = MathHelper.lerp(alpha, 1f, 0.1f);
            pos   = AnimationMath.fast(pos, end, 0.5f);
        }
    }

    private final List<LocalParticle> particles = new ArrayList<>();

    public Hud2() {
        addSettings(elements, size, bgOpacity);
    }

    private float getScale() {
        return size.getValue().floatValue();
    }

    private int getBgOpacity(float alpha) {
        return (int)(bgOpacity.getValue().floatValue() * alpha);
    }

    private StyledFont font(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.newcode.length - 1));
        if (Fonts.newcode[s] != null) return Fonts.newcode[s];
        for (int i = s; i >= 10; i--)
            if (i < Fonts.newcode.length && Fonts.newcode[i] != null) return Fonts.newcode[i];
        return Fonts.newcode[Math.min(14, Fonts.newcode.length - 1)];
    }

    private int iconSz(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.icon.length - 1));
        if (Fonts.icon[s] != null) return s;
        for (int i = s; i >= 10; i--)
            if (i < Fonts.icon.length && Fonts.icon[i] != null) return i;
        return Math.min(15, Fonts.icon.length - 1);
    }

    private int icon2Sz(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.icon2.length - 1));
        if (Fonts.icon2[s] != null) return s;
        for (int i = s; i >= 10; i--)
            if (i < Fonts.icon2.length && Fonts.icon2[i] != null) return i;
        return Math.min(15, Fonts.icon2.length - 1);
    }

    @Override
    public boolean onEvent(Event event) {
        if (!(event instanceof EventRender er) || !er.isRender2D()) return false;
        MatrixStack stack = er.matrixStack;
        if (mc.gameSettings.showDebugInfo) return false;
        if (elements.get(0)) renderWatermark(stack);
        if (elements.get(1)) renderKeyBinds(stack);
        if (elements.get(2)) renderPotions(stack);
        if (elements.get(3)) renderTarget(stack);
        return false;
    }

    private void renderWatermark(MatrixStack stack) {
        if (mc.player == null) return;
        float scale = getScale();
        float x = watermark.getX(), y = watermark.getY();
        float h = 13f * scale, r = 3f * scale, pad = 5f * scale;

        StyledFont f = font(13);

        wmHue += 0.005f;
        if (wmHue > 1f) wmHue -= 1f;
        float hue = 0.611f + (float)(Math.sin(wmHue * Math.PI * 2) * 0.5 + 0.5) * 0.056f;
        int arbuzColor = Color.HSBtoRGB(hue, 0.65f, 1.00f) | 0xFF000000;

        String clientName = "social";
        String gap        = "    ";
        String serverIp   = getServerIp();
        String playerName = mc.player.getName().getString();

        float nameW   = f.getWidth(clientName);
        float gapW    = f.getWidth(gap);
        float ipW     = f.getWidth(serverIp);
        float playerW = f.getWidth(playerName);
        float totalW  = pad + nameW + gapW + ipW + gapW + playerW + pad;

        int fonColor  = ColorUtils.setAlpha(getColorByName("fonColor"), getBgOpacity(1f));
        int textColor = getColorByName("textColor");
        int dotColor  = ColorUtils.setAlpha(textColor, 130);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(x, y, totalW, h, r, fonColor, 1f);

        float fontH = f.getFontHeight() / 2f;
        float ty    = y + (h - fontH) / 2f;
        float dotY  = y + h / 2f;
        float dotR  = 1.2f * scale;

        float cx = x + pad;

        f.drawString(stack, clientName, cx, ty, arbuzColor);
        cx += nameW + gapW / 2f;

        RenderUtils.Render2D.drawCircle2(cx, dotY - 0.5f * scale, dotR * 0.55f, dotColor);
        cx += gapW / 2f;

        f.drawString(stack, serverIp, cx, ty, textColor);
        cx += ipW + gapW / 2f;

        RenderUtils.Render2D.drawCircle2(cx, dotY - 0.5f * scale, dotR * 0.55f, dotColor);
        cx += gapW / 2f;

        f.drawString(stack, playerName, cx, ty, textColor);

        watermark.setWidth(totalW);
        watermark.setHeight(h);
    }

    private String getServerIp() {
        if (mc.getCurrentServerData() != null) {
            String ip = mc.getCurrentServerData().serverIP;
            return (ip != null && !ip.isEmpty()) ? ip : "singleplayer";
        }
        return "singleplayer";
    }

    private void renderKeyBinds(MatrixStack stack) {
        if (Manager.FUNCTION_MANAGER == null) return;
        float scale = getScale();
        boolean isChatOpen = mc.currentScreen instanceof ChatScreen;

        StyledFont nameFont = font(13), bindFont = font(11);
        int i2sz = icon2Sz(15);

        List<Module> activeBinds = new ArrayList<>();
        float maxW = 0;

        for (Module f : Manager.FUNCTION_MANAGER.getFunctions()) {
            if (f == null) continue;
            f.animation.setDirection(f.state && f.bind != 0 ? Direction.FORWARDS : Direction.BACKWARDS);
            if (!f.animation.isDone() || (f.state && f.bind != 0)) {
                activeBinds.add(f);
                String bind = formatBind(f.bind);
                float w = nameFont.getWidth(f.name) + bindFont.getWidth(bind) + 24f * scale;
                if (w > maxW) maxW = w;
            }
        }

        kbAlpha.setDirection((!activeBinds.isEmpty() || isChatOpen) ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) kbAlpha.getOutput();
        if (alpha <= 0.01f) { animatedWidth = 70f * scale; return; }

        float targetW = Math.max(70f * scale, maxW);
        if (targetW != lastTargetWidth) {
            startWidth = animatedWidth; lastTargetWidth = targetW; widthAnim.reset();
        }
        animatedWidth = widthAnim.isDone()
                ? targetW
                : startWidth + (targetW - startWidth) * (float) widthAnim.getOutput();

        float posX = keyBinds.getX(), posY = keyBinds.getY();
        float headerH = 15f * scale, itemH = 9f * scale;

        float yOff = 0;
        for (Module f : activeBinds) yOff += itemH * f.animation.getOutput();
        float winH = headerH + (activeBinds.isEmpty() ? (isChatOpen ? 3f * scale : 0f) : yOff + 4f * scale);

        int elAlpha   = (int)(255 * alpha);
        int fonColor  = ColorUtils.setAlpha(getColorByName("fonColor"),  getBgOpacity(alpha));
        int infoColor = ColorUtils.setAlpha(getColorByName("infoColor"), elAlpha);
        int iconColor = ColorUtils.setAlpha(getColorByName("iconColor"), elAlpha);
        int textColor = ColorUtils.setAlpha(getColorByName("textColor"), elAlpha);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(posX, posY, animatedWidth, winH, 4f * scale, fonColor, alpha);

        String headerIcon = "f";
        float iconW = Fonts.icon2[i2sz].getWidth(headerIcon);
        Fonts.icon2[i2sz].drawString(stack, headerIcon, posX + 4f * scale, posY + 5.5f * scale, iconColor);
        font(14).drawString(stack, "Binds", posX + 4f * scale + iconW + 3f * scale, posY + 6f * scale, infoColor);

        float renderY = posY + headerH + 1f * scale;
        for (Module f : activeBinds) {
            float anim = (float) f.animation.getOutput();
            if (anim > 0.01f) {
                stack.push();
                float cy = renderY + itemH / 2f;
                stack.translate(posX + animatedWidth / 2f, cy, 0);
                stack.scale(1f, anim, 1f);
                stack.translate(-(posX + animatedWidth / 2f), -cy, 0);

                nameFont.drawString(stack, f.name, posX + 6f * scale, renderY + 3f * scale,
                        ColorUtils.setAlpha(textColor, (int)(220 * anim)));

                String bind = formatBind(f.bind);
                float bw = bindFont.getWidth(bind);
                bindFont.drawString(stack, bind, posX + animatedWidth - bw - 5f * scale, renderY + 3.5f * scale,
                        ColorUtils.setAlpha(textColor, (int)(160 * anim)));

                stack.pop();
                renderY += itemH * anim;
            }
        }

        keyBinds.setWidth(animatedWidth);
        keyBinds.setHeight(winH);
    }

    private String formatBind(int bind) {
        String b = ClientUtils.getKey(bind)
                .replace("MOUSE",   "M")
                .replace("CONTROL", "C")
                .replace("LEFT",    "L")
                .replace("RIGHT",   "R")
                .replace("_",       "");
        return b.substring(0, Math.min(b.length(), 4)).toUpperCase();
    }

    private void renderPotions(MatrixStack stack) {
        if (mc.player == null) return;
        float scale = getScale();
        float posX = potionHUD.getX(), posY = potionHUD.getY();
        float headerH = 15f * scale, itemH = 9f * scale;

        Collection<EffectInstance> current = mc.player.getActivePotionEffects();
        for (EffectInstance eff : current) {
            int id = System.identityHashCode(eff);
            lastKnownEffects.put(id, eff);
            potionAnimations.computeIfAbsent(id, k -> new EaseBackIn(300, 1, 1.5f))
                    .setDirection(Direction.FORWARDS);
        }
        potionAnimations.forEach((id, anim) -> {
            if (current.stream().noneMatch(e -> System.identityHashCode(e) == id))
                anim.setDirection(Direction.BACKWARDS);
        });

        List<Integer> toRender = new ArrayList<>();
        float maxW = 0;
        StyledFont effFont = font(13), durFont = font(12);

        for (Map.Entry<Integer, Animation> e : potionAnimations.entrySet()) {
            int id = e.getKey();
            if (!e.getValue().isDone() || e.getValue().getDirection() == Direction.FORWARDS) {
                EffectInstance inst = lastKnownEffects.get(id);
                if (inst != null) {
                    toRender.add(id);
                    float w = effFont.getWidth(I18n.format(inst.getEffectName()))
                            + durFont.getWidth(EffectUtils.getPotionDurationString(inst, 1f))
                            + 35f * scale;
                    if (w > maxW) maxW = w;
                }
            }
        }

        boolean isChatOpen = mc.currentScreen instanceof ChatScreen;
        potionAlphaAnim.setDirection((!toRender.isEmpty() || isChatOpen) ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) Math.max(0, Math.min(1, potionAlphaAnim.getOutput()));
        if (alpha <= 0f) { animatedPotionWidth = 75f * scale; return; }

        float targetW = Math.max(75f * scale, maxW);
        animatedPotionWidth += (targetW - animatedPotionWidth) * 0.15f;

        int elAlpha     = (int)(255 * alpha);
        int fonColor    = ColorUtils.setAlpha(getColorByName("fonColor"),    getBgOpacity(alpha));
        int infoColor   = ColorUtils.setAlpha(getColorByName("infoColor"),   elAlpha);
        int iconColor   = ColorUtils.setAlpha(getColorByName("iconColor"),   elAlpha);
        int textColor   = ColorUtils.setAlpha(getColorByName("textColor"),   elAlpha);
        int iconnoColor = ColorUtils.setAlpha(getColorByName("iconnoColor"), (int)(30 * alpha));

        float yOff = 0;
        for (int id : toRender)
            yOff += itemH * (float) Math.max(0, potionAnimations.get(id).getOutput());
        float winH = headerH + (toRender.isEmpty() ? (isChatOpen ? 3f * scale : 0f) : yOff + 4f * scale);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(posX, posY, animatedPotionWidth, winH, 4f * scale, fonColor, alpha);

        int i2sz = icon2Sz(15);
        Fonts.icon2[i2sz].drawString(stack, "e", posX + 4f * scale, posY + 5.5f * scale, iconColor);
        font(14).drawString(stack, "Potions",
                posX + 4f * scale + Fonts.icon2[i2sz].getWidth("e") + 3f * scale,
                posY + 6f * scale, infoColor);

        float renderY = posY + headerH + 1f * scale;
        for (int id : toRender) {
            EffectInstance inst = lastKnownEffects.get(id);
            Animation anim = potionAnimations.get(id);
            float animP = (float) Math.max(0, anim.getOutput());
            if (animP > 0.001f) {
                float flash = (inst.getDuration() > 0 && inst.getDuration() <= 100)
                        ? 0.4f + (float)(Math.sin(System.currentTimeMillis() / 150.0) + 1.0) / 3.33f
                        : 1f;

                stack.push();
                float cy = renderY + itemH / 2f;
                stack.translate(posX + animatedPotionWidth / 2f, cy, 0);
                stack.scale(1f, animP, 1f);
                stack.translate(-(posX + animatedPotionWidth / 2f), -cy, 0);

                float slide = (1f - animP) * 10f * scale;
                int fAlpha = Math.max(0, Math.min(255, (int)(elAlpha * animP * flash)));
                Effect eff = inst.getPotion();
                String text = I18n.format(inst.getEffectName());
                String dur  = EffectUtils.getPotionDurationString(inst, 1f);
                String lvl  = inst.getAmplifier() != 0 ? " " + (inst.getAmplifier() + 1) : "";
                int effColor = !eff.isBeneficial()
                        ? new Color(182, 35, 35, fAlpha).getRGB()
                        : ColorUtils.setAlpha(textColor, (int)(220 * animP * flash));

                RenderSystem.depthMask(false);
                RenderSystem.enableBlend();
                RenderSystem.defaultBlendFunc();
                TextureAtlasSprite sprite = mc.getPotionSpriteUploader().getSprite(eff);
                mc.getTextureManager().bindTexture(sprite.getAtlasTexture().getTextureLocation());
                blitSprite(stack, posX + 4.5f * scale - slide, renderY + 1f * scale, 10,
                        (int)(7 * scale), (int)(7 * scale), sprite, fAlpha / 255f);
                RenderSystem.depthMask(true);

                effFont.drawString(stack, text, posX + 13f * scale - slide, renderY + 3f * scale, effColor);
                if (inst.getAmplifier() != 0)
                    durFont.drawString(stack, lvl,
                            posX + 13f * scale + effFont.getWidth(text) - slide,
                            renderY + 3f * scale,
                            ColorUtils.setAlpha(textColor, (int)(200 * animP * flash)));

                float tw = durFont.getWidth(dur);
                float tx = posX + animatedPotionWidth - tw - 6f * scale + slide;
                RenderUtils.Render2D.drawRoundedRect(tx - 2f * scale, renderY + 0.5f * scale,
                        tw + 4f * scale, 8f * scale, 1.5f * scale,
                        ColorUtils.setAlpha(iconnoColor, (int)(fAlpha * 0.4f)));
                durFont.drawString(stack, dur, tx, renderY + 3.5f * scale,
                        ColorUtils.setAlpha(textColor, (int)(180 * animP * flash)));

                stack.pop();
                renderY += itemH * animP;
            }
        }

        potionAnimations.entrySet().removeIf(e -> {
            if (e.getValue().isDone() && e.getValue().getDirection() == Direction.BACKWARDS) {
                lastKnownEffects.remove(e.getKey());
                return true;
            }
            return false;
        });

        potionHUD.setWidth(animatedPotionWidth);
        potionHUD.setHeight(winH);
    }

    private void renderTarget(MatrixStack stack) {
        if (mc.player == null || Manager.FUNCTION_MANAGER == null) return;
        float scale = getScale();
        target = resolveTarget(target);
        if (target == null) return;

        thudAlpha.setDirection(allow ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) thudAlpha.getOutput();

        if (target.hurtTime > 0 && !particlesSpawnedThisHit) {
            spawnParticles(); particlesSpawnedThisHit = true;
        } else if (target.hurtTime == 0) {
            particlesSpawnedThisHit = false;
        }

        if (alpha <= 0f) { target = null; return; }

        float x = targetHUD.getX(), y = targetHUD.getY();
        float w = 90f * scale;

        int firstColor = getColorByName("primaryColor");
        int textColor  = getColorByName("textColor");
        int iconColor  = getColorByName("iconColor");
        int goldColor  = getColorByName("goldColor");
        int elAlpha    = (int)(255 * alpha);
        int fonColor   = ColorUtils.setAlpha(getColorByName("fonColor"), getBgOpacity(alpha));

        float faceSize = 24f * scale;
        float itemRowH = 10f * scale;
        float infoH    = faceSize;
        float h        = itemRowH + infoH + 6f * scale;
     
        RenderUtils.Render2D.drawBlurredRoundedRectangle(x, y + itemRowH, w, infoH + 6f * scale,
                4f * scale, fonColor, alpha);
     
     
        renderItemRow(stack, target, x, y, w, scale, elAlpha);

        float contentY = y + itemRowH;
        float faceX    = x + 3f * scale;
        float faceY    = contentY + 3f * scale;

        if (target instanceof AbstractClientPlayerEntity acp) {
            RenderUtils.Render2D.drawRoundFace(faceX, faceY, (int) faceSize, (int) faceSize,
                    3f * scale, alpha, acp);
            if (target.hurtTime > 0)
                RenderUtils.Render2D.drawRoundedRect(
                        faceX - 0.3f * scale, faceY - 0.3f * scale,
                        faceSize + 0.6f * scale, faceSize + 0.6f * scale, 2.5f * scale,
                        new Color(255, 0, 0, (int)(target.hurtTime / 10f * alpha * 100)).getRGB());
        } else {
            StencilUtils.initStencilToWrite();
            RenderUtils.Render2D.drawRoundedRect(faceX, faceY, faceSize, faceSize, 3f * scale,
                    ColorUtils.rgba(21, 21, 21, (int)(190 * alpha)));
            StencilUtils.readStencilBuffer(1);
            int fSz = iconSz(50);
            float iw = Fonts.icon[fSz].getWidth(">");
            Fonts.icon[fSz].drawString(stack, ">",
                    faceX + (faceSize - iw) / 2f, faceY + 2.5f * scale,
                    ColorUtils.setAlpha(iconColor, elAlpha));
            StencilUtils.uninitStencilBuffer();
        }

        float textX = x + faceSize + 6f * scale;
        float textY = contentY + 4f * scale;

        font(13).drawScissorString(stack, target.getName().getString(), textX, textY,
                ColorUtils.setAlpha(textColor, elAlpha), (int)(w - faceSize - 9f * scale));

        health      = MathHelper.clamp(AnimationMath.fast(health,      target.getHealth() / target.getMaxHealth(),           12),   0, 1);
        health2     = MathHelper.clamp(AnimationMath.fast(health2,     target.getHealth() / target.getMaxHealth(),           4.5f), 0, 1);
        healthplus  = MathHelper.clamp(AnimationMath.fast(healthplus,  target.getAbsorptionAmount() / target.getMaxHealth(), 12),   0, 1);
        healthplus2 = MathHelper.clamp(AnimationMath.fast(healthplus2, target.getAbsorptionAmount() / target.getMaxHealth(), 4.5f), 0, 1);

        Color bc = new Color(firstColor);
        float[] hsb = Color.RGBtoHSB(bc.getRed(), bc.getGreen(), bc.getBlue(), null);
        int darker   = Color.getHSBColor(hsb[0], hsb[1], Math.max(0f, hsb[2] - 0.4f)).getRGB();
        Color gC     = new Color(goldColor);
        int darkGold = new Color((int)(gC.getRed()*0.6f),(int)(gC.getGreen()*0.6f),(int)(gC.getBlue()*0.6f)).getRGB();

        String hpStr = (int)(health * target.getMaxHealth()) + " HP";
        Color tc2 = new Color(textColor);
        float[] hsbt = Color.RGBtoHSB(tc2.getRed(), tc2.getGreen(), tc2.getBlue(), null);
        int dimText = ColorUtils.setAlpha(
                Color.getHSBColor(hsbt[0], hsbt[1], Math.max(0f, hsbt[2] - 0.15f)).getRGB(), elAlpha);
        font(11).drawString(stack, hpStr, textX, textY + 9f * scale, dimText);

        float barX = textX;
        float barY = contentY + infoH - 5f * scale;
        float barW = w - faceSize - 9f * scale;
        float barH = 4f * scale;
     
        RenderUtils.Render2D.drawRoundedRect(barX, barY, barW, barH, 2f * scale,
                ColorUtils.setAlpha(firstColor, (int)(55 * alpha)));
     
        if (health >= healthplus) {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health2,  barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(firstColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darker,     (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health,   barH, 2f * scale,
                    ColorUtils.setAlpha(firstColor, elAlpha),
                    ColorUtils.setAlpha(darker,     elAlpha));
        } else {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * healthplus2, barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(goldColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darkGold,  (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * healthplus,  barH, 2f * scale,
                    ColorUtils.setAlpha(goldColor, elAlpha),
                    ColorUtils.setAlpha(darkGold,  elAlpha));
        }
        if (health < healthplus && healthplus > 0) {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health2,  barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(firstColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darker,     (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health,   barH, 2f * scale,
                    ColorUtils.setAlpha(firstColor, elAlpha),
                    ColorUtils.setAlpha(darker,     elAlpha));
        }

        particles.removeIf(p -> System.currentTimeMillis() - p.time > 2000L);
        for (LocalParticle p : particles) {
            p.update();
            float life = 1f - (float)(System.currentTimeMillis() - p.time) / 2000f;
            float ps   = life * 3f * scale;
            if (ps > 0)
                RenderUtils.Render2D.drawRoundedCorner((float) p.pos.x, (float) p.pos.y,
                        ps, ps, ps / 2f,
                        ColorUtils.setAlpha(firstColor, (int)(255f * p.alpha * life)));
        }

        targetHUD.setWidth(w);
        targetHUD.setHeight(h);
    }

    private void renderItemRow(MatrixStack stack, LivingEntity entity,
                               float x, float y, float w, float scale, int elAlpha) {
        float itemSz = 9f * scale;
        float rowH   = 10f * scale;
        float itemY  = y + (rowH - itemSz) / 2f;

        List<ItemStack> all = new ArrayList<>();

        ItemStack offHand = entity.getHeldItemOffhand();
        if (!offHand.isEmpty()) all.add(offHand);

        List<ItemStack> armor = new ArrayList<>();
        for (ItemStack s : entity.getArmorInventoryList()) armor.add(s);
        all.addAll(armor);

        ItemStack mainHand = entity.getHeldItemMainhand();
        if (!mainHand.isEmpty()) all.add(mainHand);

        int count = (int) all.stream().filter(s -> !s.isEmpty()).count();
        if (count == 0) return;

        float totalItemW = count * itemSz + (count - 1) * scale;
        float startX     = x + (w - totalItemW) / 2f;
        float sc         = itemSz / 16f;

        com.mojang.blaze3d.platform.GlStateManager.pushMatrix();
        com.mojang.blaze3d.platform.GlStateManager.scaled(sc, sc, 1.0);

        float cx = startX;
        for (ItemStack s : all) {
            if (s.isEmpty()) continue;
            Hud.drawItemStack(s, cx / sc, itemY / sc, "", false);
            cx += itemSz + scale;
        }

        com.mojang.blaze3d.platform.GlStateManager.popMatrix();
    }

    private LivingEntity resolveTarget(LivingEntity prev) {
        if (Manager.FUNCTION_MANAGER == null) return null;
        LivingEntity t = prev;
        Object auraTarget = Manager.FUNCTION_MANAGER.auraFunction.getTarget();
        if (auraTarget instanceof LivingEntity le) {
            t = le; targetTimer.reset(); allow = true;
        } else if (mc.currentScreen instanceof ChatScreen) {
            t = mc.player; targetTimer.reset(); allow = true;
        } else if (allow && targetTimer.isReached(200)) {
            allow = false;
        }
        return t;
    }

    private void spawnParticles() {
        float hx = targetHUD.getX() + 12f * getScale();
        float hy = targetHUD.getY() + 20f * getScale();
        for (int i = 0; i < 8; i++)
            particles.add(new LocalParticle(new Vector3d(hx, hy, 0)));
    }

    private void blitSprite(MatrixStack ms, float x, float y, int blitOffset,
                            int width, int height, TextureAtlasSprite sprite, float alpha) {
        Matrix4f matrix = ms.getLast().getMatrix();
        BufferBuilder bb = Tessellator.getInstance().getBuffer();
        int a = (int)(alpha * 255);
        bb.begin(7, DefaultVertexFormats.POSITION_COLOR_TEX);
        bb.pos(matrix, x,         y + height, blitOffset).color(255,255,255,a).tex(sprite.getMinU(), sprite.getMaxV()).endVertex();
        bb.pos(matrix, x + width, y + height, blitOffset).color(255,255,255,a).tex(sprite.getMaxU(), sprite.getMaxV()).endVertex();
        bb.pos(matrix, x + width, y,          blitOffset).color(255,255,255,a).tex(sprite.getMaxU(), sprite.getMinV()).endVertex();
        bb.pos(matrix, x,         y,          blitOffset).color(255,255,255,a).tex(sprite.getMinU(), sprite.getMinV()).endVertex();
        bb.finishDrawing();
        RenderSystem.enableBlend();
        RenderSystem.defaultBlendFunc();
        WorldVertexBufferUploader.draw(bb);
    }
}
криво, /del
 
Попытка заскидить старый худ абузика можно настроить прозрачность, размер. Надеюсь оцените (nuclear beta base)

ss
Посмотреть вложение 332592

hud2:
Expand Collapse Copy
package social.module.impl.render;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Vector3d;
import social.Social;
import social.control.Manager;
import social.control.drag.Dragging;
import social.control.events.Event;
import social.control.events.impl.render.EventRender;
import social.module.TypeList;
import social.module.api.Annotation;
import social.module.api.Module;
import social.module.settings.imp.BooleanSetting;
import social.module.settings.imp.MultiBoxSetting;
import social.module.settings.imp.SliderSetting;
import social.utils.ClientUtils;
import social.utils.anim.Animation;
import social.utils.anim.Direction;
import social.utils.anim.impl.DecelerateAnimation;
import social.utils.anim.impl.EaseBackIn;
import social.utils.font.Fonts;
import social.utils.font.styled.StyledFont;
import social.utils.misc.TimerUtil;
import social.utils.render.ColorUtils;
import social.utils.render.RenderUtils;
import social.utils.render.StencilUtils;
import social.utils.render.animation.AnimationMath;

import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

import static social.ui.clickgui.Panel.getColorByName;

@Annotation(name = "Hud2", type = TypeList.Render, desc = "второйхудепты")
public class Hud2 extends Module {

    public MultiBoxSetting elements = new MultiBoxSetting("Elements",
            new BooleanSetting("Watermark", true),
            new BooleanSetting("Keybinds", true),
            new BooleanSetting("Potions", true),
            new BooleanSetting("Target HUD", true));

    public SliderSetting size      = new SliderSetting("Scale",      1,   0.8f, 1.2f, 0.05f);
    public SliderSetting bgOpacity = new SliderSetting("BG Opacity", 200, 0,    255,   5);

    public final Dragging watermark = Social.createDrag(this, "H2Watermark", 7,   7);
    public final Dragging keyBinds  = Social.createDrag(this, "H2KeyBinds",  7,  30);
    public final Dragging potionHUD = Social.createDrag(this, "H2Potion",    7,  80);
    public final Dragging targetHUD = Social.createDrag(this, "H2Target",  300, 200);

    private float wmHue = 0f;

    private float animatedWidth   = 70f;
    private float lastTargetWidth = 0f;
    private float startWidth      = 70f;
    private final Animation kbAlpha   = new DecelerateAnimation(250, 1.0);
    private final Animation widthAnim = new DecelerateAnimation(250, 1.0);

    private final Map<Integer, Animation>      potionAnimations = new HashMap<>();
    private final Map<Integer, EffectInstance> lastKnownEffects = new HashMap<>();
    private float animatedPotionWidth = 75f;
    private final Animation potionAlphaAnim = new EaseBackIn(300, 1, 1.5f);

    private LivingEntity target                 = null;
    private boolean      allow                  = false;
    private boolean      particlesSpawnedThisHit = false;
    private float        health = 0, health2 = 0;
    private float        healthplus = 0, healthplus2 = 0;
    private final Animation thudAlpha   = new DecelerateAnimation(250, 1.0);
    private final TimerUtil targetTimer = new TimerUtil();

    private static class LocalParticle {
        Vector3d pos;
        final Vector3d end;
        final long time;
        float alpha;

        LocalParticle(Vector3d origin) {
            this.pos   = origin;
            this.end   = origin.add(
                    ThreadLocalRandom.current().nextDouble(-40, 40),
                    ThreadLocalRandom.current().nextDouble(-40, 40),
                    0);
            this.time  = System.currentTimeMillis();
            this.alpha = 0f;
        }

        void update() {
            alpha = MathHelper.lerp(alpha, 1f, 0.1f);
            pos   = AnimationMath.fast(pos, end, 0.5f);
        }
    }

    private final List<LocalParticle> particles = new ArrayList<>();

    public Hud2() {
        addSettings(elements, size, bgOpacity);
    }

    private float getScale() {
        return size.getValue().floatValue();
    }

    private int getBgOpacity(float alpha) {
        return (int)(bgOpacity.getValue().floatValue() * alpha);
    }

    private StyledFont font(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.newcode.length - 1));
        if (Fonts.newcode[s] != null) return Fonts.newcode[s];
        for (int i = s; i >= 10; i--)
            if (i < Fonts.newcode.length && Fonts.newcode[i] != null) return Fonts.newcode[i];
        return Fonts.newcode[Math.min(14, Fonts.newcode.length - 1)];
    }

    private int iconSz(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.icon.length - 1));
        if (Fonts.icon[s] != null) return s;
        for (int i = s; i >= 10; i--)
            if (i < Fonts.icon.length && Fonts.icon[i] != null) return i;
        return Math.min(15, Fonts.icon.length - 1);
    }

    private int icon2Sz(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.icon2.length - 1));
        if (Fonts.icon2[s] != null) return s;
        for (int i = s; i >= 10; i--)
            if (i < Fonts.icon2.length && Fonts.icon2[i] != null) return i;
        return Math.min(15, Fonts.icon2.length - 1);
    }

    @Override
    public boolean onEvent(Event event) {
        if (!(event instanceof EventRender er) || !er.isRender2D()) return false;
        MatrixStack stack = er.matrixStack;
        if (mc.gameSettings.showDebugInfo) return false;
        if (elements.get(0)) renderWatermark(stack);
        if (elements.get(1)) renderKeyBinds(stack);
        if (elements.get(2)) renderPotions(stack);
        if (elements.get(3)) renderTarget(stack);
        return false;
    }

    private void renderWatermark(MatrixStack stack) {
        if (mc.player == null) return;
        float scale = getScale();
        float x = watermark.getX(), y = watermark.getY();
        float h = 13f * scale, r = 3f * scale, pad = 5f * scale;

        StyledFont f = font(13);

        wmHue += 0.005f;
        if (wmHue > 1f) wmHue -= 1f;
        float hue = 0.611f + (float)(Math.sin(wmHue * Math.PI * 2) * 0.5 + 0.5) * 0.056f;
        int arbuzColor = Color.HSBtoRGB(hue, 0.65f, 1.00f) | 0xFF000000;

        String clientName = "social";
        String gap        = "    ";
        String serverIp   = getServerIp();
        String playerName = mc.player.getName().getString();

        float nameW   = f.getWidth(clientName);
        float gapW    = f.getWidth(gap);
        float ipW     = f.getWidth(serverIp);
        float playerW = f.getWidth(playerName);
        float totalW  = pad + nameW + gapW + ipW + gapW + playerW + pad;

        int fonColor  = ColorUtils.setAlpha(getColorByName("fonColor"), getBgOpacity(1f));
        int textColor = getColorByName("textColor");
        int dotColor  = ColorUtils.setAlpha(textColor, 130);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(x, y, totalW, h, r, fonColor, 1f);

        float fontH = f.getFontHeight() / 2f;
        float ty    = y + (h - fontH) / 2f;
        float dotY  = y + h / 2f;
        float dotR  = 1.2f * scale;

        float cx = x + pad;

        f.drawString(stack, clientName, cx, ty, arbuzColor);
        cx += nameW + gapW / 2f;

        RenderUtils.Render2D.drawCircle2(cx, dotY - 0.5f * scale, dotR * 0.55f, dotColor);
        cx += gapW / 2f;

        f.drawString(stack, serverIp, cx, ty, textColor);
        cx += ipW + gapW / 2f;

        RenderUtils.Render2D.drawCircle2(cx, dotY - 0.5f * scale, dotR * 0.55f, dotColor);
        cx += gapW / 2f;

        f.drawString(stack, playerName, cx, ty, textColor);

        watermark.setWidth(totalW);
        watermark.setHeight(h);
    }

    private String getServerIp() {
        if (mc.getCurrentServerData() != null) {
            String ip = mc.getCurrentServerData().serverIP;
            return (ip != null && !ip.isEmpty()) ? ip : "singleplayer";
        }
        return "singleplayer";
    }

    private void renderKeyBinds(MatrixStack stack) {
        if (Manager.FUNCTION_MANAGER == null) return;
        float scale = getScale();
        boolean isChatOpen = mc.currentScreen instanceof ChatScreen;

        StyledFont nameFont = font(13), bindFont = font(11);
        int i2sz = icon2Sz(15);

        List<Module> activeBinds = new ArrayList<>();
        float maxW = 0;

        for (Module f : Manager.FUNCTION_MANAGER.getFunctions()) {
            if (f == null) continue;
            f.animation.setDirection(f.state && f.bind != 0 ? Direction.FORWARDS : Direction.BACKWARDS);
            if (!f.animation.isDone() || (f.state && f.bind != 0)) {
                activeBinds.add(f);
                String bind = formatBind(f.bind);
                float w = nameFont.getWidth(f.name) + bindFont.getWidth(bind) + 24f * scale;
                if (w > maxW) maxW = w;
            }
        }

        kbAlpha.setDirection((!activeBinds.isEmpty() || isChatOpen) ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) kbAlpha.getOutput();
        if (alpha <= 0.01f) { animatedWidth = 70f * scale; return; }

        float targetW = Math.max(70f * scale, maxW);
        if (targetW != lastTargetWidth) {
            startWidth = animatedWidth; lastTargetWidth = targetW; widthAnim.reset();
        }
        animatedWidth = widthAnim.isDone()
                ? targetW
                : startWidth + (targetW - startWidth) * (float) widthAnim.getOutput();

        float posX = keyBinds.getX(), posY = keyBinds.getY();
        float headerH = 15f * scale, itemH = 9f * scale;

        float yOff = 0;
        for (Module f : activeBinds) yOff += itemH * f.animation.getOutput();
        float winH = headerH + (activeBinds.isEmpty() ? (isChatOpen ? 3f * scale : 0f) : yOff + 4f * scale);

        int elAlpha   = (int)(255 * alpha);
        int fonColor  = ColorUtils.setAlpha(getColorByName("fonColor"),  getBgOpacity(alpha));
        int infoColor = ColorUtils.setAlpha(getColorByName("infoColor"), elAlpha);
        int iconColor = ColorUtils.setAlpha(getColorByName("iconColor"), elAlpha);
        int textColor = ColorUtils.setAlpha(getColorByName("textColor"), elAlpha);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(posX, posY, animatedWidth, winH, 4f * scale, fonColor, alpha);

        String headerIcon = "f";
        float iconW = Fonts.icon2[i2sz].getWidth(headerIcon);
        Fonts.icon2[i2sz].drawString(stack, headerIcon, posX + 4f * scale, posY + 5.5f * scale, iconColor);
        font(14).drawString(stack, "Binds", posX + 4f * scale + iconW + 3f * scale, posY + 6f * scale, infoColor);

        float renderY = posY + headerH + 1f * scale;
        for (Module f : activeBinds) {
            float anim = (float) f.animation.getOutput();
            if (anim > 0.01f) {
                stack.push();
                float cy = renderY + itemH / 2f;
                stack.translate(posX + animatedWidth / 2f, cy, 0);
                stack.scale(1f, anim, 1f);
                stack.translate(-(posX + animatedWidth / 2f), -cy, 0);

                nameFont.drawString(stack, f.name, posX + 6f * scale, renderY + 3f * scale,
                        ColorUtils.setAlpha(textColor, (int)(220 * anim)));

                String bind = formatBind(f.bind);
                float bw = bindFont.getWidth(bind);
                bindFont.drawString(stack, bind, posX + animatedWidth - bw - 5f * scale, renderY + 3.5f * scale,
                        ColorUtils.setAlpha(textColor, (int)(160 * anim)));

                stack.pop();
                renderY += itemH * anim;
            }
        }

        keyBinds.setWidth(animatedWidth);
        keyBinds.setHeight(winH);
    }

    private String formatBind(int bind) {
        String b = ClientUtils.getKey(bind)
                .replace("MOUSE",   "M")
                .replace("CONTROL", "C")
                .replace("LEFT",    "L")
                .replace("RIGHT",   "R")
                .replace("_",       "");
        return b.substring(0, Math.min(b.length(), 4)).toUpperCase();
    }

    private void renderPotions(MatrixStack stack) {
        if (mc.player == null) return;
        float scale = getScale();
        float posX = potionHUD.getX(), posY = potionHUD.getY();
        float headerH = 15f * scale, itemH = 9f * scale;

        Collection<EffectInstance> current = mc.player.getActivePotionEffects();
        for (EffectInstance eff : current) {
            int id = System.identityHashCode(eff);
            lastKnownEffects.put(id, eff);
            potionAnimations.computeIfAbsent(id, k -> new EaseBackIn(300, 1, 1.5f))
                    .setDirection(Direction.FORWARDS);
        }
        potionAnimations.forEach((id, anim) -> {
            if (current.stream().noneMatch(e -> System.identityHashCode(e) == id))
                anim.setDirection(Direction.BACKWARDS);
        });

        List<Integer> toRender = new ArrayList<>();
        float maxW = 0;
        StyledFont effFont = font(13), durFont = font(12);

        for (Map.Entry<Integer, Animation> e : potionAnimations.entrySet()) {
            int id = e.getKey();
            if (!e.getValue().isDone() || e.getValue().getDirection() == Direction.FORWARDS) {
                EffectInstance inst = lastKnownEffects.get(id);
                if (inst != null) {
                    toRender.add(id);
                    float w = effFont.getWidth(I18n.format(inst.getEffectName()))
                            + durFont.getWidth(EffectUtils.getPotionDurationString(inst, 1f))
                            + 35f * scale;
                    if (w > maxW) maxW = w;
                }
            }
        }

        boolean isChatOpen = mc.currentScreen instanceof ChatScreen;
        potionAlphaAnim.setDirection((!toRender.isEmpty() || isChatOpen) ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) Math.max(0, Math.min(1, potionAlphaAnim.getOutput()));
        if (alpha <= 0f) { animatedPotionWidth = 75f * scale; return; }

        float targetW = Math.max(75f * scale, maxW);
        animatedPotionWidth += (targetW - animatedPotionWidth) * 0.15f;

        int elAlpha     = (int)(255 * alpha);
        int fonColor    = ColorUtils.setAlpha(getColorByName("fonColor"),    getBgOpacity(alpha));
        int infoColor   = ColorUtils.setAlpha(getColorByName("infoColor"),   elAlpha);
        int iconColor   = ColorUtils.setAlpha(getColorByName("iconColor"),   elAlpha);
        int textColor   = ColorUtils.setAlpha(getColorByName("textColor"),   elAlpha);
        int iconnoColor = ColorUtils.setAlpha(getColorByName("iconnoColor"), (int)(30 * alpha));

        float yOff = 0;
        for (int id : toRender)
            yOff += itemH * (float) Math.max(0, potionAnimations.get(id).getOutput());
        float winH = headerH + (toRender.isEmpty() ? (isChatOpen ? 3f * scale : 0f) : yOff + 4f * scale);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(posX, posY, animatedPotionWidth, winH, 4f * scale, fonColor, alpha);

        int i2sz = icon2Sz(15);
        Fonts.icon2[i2sz].drawString(stack, "e", posX + 4f * scale, posY + 5.5f * scale, iconColor);
        font(14).drawString(stack, "Potions",
                posX + 4f * scale + Fonts.icon2[i2sz].getWidth("e") + 3f * scale,
                posY + 6f * scale, infoColor);

        float renderY = posY + headerH + 1f * scale;
        for (int id : toRender) {
            EffectInstance inst = lastKnownEffects.get(id);
            Animation anim = potionAnimations.get(id);
            float animP = (float) Math.max(0, anim.getOutput());
            if (animP > 0.001f) {
                float flash = (inst.getDuration() > 0 && inst.getDuration() <= 100)
                        ? 0.4f + (float)(Math.sin(System.currentTimeMillis() / 150.0) + 1.0) / 3.33f
                        : 1f;

                stack.push();
                float cy = renderY + itemH / 2f;
                stack.translate(posX + animatedPotionWidth / 2f, cy, 0);
                stack.scale(1f, animP, 1f);
                stack.translate(-(posX + animatedPotionWidth / 2f), -cy, 0);

                float slide = (1f - animP) * 10f * scale;
                int fAlpha = Math.max(0, Math.min(255, (int)(elAlpha * animP * flash)));
                Effect eff = inst.getPotion();
                String text = I18n.format(inst.getEffectName());
                String dur  = EffectUtils.getPotionDurationString(inst, 1f);
                String lvl  = inst.getAmplifier() != 0 ? " " + (inst.getAmplifier() + 1) : "";
                int effColor = !eff.isBeneficial()
                        ? new Color(182, 35, 35, fAlpha).getRGB()
                        : ColorUtils.setAlpha(textColor, (int)(220 * animP * flash));

                RenderSystem.depthMask(false);
                RenderSystem.enableBlend();
                RenderSystem.defaultBlendFunc();
                TextureAtlasSprite sprite = mc.getPotionSpriteUploader().getSprite(eff);
                mc.getTextureManager().bindTexture(sprite.getAtlasTexture().getTextureLocation());
                blitSprite(stack, posX + 4.5f * scale - slide, renderY + 1f * scale, 10,
                        (int)(7 * scale), (int)(7 * scale), sprite, fAlpha / 255f);
                RenderSystem.depthMask(true);

                effFont.drawString(stack, text, posX + 13f * scale - slide, renderY + 3f * scale, effColor);
                if (inst.getAmplifier() != 0)
                    durFont.drawString(stack, lvl,
                            posX + 13f * scale + effFont.getWidth(text) - slide,
                            renderY + 3f * scale,
                            ColorUtils.setAlpha(textColor, (int)(200 * animP * flash)));

                float tw = durFont.getWidth(dur);
                float tx = posX + animatedPotionWidth - tw - 6f * scale + slide;
                RenderUtils.Render2D.drawRoundedRect(tx - 2f * scale, renderY + 0.5f * scale,
                        tw + 4f * scale, 8f * scale, 1.5f * scale,
                        ColorUtils.setAlpha(iconnoColor, (int)(fAlpha * 0.4f)));
                durFont.drawString(stack, dur, tx, renderY + 3.5f * scale,
                        ColorUtils.setAlpha(textColor, (int)(180 * animP * flash)));

                stack.pop();
                renderY += itemH * animP;
            }
        }

        potionAnimations.entrySet().removeIf(e -> {
            if (e.getValue().isDone() && e.getValue().getDirection() == Direction.BACKWARDS) {
                lastKnownEffects.remove(e.getKey());
                return true;
            }
            return false;
        });

        potionHUD.setWidth(animatedPotionWidth);
        potionHUD.setHeight(winH);
    }

    private void renderTarget(MatrixStack stack) {
        if (mc.player == null || Manager.FUNCTION_MANAGER == null) return;
        float scale = getScale();
        target = resolveTarget(target);
        if (target == null) return;

        thudAlpha.setDirection(allow ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) thudAlpha.getOutput();

        if (target.hurtTime > 0 && !particlesSpawnedThisHit) {
            spawnParticles(); particlesSpawnedThisHit = true;
        } else if (target.hurtTime == 0) {
            particlesSpawnedThisHit = false;
        }

        if (alpha <= 0f) { target = null; return; }

        float x = targetHUD.getX(), y = targetHUD.getY();
        float w = 90f * scale;

        int firstColor = getColorByName("primaryColor");
        int textColor  = getColorByName("textColor");
        int iconColor  = getColorByName("iconColor");
        int goldColor  = getColorByName("goldColor");
        int elAlpha    = (int)(255 * alpha);
        int fonColor   = ColorUtils.setAlpha(getColorByName("fonColor"), getBgOpacity(alpha));

        float faceSize = 24f * scale;
        float itemRowH = 10f * scale;
        float infoH    = faceSize;
        float h        = itemRowH + infoH + 6f * scale;
     
        RenderUtils.Render2D.drawBlurredRoundedRectangle(x, y + itemRowH, w, infoH + 6f * scale,
                4f * scale, fonColor, alpha);
     
     
        renderItemRow(stack, target, x, y, w, scale, elAlpha);

        float contentY = y + itemRowH;
        float faceX    = x + 3f * scale;
        float faceY    = contentY + 3f * scale;

        if (target instanceof AbstractClientPlayerEntity acp) {
            RenderUtils.Render2D.drawRoundFace(faceX, faceY, (int) faceSize, (int) faceSize,
                    3f * scale, alpha, acp);
            if (target.hurtTime > 0)
                RenderUtils.Render2D.drawRoundedRect(
                        faceX - 0.3f * scale, faceY - 0.3f * scale,
                        faceSize + 0.6f * scale, faceSize + 0.6f * scale, 2.5f * scale,
                        new Color(255, 0, 0, (int)(target.hurtTime / 10f * alpha * 100)).getRGB());
        } else {
            StencilUtils.initStencilToWrite();
            RenderUtils.Render2D.drawRoundedRect(faceX, faceY, faceSize, faceSize, 3f * scale,
                    ColorUtils.rgba(21, 21, 21, (int)(190 * alpha)));
            StencilUtils.readStencilBuffer(1);
            int fSz = iconSz(50);
            float iw = Fonts.icon[fSz].getWidth(">");
            Fonts.icon[fSz].drawString(stack, ">",
                    faceX + (faceSize - iw) / 2f, faceY + 2.5f * scale,
                    ColorUtils.setAlpha(iconColor, elAlpha));
            StencilUtils.uninitStencilBuffer();
        }

        float textX = x + faceSize + 6f * scale;
        float textY = contentY + 4f * scale;

        font(13).drawScissorString(stack, target.getName().getString(), textX, textY,
                ColorUtils.setAlpha(textColor, elAlpha), (int)(w - faceSize - 9f * scale));

        health      = MathHelper.clamp(AnimationMath.fast(health,      target.getHealth() / target.getMaxHealth(),           12),   0, 1);
        health2     = MathHelper.clamp(AnimationMath.fast(health2,     target.getHealth() / target.getMaxHealth(),           4.5f), 0, 1);
        healthplus  = MathHelper.clamp(AnimationMath.fast(healthplus,  target.getAbsorptionAmount() / target.getMaxHealth(), 12),   0, 1);
        healthplus2 = MathHelper.clamp(AnimationMath.fast(healthplus2, target.getAbsorptionAmount() / target.getMaxHealth(), 4.5f), 0, 1);

        Color bc = new Color(firstColor);
        float[] hsb = Color.RGBtoHSB(bc.getRed(), bc.getGreen(), bc.getBlue(), null);
        int darker   = Color.getHSBColor(hsb[0], hsb[1], Math.max(0f, hsb[2] - 0.4f)).getRGB();
        Color gC     = new Color(goldColor);
        int darkGold = new Color((int)(gC.getRed()*0.6f),(int)(gC.getGreen()*0.6f),(int)(gC.getBlue()*0.6f)).getRGB();

        String hpStr = (int)(health * target.getMaxHealth()) + " HP";
        Color tc2 = new Color(textColor);
        float[] hsbt = Color.RGBtoHSB(tc2.getRed(), tc2.getGreen(), tc2.getBlue(), null);
        int dimText = ColorUtils.setAlpha(
                Color.getHSBColor(hsbt[0], hsbt[1], Math.max(0f, hsbt[2] - 0.15f)).getRGB(), elAlpha);
        font(11).drawString(stack, hpStr, textX, textY + 9f * scale, dimText);

        float barX = textX;
        float barY = contentY + infoH - 5f * scale;
        float barW = w - faceSize - 9f * scale;
        float barH = 4f * scale;
     
        RenderUtils.Render2D.drawRoundedRect(barX, barY, barW, barH, 2f * scale,
                ColorUtils.setAlpha(firstColor, (int)(55 * alpha)));
     
        if (health >= healthplus) {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health2,  barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(firstColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darker,     (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health,   barH, 2f * scale,
                    ColorUtils.setAlpha(firstColor, elAlpha),
                    ColorUtils.setAlpha(darker,     elAlpha));
        } else {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * healthplus2, barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(goldColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darkGold,  (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * healthplus,  barH, 2f * scale,
                    ColorUtils.setAlpha(goldColor, elAlpha),
                    ColorUtils.setAlpha(darkGold,  elAlpha));
        }
        if (health < healthplus && healthplus > 0) {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health2,  barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(firstColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darker,     (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health,   barH, 2f * scale,
                    ColorUtils.setAlpha(firstColor, elAlpha),
                    ColorUtils.setAlpha(darker,     elAlpha));
        }

        particles.removeIf(p -> System.currentTimeMillis() - p.time > 2000L);
        for (LocalParticle p : particles) {
            p.update();
            float life = 1f - (float)(System.currentTimeMillis() - p.time) / 2000f;
            float ps   = life * 3f * scale;
            if (ps > 0)
                RenderUtils.Render2D.drawRoundedCorner((float) p.pos.x, (float) p.pos.y,
                        ps, ps, ps / 2f,
                        ColorUtils.setAlpha(firstColor, (int)(255f * p.alpha * life)));
        }

        targetHUD.setWidth(w);
        targetHUD.setHeight(h);
    }

    private void renderItemRow(MatrixStack stack, LivingEntity entity,
                               float x, float y, float w, float scale, int elAlpha) {
        float itemSz = 9f * scale;
        float rowH   = 10f * scale;
        float itemY  = y + (rowH - itemSz) / 2f;

        List<ItemStack> all = new ArrayList<>();

        ItemStack offHand = entity.getHeldItemOffhand();
        if (!offHand.isEmpty()) all.add(offHand);

        List<ItemStack> armor = new ArrayList<>();
        for (ItemStack s : entity.getArmorInventoryList()) armor.add(s);
        all.addAll(armor);

        ItemStack mainHand = entity.getHeldItemMainhand();
        if (!mainHand.isEmpty()) all.add(mainHand);

        int count = (int) all.stream().filter(s -> !s.isEmpty()).count();
        if (count == 0) return;

        float totalItemW = count * itemSz + (count - 1) * scale;
        float startX     = x + (w - totalItemW) / 2f;
        float sc         = itemSz / 16f;

        com.mojang.blaze3d.platform.GlStateManager.pushMatrix();
        com.mojang.blaze3d.platform.GlStateManager.scaled(sc, sc, 1.0);

        float cx = startX;
        for (ItemStack s : all) {
            if (s.isEmpty()) continue;
            Hud.drawItemStack(s, cx / sc, itemY / sc, "", false);
            cx += itemSz + scale;
        }

        com.mojang.blaze3d.platform.GlStateManager.popMatrix();
    }

    private LivingEntity resolveTarget(LivingEntity prev) {
        if (Manager.FUNCTION_MANAGER == null) return null;
        LivingEntity t = prev;
        Object auraTarget = Manager.FUNCTION_MANAGER.auraFunction.getTarget();
        if (auraTarget instanceof LivingEntity le) {
            t = le; targetTimer.reset(); allow = true;
        } else if (mc.currentScreen instanceof ChatScreen) {
            t = mc.player; targetTimer.reset(); allow = true;
        } else if (allow && targetTimer.isReached(200)) {
            allow = false;
        }
        return t;
    }

    private void spawnParticles() {
        float hx = targetHUD.getX() + 12f * getScale();
        float hy = targetHUD.getY() + 20f * getScale();
        for (int i = 0; i < 8; i++)
            particles.add(new LocalParticle(new Vector3d(hx, hy, 0)));
    }

    private void blitSprite(MatrixStack ms, float x, float y, int blitOffset,
                            int width, int height, TextureAtlasSprite sprite, float alpha) {
        Matrix4f matrix = ms.getLast().getMatrix();
        BufferBuilder bb = Tessellator.getInstance().getBuffer();
        int a = (int)(alpha * 255);
        bb.begin(7, DefaultVertexFormats.POSITION_COLOR_TEX);
        bb.pos(matrix, x,         y + height, blitOffset).color(255,255,255,a).tex(sprite.getMinU(), sprite.getMaxV()).endVertex();
        bb.pos(matrix, x + width, y + height, blitOffset).color(255,255,255,a).tex(sprite.getMaxU(), sprite.getMaxV()).endVertex();
        bb.pos(matrix, x + width, y,          blitOffset).color(255,255,255,a).tex(sprite.getMaxU(), sprite.getMinV()).endVertex();
        bb.pos(matrix, x,         y,          blitOffset).color(255,255,255,a).tex(sprite.getMinU(), sprite.getMinV()).endVertex();
        bb.finishDrawing();
        RenderSystem.enableBlend();
        RenderSystem.defaultBlendFunc();
        WorldVertexBufferUploader.draw(bb);
    }
}
нормик
 
Попытка заскидить старый худ абузика можно настроить прозрачность, размер. Надеюсь оцените (nuclear beta base)

ss
Посмотреть вложение 332592

hud2:
Expand Collapse Copy
package social.module.impl.render;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Vector3d;
import social.Social;
import social.control.Manager;
import social.control.drag.Dragging;
import social.control.events.Event;
import social.control.events.impl.render.EventRender;
import social.module.TypeList;
import social.module.api.Annotation;
import social.module.api.Module;
import social.module.settings.imp.BooleanSetting;
import social.module.settings.imp.MultiBoxSetting;
import social.module.settings.imp.SliderSetting;
import social.utils.ClientUtils;
import social.utils.anim.Animation;
import social.utils.anim.Direction;
import social.utils.anim.impl.DecelerateAnimation;
import social.utils.anim.impl.EaseBackIn;
import social.utils.font.Fonts;
import social.utils.font.styled.StyledFont;
import social.utils.misc.TimerUtil;
import social.utils.render.ColorUtils;
import social.utils.render.RenderUtils;
import social.utils.render.StencilUtils;
import social.utils.render.animation.AnimationMath;

import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

import static social.ui.clickgui.Panel.getColorByName;

@Annotation(name = "Hud2", type = TypeList.Render, desc = "второйхудепты")
public class Hud2 extends Module {

    public MultiBoxSetting elements = new MultiBoxSetting("Elements",
            new BooleanSetting("Watermark", true),
            new BooleanSetting("Keybinds", true),
            new BooleanSetting("Potions", true),
            new BooleanSetting("Target HUD", true));

    public SliderSetting size      = new SliderSetting("Scale",      1,   0.8f, 1.2f, 0.05f);
    public SliderSetting bgOpacity = new SliderSetting("BG Opacity", 200, 0,    255,   5);

    public final Dragging watermark = Social.createDrag(this, "H2Watermark", 7,   7);
    public final Dragging keyBinds  = Social.createDrag(this, "H2KeyBinds",  7,  30);
    public final Dragging potionHUD = Social.createDrag(this, "H2Potion",    7,  80);
    public final Dragging targetHUD = Social.createDrag(this, "H2Target",  300, 200);

    private float wmHue = 0f;

    private float animatedWidth   = 70f;
    private float lastTargetWidth = 0f;
    private float startWidth      = 70f;
    private final Animation kbAlpha   = new DecelerateAnimation(250, 1.0);
    private final Animation widthAnim = new DecelerateAnimation(250, 1.0);

    private final Map<Integer, Animation>      potionAnimations = new HashMap<>();
    private final Map<Integer, EffectInstance> lastKnownEffects = new HashMap<>();
    private float animatedPotionWidth = 75f;
    private final Animation potionAlphaAnim = new EaseBackIn(300, 1, 1.5f);

    private LivingEntity target                 = null;
    private boolean      allow                  = false;
    private boolean      particlesSpawnedThisHit = false;
    private float        health = 0, health2 = 0;
    private float        healthplus = 0, healthplus2 = 0;
    private final Animation thudAlpha   = new DecelerateAnimation(250, 1.0);
    private final TimerUtil targetTimer = new TimerUtil();

    private static class LocalParticle {
        Vector3d pos;
        final Vector3d end;
        final long time;
        float alpha;

        LocalParticle(Vector3d origin) {
            this.pos   = origin;
            this.end   = origin.add(
                    ThreadLocalRandom.current().nextDouble(-40, 40),
                    ThreadLocalRandom.current().nextDouble(-40, 40),
                    0);
            this.time  = System.currentTimeMillis();
            this.alpha = 0f;
        }

        void update() {
            alpha = MathHelper.lerp(alpha, 1f, 0.1f);
            pos   = AnimationMath.fast(pos, end, 0.5f);
        }
    }

    private final List<LocalParticle> particles = new ArrayList<>();

    public Hud2() {
        addSettings(elements, size, bgOpacity);
    }

    private float getScale() {
        return size.getValue().floatValue();
    }

    private int getBgOpacity(float alpha) {
        return (int)(bgOpacity.getValue().floatValue() * alpha);
    }

    private StyledFont font(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.newcode.length - 1));
        if (Fonts.newcode[s] != null) return Fonts.newcode[s];
        for (int i = s; i >= 10; i--)
            if (i < Fonts.newcode.length && Fonts.newcode[i] != null) return Fonts.newcode[i];
        return Fonts.newcode[Math.min(14, Fonts.newcode.length - 1)];
    }

    private int iconSz(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.icon.length - 1));
        if (Fonts.icon[s] != null) return s;
        for (int i = s; i >= 10; i--)
            if (i < Fonts.icon.length && Fonts.icon[i] != null) return i;
        return Math.min(15, Fonts.icon.length - 1);
    }

    private int icon2Sz(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.icon2.length - 1));
        if (Fonts.icon2[s] != null) return s;
        for (int i = s; i >= 10; i--)
            if (i < Fonts.icon2.length && Fonts.icon2[i] != null) return i;
        return Math.min(15, Fonts.icon2.length - 1);
    }

    @Override
    public boolean onEvent(Event event) {
        if (!(event instanceof EventRender er) || !er.isRender2D()) return false;
        MatrixStack stack = er.matrixStack;
        if (mc.gameSettings.showDebugInfo) return false;
        if (elements.get(0)) renderWatermark(stack);
        if (elements.get(1)) renderKeyBinds(stack);
        if (elements.get(2)) renderPotions(stack);
        if (elements.get(3)) renderTarget(stack);
        return false;
    }

    private void renderWatermark(MatrixStack stack) {
        if (mc.player == null) return;
        float scale = getScale();
        float x = watermark.getX(), y = watermark.getY();
        float h = 13f * scale, r = 3f * scale, pad = 5f * scale;

        StyledFont f = font(13);

        wmHue += 0.005f;
        if (wmHue > 1f) wmHue -= 1f;
        float hue = 0.611f + (float)(Math.sin(wmHue * Math.PI * 2) * 0.5 + 0.5) * 0.056f;
        int arbuzColor = Color.HSBtoRGB(hue, 0.65f, 1.00f) | 0xFF000000;

        String clientName = "social";
        String gap        = "    ";
        String serverIp   = getServerIp();
        String playerName = mc.player.getName().getString();

        float nameW   = f.getWidth(clientName);
        float gapW    = f.getWidth(gap);
        float ipW     = f.getWidth(serverIp);
        float playerW = f.getWidth(playerName);
        float totalW  = pad + nameW + gapW + ipW + gapW + playerW + pad;

        int fonColor  = ColorUtils.setAlpha(getColorByName("fonColor"), getBgOpacity(1f));
        int textColor = getColorByName("textColor");
        int dotColor  = ColorUtils.setAlpha(textColor, 130);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(x, y, totalW, h, r, fonColor, 1f);

        float fontH = f.getFontHeight() / 2f;
        float ty    = y + (h - fontH) / 2f;
        float dotY  = y + h / 2f;
        float dotR  = 1.2f * scale;

        float cx = x + pad;

        f.drawString(stack, clientName, cx, ty, arbuzColor);
        cx += nameW + gapW / 2f;

        RenderUtils.Render2D.drawCircle2(cx, dotY - 0.5f * scale, dotR * 0.55f, dotColor);
        cx += gapW / 2f;

        f.drawString(stack, serverIp, cx, ty, textColor);
        cx += ipW + gapW / 2f;

        RenderUtils.Render2D.drawCircle2(cx, dotY - 0.5f * scale, dotR * 0.55f, dotColor);
        cx += gapW / 2f;

        f.drawString(stack, playerName, cx, ty, textColor);

        watermark.setWidth(totalW);
        watermark.setHeight(h);
    }

    private String getServerIp() {
        if (mc.getCurrentServerData() != null) {
            String ip = mc.getCurrentServerData().serverIP;
            return (ip != null && !ip.isEmpty()) ? ip : "singleplayer";
        }
        return "singleplayer";
    }

    private void renderKeyBinds(MatrixStack stack) {
        if (Manager.FUNCTION_MANAGER == null) return;
        float scale = getScale();
        boolean isChatOpen = mc.currentScreen instanceof ChatScreen;

        StyledFont nameFont = font(13), bindFont = font(11);
        int i2sz = icon2Sz(15);

        List<Module> activeBinds = new ArrayList<>();
        float maxW = 0;

        for (Module f : Manager.FUNCTION_MANAGER.getFunctions()) {
            if (f == null) continue;
            f.animation.setDirection(f.state && f.bind != 0 ? Direction.FORWARDS : Direction.BACKWARDS);
            if (!f.animation.isDone() || (f.state && f.bind != 0)) {
                activeBinds.add(f);
                String bind = formatBind(f.bind);
                float w = nameFont.getWidth(f.name) + bindFont.getWidth(bind) + 24f * scale;
                if (w > maxW) maxW = w;
            }
        }

        kbAlpha.setDirection((!activeBinds.isEmpty() || isChatOpen) ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) kbAlpha.getOutput();
        if (alpha <= 0.01f) { animatedWidth = 70f * scale; return; }

        float targetW = Math.max(70f * scale, maxW);
        if (targetW != lastTargetWidth) {
            startWidth = animatedWidth; lastTargetWidth = targetW; widthAnim.reset();
        }
        animatedWidth = widthAnim.isDone()
                ? targetW
                : startWidth + (targetW - startWidth) * (float) widthAnim.getOutput();

        float posX = keyBinds.getX(), posY = keyBinds.getY();
        float headerH = 15f * scale, itemH = 9f * scale;

        float yOff = 0;
        for (Module f : activeBinds) yOff += itemH * f.animation.getOutput();
        float winH = headerH + (activeBinds.isEmpty() ? (isChatOpen ? 3f * scale : 0f) : yOff + 4f * scale);

        int elAlpha   = (int)(255 * alpha);
        int fonColor  = ColorUtils.setAlpha(getColorByName("fonColor"),  getBgOpacity(alpha));
        int infoColor = ColorUtils.setAlpha(getColorByName("infoColor"), elAlpha);
        int iconColor = ColorUtils.setAlpha(getColorByName("iconColor"), elAlpha);
        int textColor = ColorUtils.setAlpha(getColorByName("textColor"), elAlpha);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(posX, posY, animatedWidth, winH, 4f * scale, fonColor, alpha);

        String headerIcon = "f";
        float iconW = Fonts.icon2[i2sz].getWidth(headerIcon);
        Fonts.icon2[i2sz].drawString(stack, headerIcon, posX + 4f * scale, posY + 5.5f * scale, iconColor);
        font(14).drawString(stack, "Binds", posX + 4f * scale + iconW + 3f * scale, posY + 6f * scale, infoColor);

        float renderY = posY + headerH + 1f * scale;
        for (Module f : activeBinds) {
            float anim = (float) f.animation.getOutput();
            if (anim > 0.01f) {
                stack.push();
                float cy = renderY + itemH / 2f;
                stack.translate(posX + animatedWidth / 2f, cy, 0);
                stack.scale(1f, anim, 1f);
                stack.translate(-(posX + animatedWidth / 2f), -cy, 0);

                nameFont.drawString(stack, f.name, posX + 6f * scale, renderY + 3f * scale,
                        ColorUtils.setAlpha(textColor, (int)(220 * anim)));

                String bind = formatBind(f.bind);
                float bw = bindFont.getWidth(bind);
                bindFont.drawString(stack, bind, posX + animatedWidth - bw - 5f * scale, renderY + 3.5f * scale,
                        ColorUtils.setAlpha(textColor, (int)(160 * anim)));

                stack.pop();
                renderY += itemH * anim;
            }
        }

        keyBinds.setWidth(animatedWidth);
        keyBinds.setHeight(winH);
    }

    private String formatBind(int bind) {
        String b = ClientUtils.getKey(bind)
                .replace("MOUSE",   "M")
                .replace("CONTROL", "C")
                .replace("LEFT",    "L")
                .replace("RIGHT",   "R")
                .replace("_",       "");
        return b.substring(0, Math.min(b.length(), 4)).toUpperCase();
    }

    private void renderPotions(MatrixStack stack) {
        if (mc.player == null) return;
        float scale = getScale();
        float posX = potionHUD.getX(), posY = potionHUD.getY();
        float headerH = 15f * scale, itemH = 9f * scale;

        Collection<EffectInstance> current = mc.player.getActivePotionEffects();
        for (EffectInstance eff : current) {
            int id = System.identityHashCode(eff);
            lastKnownEffects.put(id, eff);
            potionAnimations.computeIfAbsent(id, k -> new EaseBackIn(300, 1, 1.5f))
                    .setDirection(Direction.FORWARDS);
        }
        potionAnimations.forEach((id, anim) -> {
            if (current.stream().noneMatch(e -> System.identityHashCode(e) == id))
                anim.setDirection(Direction.BACKWARDS);
        });

        List<Integer> toRender = new ArrayList<>();
        float maxW = 0;
        StyledFont effFont = font(13), durFont = font(12);

        for (Map.Entry<Integer, Animation> e : potionAnimations.entrySet()) {
            int id = e.getKey();
            if (!e.getValue().isDone() || e.getValue().getDirection() == Direction.FORWARDS) {
                EffectInstance inst = lastKnownEffects.get(id);
                if (inst != null) {
                    toRender.add(id);
                    float w = effFont.getWidth(I18n.format(inst.getEffectName()))
                            + durFont.getWidth(EffectUtils.getPotionDurationString(inst, 1f))
                            + 35f * scale;
                    if (w > maxW) maxW = w;
                }
            }
        }

        boolean isChatOpen = mc.currentScreen instanceof ChatScreen;
        potionAlphaAnim.setDirection((!toRender.isEmpty() || isChatOpen) ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) Math.max(0, Math.min(1, potionAlphaAnim.getOutput()));
        if (alpha <= 0f) { animatedPotionWidth = 75f * scale; return; }

        float targetW = Math.max(75f * scale, maxW);
        animatedPotionWidth += (targetW - animatedPotionWidth) * 0.15f;

        int elAlpha     = (int)(255 * alpha);
        int fonColor    = ColorUtils.setAlpha(getColorByName("fonColor"),    getBgOpacity(alpha));
        int infoColor   = ColorUtils.setAlpha(getColorByName("infoColor"),   elAlpha);
        int iconColor   = ColorUtils.setAlpha(getColorByName("iconColor"),   elAlpha);
        int textColor   = ColorUtils.setAlpha(getColorByName("textColor"),   elAlpha);
        int iconnoColor = ColorUtils.setAlpha(getColorByName("iconnoColor"), (int)(30 * alpha));

        float yOff = 0;
        for (int id : toRender)
            yOff += itemH * (float) Math.max(0, potionAnimations.get(id).getOutput());
        float winH = headerH + (toRender.isEmpty() ? (isChatOpen ? 3f * scale : 0f) : yOff + 4f * scale);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(posX, posY, animatedPotionWidth, winH, 4f * scale, fonColor, alpha);

        int i2sz = icon2Sz(15);
        Fonts.icon2[i2sz].drawString(stack, "e", posX + 4f * scale, posY + 5.5f * scale, iconColor);
        font(14).drawString(stack, "Potions",
                posX + 4f * scale + Fonts.icon2[i2sz].getWidth("e") + 3f * scale,
                posY + 6f * scale, infoColor);

        float renderY = posY + headerH + 1f * scale;
        for (int id : toRender) {
            EffectInstance inst = lastKnownEffects.get(id);
            Animation anim = potionAnimations.get(id);
            float animP = (float) Math.max(0, anim.getOutput());
            if (animP > 0.001f) {
                float flash = (inst.getDuration() > 0 && inst.getDuration() <= 100)
                        ? 0.4f + (float)(Math.sin(System.currentTimeMillis() / 150.0) + 1.0) / 3.33f
                        : 1f;

                stack.push();
                float cy = renderY + itemH / 2f;
                stack.translate(posX + animatedPotionWidth / 2f, cy, 0);
                stack.scale(1f, animP, 1f);
                stack.translate(-(posX + animatedPotionWidth / 2f), -cy, 0);

                float slide = (1f - animP) * 10f * scale;
                int fAlpha = Math.max(0, Math.min(255, (int)(elAlpha * animP * flash)));
                Effect eff = inst.getPotion();
                String text = I18n.format(inst.getEffectName());
                String dur  = EffectUtils.getPotionDurationString(inst, 1f);
                String lvl  = inst.getAmplifier() != 0 ? " " + (inst.getAmplifier() + 1) : "";
                int effColor = !eff.isBeneficial()
                        ? new Color(182, 35, 35, fAlpha).getRGB()
                        : ColorUtils.setAlpha(textColor, (int)(220 * animP * flash));

                RenderSystem.depthMask(false);
                RenderSystem.enableBlend();
                RenderSystem.defaultBlendFunc();
                TextureAtlasSprite sprite = mc.getPotionSpriteUploader().getSprite(eff);
                mc.getTextureManager().bindTexture(sprite.getAtlasTexture().getTextureLocation());
                blitSprite(stack, posX + 4.5f * scale - slide, renderY + 1f * scale, 10,
                        (int)(7 * scale), (int)(7 * scale), sprite, fAlpha / 255f);
                RenderSystem.depthMask(true);

                effFont.drawString(stack, text, posX + 13f * scale - slide, renderY + 3f * scale, effColor);
                if (inst.getAmplifier() != 0)
                    durFont.drawString(stack, lvl,
                            posX + 13f * scale + effFont.getWidth(text) - slide,
                            renderY + 3f * scale,
                            ColorUtils.setAlpha(textColor, (int)(200 * animP * flash)));

                float tw = durFont.getWidth(dur);
                float tx = posX + animatedPotionWidth - tw - 6f * scale + slide;
                RenderUtils.Render2D.drawRoundedRect(tx - 2f * scale, renderY + 0.5f * scale,
                        tw + 4f * scale, 8f * scale, 1.5f * scale,
                        ColorUtils.setAlpha(iconnoColor, (int)(fAlpha * 0.4f)));
                durFont.drawString(stack, dur, tx, renderY + 3.5f * scale,
                        ColorUtils.setAlpha(textColor, (int)(180 * animP * flash)));

                stack.pop();
                renderY += itemH * animP;
            }
        }

        potionAnimations.entrySet().removeIf(e -> {
            if (e.getValue().isDone() && e.getValue().getDirection() == Direction.BACKWARDS) {
                lastKnownEffects.remove(e.getKey());
                return true;
            }
            return false;
        });

        potionHUD.setWidth(animatedPotionWidth);
        potionHUD.setHeight(winH);
    }

    private void renderTarget(MatrixStack stack) {
        if (mc.player == null || Manager.FUNCTION_MANAGER == null) return;
        float scale = getScale();
        target = resolveTarget(target);
        if (target == null) return;

        thudAlpha.setDirection(allow ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) thudAlpha.getOutput();

        if (target.hurtTime > 0 && !particlesSpawnedThisHit) {
            spawnParticles(); particlesSpawnedThisHit = true;
        } else if (target.hurtTime == 0) {
            particlesSpawnedThisHit = false;
        }

        if (alpha <= 0f) { target = null; return; }

        float x = targetHUD.getX(), y = targetHUD.getY();
        float w = 90f * scale;

        int firstColor = getColorByName("primaryColor");
        int textColor  = getColorByName("textColor");
        int iconColor  = getColorByName("iconColor");
        int goldColor  = getColorByName("goldColor");
        int elAlpha    = (int)(255 * alpha);
        int fonColor   = ColorUtils.setAlpha(getColorByName("fonColor"), getBgOpacity(alpha));

        float faceSize = 24f * scale;
        float itemRowH = 10f * scale;
        float infoH    = faceSize;
        float h        = itemRowH + infoH + 6f * scale;
     
        RenderUtils.Render2D.drawBlurredRoundedRectangle(x, y + itemRowH, w, infoH + 6f * scale,
                4f * scale, fonColor, alpha);
     
     
        renderItemRow(stack, target, x, y, w, scale, elAlpha);

        float contentY = y + itemRowH;
        float faceX    = x + 3f * scale;
        float faceY    = contentY + 3f * scale;

        if (target instanceof AbstractClientPlayerEntity acp) {
            RenderUtils.Render2D.drawRoundFace(faceX, faceY, (int) faceSize, (int) faceSize,
                    3f * scale, alpha, acp);
            if (target.hurtTime > 0)
                RenderUtils.Render2D.drawRoundedRect(
                        faceX - 0.3f * scale, faceY - 0.3f * scale,
                        faceSize + 0.6f * scale, faceSize + 0.6f * scale, 2.5f * scale,
                        new Color(255, 0, 0, (int)(target.hurtTime / 10f * alpha * 100)).getRGB());
        } else {
            StencilUtils.initStencilToWrite();
            RenderUtils.Render2D.drawRoundedRect(faceX, faceY, faceSize, faceSize, 3f * scale,
                    ColorUtils.rgba(21, 21, 21, (int)(190 * alpha)));
            StencilUtils.readStencilBuffer(1);
            int fSz = iconSz(50);
            float iw = Fonts.icon[fSz].getWidth(">");
            Fonts.icon[fSz].drawString(stack, ">",
                    faceX + (faceSize - iw) / 2f, faceY + 2.5f * scale,
                    ColorUtils.setAlpha(iconColor, elAlpha));
            StencilUtils.uninitStencilBuffer();
        }

        float textX = x + faceSize + 6f * scale;
        float textY = contentY + 4f * scale;

        font(13).drawScissorString(stack, target.getName().getString(), textX, textY,
                ColorUtils.setAlpha(textColor, elAlpha), (int)(w - faceSize - 9f * scale));

        health      = MathHelper.clamp(AnimationMath.fast(health,      target.getHealth() / target.getMaxHealth(),           12),   0, 1);
        health2     = MathHelper.clamp(AnimationMath.fast(health2,     target.getHealth() / target.getMaxHealth(),           4.5f), 0, 1);
        healthplus  = MathHelper.clamp(AnimationMath.fast(healthplus,  target.getAbsorptionAmount() / target.getMaxHealth(), 12),   0, 1);
        healthplus2 = MathHelper.clamp(AnimationMath.fast(healthplus2, target.getAbsorptionAmount() / target.getMaxHealth(), 4.5f), 0, 1);

        Color bc = new Color(firstColor);
        float[] hsb = Color.RGBtoHSB(bc.getRed(), bc.getGreen(), bc.getBlue(), null);
        int darker   = Color.getHSBColor(hsb[0], hsb[1], Math.max(0f, hsb[2] - 0.4f)).getRGB();
        Color gC     = new Color(goldColor);
        int darkGold = new Color((int)(gC.getRed()*0.6f),(int)(gC.getGreen()*0.6f),(int)(gC.getBlue()*0.6f)).getRGB();

        String hpStr = (int)(health * target.getMaxHealth()) + " HP";
        Color tc2 = new Color(textColor);
        float[] hsbt = Color.RGBtoHSB(tc2.getRed(), tc2.getGreen(), tc2.getBlue(), null);
        int dimText = ColorUtils.setAlpha(
                Color.getHSBColor(hsbt[0], hsbt[1], Math.max(0f, hsbt[2] - 0.15f)).getRGB(), elAlpha);
        font(11).drawString(stack, hpStr, textX, textY + 9f * scale, dimText);

        float barX = textX;
        float barY = contentY + infoH - 5f * scale;
        float barW = w - faceSize - 9f * scale;
        float barH = 4f * scale;
     
        RenderUtils.Render2D.drawRoundedRect(barX, barY, barW, barH, 2f * scale,
                ColorUtils.setAlpha(firstColor, (int)(55 * alpha)));
     
        if (health >= healthplus) {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health2,  barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(firstColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darker,     (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health,   barH, 2f * scale,
                    ColorUtils.setAlpha(firstColor, elAlpha),
                    ColorUtils.setAlpha(darker,     elAlpha));
        } else {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * healthplus2, barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(goldColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darkGold,  (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * healthplus,  barH, 2f * scale,
                    ColorUtils.setAlpha(goldColor, elAlpha),
                    ColorUtils.setAlpha(darkGold,  elAlpha));
        }
        if (health < healthplus && healthplus > 0) {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health2,  barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(firstColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darker,     (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health,   barH, 2f * scale,
                    ColorUtils.setAlpha(firstColor, elAlpha),
                    ColorUtils.setAlpha(darker,     elAlpha));
        }

        particles.removeIf(p -> System.currentTimeMillis() - p.time > 2000L);
        for (LocalParticle p : particles) {
            p.update();
            float life = 1f - (float)(System.currentTimeMillis() - p.time) / 2000f;
            float ps   = life * 3f * scale;
            if (ps > 0)
                RenderUtils.Render2D.drawRoundedCorner((float) p.pos.x, (float) p.pos.y,
                        ps, ps, ps / 2f,
                        ColorUtils.setAlpha(firstColor, (int)(255f * p.alpha * life)));
        }

        targetHUD.setWidth(w);
        targetHUD.setHeight(h);
    }

    private void renderItemRow(MatrixStack stack, LivingEntity entity,
                               float x, float y, float w, float scale, int elAlpha) {
        float itemSz = 9f * scale;
        float rowH   = 10f * scale;
        float itemY  = y + (rowH - itemSz) / 2f;

        List<ItemStack> all = new ArrayList<>();

        ItemStack offHand = entity.getHeldItemOffhand();
        if (!offHand.isEmpty()) all.add(offHand);

        List<ItemStack> armor = new ArrayList<>();
        for (ItemStack s : entity.getArmorInventoryList()) armor.add(s);
        all.addAll(armor);

        ItemStack mainHand = entity.getHeldItemMainhand();
        if (!mainHand.isEmpty()) all.add(mainHand);

        int count = (int) all.stream().filter(s -> !s.isEmpty()).count();
        if (count == 0) return;

        float totalItemW = count * itemSz + (count - 1) * scale;
        float startX     = x + (w - totalItemW) / 2f;
        float sc         = itemSz / 16f;

        com.mojang.blaze3d.platform.GlStateManager.pushMatrix();
        com.mojang.blaze3d.platform.GlStateManager.scaled(sc, sc, 1.0);

        float cx = startX;
        for (ItemStack s : all) {
            if (s.isEmpty()) continue;
            Hud.drawItemStack(s, cx / sc, itemY / sc, "", false);
            cx += itemSz + scale;
        }

        com.mojang.blaze3d.platform.GlStateManager.popMatrix();
    }

    private LivingEntity resolveTarget(LivingEntity prev) {
        if (Manager.FUNCTION_MANAGER == null) return null;
        LivingEntity t = prev;
        Object auraTarget = Manager.FUNCTION_MANAGER.auraFunction.getTarget();
        if (auraTarget instanceof LivingEntity le) {
            t = le; targetTimer.reset(); allow = true;
        } else if (mc.currentScreen instanceof ChatScreen) {
            t = mc.player; targetTimer.reset(); allow = true;
        } else if (allow && targetTimer.isReached(200)) {
            allow = false;
        }
        return t;
    }

    private void spawnParticles() {
        float hx = targetHUD.getX() + 12f * getScale();
        float hy = targetHUD.getY() + 20f * getScale();
        for (int i = 0; i < 8; i++)
            particles.add(new LocalParticle(new Vector3d(hx, hy, 0)));
    }

    private void blitSprite(MatrixStack ms, float x, float y, int blitOffset,
                            int width, int height, TextureAtlasSprite sprite, float alpha) {
        Matrix4f matrix = ms.getLast().getMatrix();
        BufferBuilder bb = Tessellator.getInstance().getBuffer();
        int a = (int)(alpha * 255);
        bb.begin(7, DefaultVertexFormats.POSITION_COLOR_TEX);
        bb.pos(matrix, x,         y + height, blitOffset).color(255,255,255,a).tex(sprite.getMinU(), sprite.getMaxV()).endVertex();
        bb.pos(matrix, x + width, y + height, blitOffset).color(255,255,255,a).tex(sprite.getMaxU(), sprite.getMaxV()).endVertex();
        bb.pos(matrix, x + width, y,          blitOffset).color(255,255,255,a).tex(sprite.getMaxU(), sprite.getMinV()).endVertex();
        bb.pos(matrix, x,         y,          blitOffset).color(255,255,255,a).tex(sprite.getMinU(), sprite.getMinV()).endVertex();
        bb.finishDrawing();
        RenderSystem.enableBlend();
        RenderSystem.defaultBlendFunc();
        WorldVertexBufferUploader.draw(bb);
    }
}
нахуя тебе столько блура на худ
 
нахуя тебе столько блура на худ
это прозрачность, мне так более нравится я из видоса нурбека [noad] брал и решил так же сделать.
нахуя тебе столько блура на худ
+ прикольно выглядит, но если тебе не нравится ползунок прозрачности в фулл выкрути и не будет ее :)
 
Попытка заскидить старый худ абузика можно настроить прозрачность, размер. Надеюсь оцените (nuclear beta base)

ss
Посмотреть вложение 332592

hud2:
Expand Collapse Copy
package social.module.impl.render;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Vector3d;
import social.Social;
import social.control.Manager;
import social.control.drag.Dragging;
import social.control.events.Event;
import social.control.events.impl.render.EventRender;
import social.module.TypeList;
import social.module.api.Annotation;
import social.module.api.Module;
import social.module.settings.imp.BooleanSetting;
import social.module.settings.imp.MultiBoxSetting;
import social.module.settings.imp.SliderSetting;
import social.utils.ClientUtils;
import social.utils.anim.Animation;
import social.utils.anim.Direction;
import social.utils.anim.impl.DecelerateAnimation;
import social.utils.anim.impl.EaseBackIn;
import social.utils.font.Fonts;
import social.utils.font.styled.StyledFont;
import social.utils.misc.TimerUtil;
import social.utils.render.ColorUtils;
import social.utils.render.RenderUtils;
import social.utils.render.StencilUtils;
import social.utils.render.animation.AnimationMath;

import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

import static social.ui.clickgui.Panel.getColorByName;

@Annotation(name = "Hud2", type = TypeList.Render, desc = "второйхудепты")
public class Hud2 extends Module {

    public MultiBoxSetting elements = new MultiBoxSetting("Elements",
            new BooleanSetting("Watermark", true),
            new BooleanSetting("Keybinds", true),
            new BooleanSetting("Potions", true),
            new BooleanSetting("Target HUD", true));

    public SliderSetting size      = new SliderSetting("Scale",      1,   0.8f, 1.2f, 0.05f);
    public SliderSetting bgOpacity = new SliderSetting("BG Opacity", 200, 0,    255,   5);

    public final Dragging watermark = Social.createDrag(this, "H2Watermark", 7,   7);
    public final Dragging keyBinds  = Social.createDrag(this, "H2KeyBinds",  7,  30);
    public final Dragging potionHUD = Social.createDrag(this, "H2Potion",    7,  80);
    public final Dragging targetHUD = Social.createDrag(this, "H2Target",  300, 200);

    private float wmHue = 0f;

    private float animatedWidth   = 70f;
    private float lastTargetWidth = 0f;
    private float startWidth      = 70f;
    private final Animation kbAlpha   = new DecelerateAnimation(250, 1.0);
    private final Animation widthAnim = new DecelerateAnimation(250, 1.0);

    private final Map<Integer, Animation>      potionAnimations = new HashMap<>();
    private final Map<Integer, EffectInstance> lastKnownEffects = new HashMap<>();
    private float animatedPotionWidth = 75f;
    private final Animation potionAlphaAnim = new EaseBackIn(300, 1, 1.5f);

    private LivingEntity target                 = null;
    private boolean      allow                  = false;
    private boolean      particlesSpawnedThisHit = false;
    private float        health = 0, health2 = 0;
    private float        healthplus = 0, healthplus2 = 0;
    private final Animation thudAlpha   = new DecelerateAnimation(250, 1.0);
    private final TimerUtil targetTimer = new TimerUtil();

    private static class LocalParticle {
        Vector3d pos;
        final Vector3d end;
        final long time;
        float alpha;

        LocalParticle(Vector3d origin) {
            this.pos   = origin;
            this.end   = origin.add(
                    ThreadLocalRandom.current().nextDouble(-40, 40),
                    ThreadLocalRandom.current().nextDouble(-40, 40),
                    0);
            this.time  = System.currentTimeMillis();
            this.alpha = 0f;
        }

        void update() {
            alpha = MathHelper.lerp(alpha, 1f, 0.1f);
            pos   = AnimationMath.fast(pos, end, 0.5f);
        }
    }

    private final List<LocalParticle> particles = new ArrayList<>();

    public Hud2() {
        addSettings(elements, size, bgOpacity);
    }

    private float getScale() {
        return size.getValue().floatValue();
    }

    private int getBgOpacity(float alpha) {
        return (int)(bgOpacity.getValue().floatValue() * alpha);
    }

    private StyledFont font(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.newcode.length - 1));
        if (Fonts.newcode[s] != null) return Fonts.newcode[s];
        for (int i = s; i >= 10; i--)
            if (i < Fonts.newcode.length && Fonts.newcode[i] != null) return Fonts.newcode[i];
        return Fonts.newcode[Math.min(14, Fonts.newcode.length - 1)];
    }

    private int iconSz(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.icon.length - 1));
        if (Fonts.icon[s] != null) return s;
        for (int i = s; i >= 10; i--)
            if (i < Fonts.icon.length && Fonts.icon[i] != null) return i;
        return Math.min(15, Fonts.icon.length - 1);
    }

    private int icon2Sz(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.icon2.length - 1));
        if (Fonts.icon2[s] != null) return s;
        for (int i = s; i >= 10; i--)
            if (i < Fonts.icon2.length && Fonts.icon2[i] != null) return i;
        return Math.min(15, Fonts.icon2.length - 1);
    }

    @Override
    public boolean onEvent(Event event) {
        if (!(event instanceof EventRender er) || !er.isRender2D()) return false;
        MatrixStack stack = er.matrixStack;
        if (mc.gameSettings.showDebugInfo) return false;
        if (elements.get(0)) renderWatermark(stack);
        if (elements.get(1)) renderKeyBinds(stack);
        if (elements.get(2)) renderPotions(stack);
        if (elements.get(3)) renderTarget(stack);
        return false;
    }

    private void renderWatermark(MatrixStack stack) {
        if (mc.player == null) return;
        float scale = getScale();
        float x = watermark.getX(), y = watermark.getY();
        float h = 13f * scale, r = 3f * scale, pad = 5f * scale;

        StyledFont f = font(13);

        wmHue += 0.005f;
        if (wmHue > 1f) wmHue -= 1f;
        float hue = 0.611f + (float)(Math.sin(wmHue * Math.PI * 2) * 0.5 + 0.5) * 0.056f;
        int arbuzColor = Color.HSBtoRGB(hue, 0.65f, 1.00f) | 0xFF000000;

        String clientName = "social";
        String gap        = "    ";
        String serverIp   = getServerIp();
        String playerName = mc.player.getName().getString();

        float nameW   = f.getWidth(clientName);
        float gapW    = f.getWidth(gap);
        float ipW     = f.getWidth(serverIp);
        float playerW = f.getWidth(playerName);
        float totalW  = pad + nameW + gapW + ipW + gapW + playerW + pad;

        int fonColor  = ColorUtils.setAlpha(getColorByName("fonColor"), getBgOpacity(1f));
        int textColor = getColorByName("textColor");
        int dotColor  = ColorUtils.setAlpha(textColor, 130);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(x, y, totalW, h, r, fonColor, 1f);

        float fontH = f.getFontHeight() / 2f;
        float ty    = y + (h - fontH) / 2f;
        float dotY  = y + h / 2f;
        float dotR  = 1.2f * scale;

        float cx = x + pad;

        f.drawString(stack, clientName, cx, ty, arbuzColor);
        cx += nameW + gapW / 2f;

        RenderUtils.Render2D.drawCircle2(cx, dotY - 0.5f * scale, dotR * 0.55f, dotColor);
        cx += gapW / 2f;

        f.drawString(stack, serverIp, cx, ty, textColor);
        cx += ipW + gapW / 2f;

        RenderUtils.Render2D.drawCircle2(cx, dotY - 0.5f * scale, dotR * 0.55f, dotColor);
        cx += gapW / 2f;

        f.drawString(stack, playerName, cx, ty, textColor);

        watermark.setWidth(totalW);
        watermark.setHeight(h);
    }

    private String getServerIp() {
        if (mc.getCurrentServerData() != null) {
            String ip = mc.getCurrentServerData().serverIP;
            return (ip != null && !ip.isEmpty()) ? ip : "singleplayer";
        }
        return "singleplayer";
    }

    private void renderKeyBinds(MatrixStack stack) {
        if (Manager.FUNCTION_MANAGER == null) return;
        float scale = getScale();
        boolean isChatOpen = mc.currentScreen instanceof ChatScreen;

        StyledFont nameFont = font(13), bindFont = font(11);
        int i2sz = icon2Sz(15);

        List<Module> activeBinds = new ArrayList<>();
        float maxW = 0;

        for (Module f : Manager.FUNCTION_MANAGER.getFunctions()) {
            if (f == null) continue;
            f.animation.setDirection(f.state && f.bind != 0 ? Direction.FORWARDS : Direction.BACKWARDS);
            if (!f.animation.isDone() || (f.state && f.bind != 0)) {
                activeBinds.add(f);
                String bind = formatBind(f.bind);
                float w = nameFont.getWidth(f.name) + bindFont.getWidth(bind) + 24f * scale;
                if (w > maxW) maxW = w;
            }
        }

        kbAlpha.setDirection((!activeBinds.isEmpty() || isChatOpen) ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) kbAlpha.getOutput();
        if (alpha <= 0.01f) { animatedWidth = 70f * scale; return; }

        float targetW = Math.max(70f * scale, maxW);
        if (targetW != lastTargetWidth) {
            startWidth = animatedWidth; lastTargetWidth = targetW; widthAnim.reset();
        }
        animatedWidth = widthAnim.isDone()
                ? targetW
                : startWidth + (targetW - startWidth) * (float) widthAnim.getOutput();

        float posX = keyBinds.getX(), posY = keyBinds.getY();
        float headerH = 15f * scale, itemH = 9f * scale;

        float yOff = 0;
        for (Module f : activeBinds) yOff += itemH * f.animation.getOutput();
        float winH = headerH + (activeBinds.isEmpty() ? (isChatOpen ? 3f * scale : 0f) : yOff + 4f * scale);

        int elAlpha   = (int)(255 * alpha);
        int fonColor  = ColorUtils.setAlpha(getColorByName("fonColor"),  getBgOpacity(alpha));
        int infoColor = ColorUtils.setAlpha(getColorByName("infoColor"), elAlpha);
        int iconColor = ColorUtils.setAlpha(getColorByName("iconColor"), elAlpha);
        int textColor = ColorUtils.setAlpha(getColorByName("textColor"), elAlpha);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(posX, posY, animatedWidth, winH, 4f * scale, fonColor, alpha);

        String headerIcon = "f";
        float iconW = Fonts.icon2[i2sz].getWidth(headerIcon);
        Fonts.icon2[i2sz].drawString(stack, headerIcon, posX + 4f * scale, posY + 5.5f * scale, iconColor);
        font(14).drawString(stack, "Binds", posX + 4f * scale + iconW + 3f * scale, posY + 6f * scale, infoColor);

        float renderY = posY + headerH + 1f * scale;
        for (Module f : activeBinds) {
            float anim = (float) f.animation.getOutput();
            if (anim > 0.01f) {
                stack.push();
                float cy = renderY + itemH / 2f;
                stack.translate(posX + animatedWidth / 2f, cy, 0);
                stack.scale(1f, anim, 1f);
                stack.translate(-(posX + animatedWidth / 2f), -cy, 0);

                nameFont.drawString(stack, f.name, posX + 6f * scale, renderY + 3f * scale,
                        ColorUtils.setAlpha(textColor, (int)(220 * anim)));

                String bind = formatBind(f.bind);
                float bw = bindFont.getWidth(bind);
                bindFont.drawString(stack, bind, posX + animatedWidth - bw - 5f * scale, renderY + 3.5f * scale,
                        ColorUtils.setAlpha(textColor, (int)(160 * anim)));

                stack.pop();
                renderY += itemH * anim;
            }
        }

        keyBinds.setWidth(animatedWidth);
        keyBinds.setHeight(winH);
    }

    private String formatBind(int bind) {
        String b = ClientUtils.getKey(bind)
                .replace("MOUSE",   "M")
                .replace("CONTROL", "C")
                .replace("LEFT",    "L")
                .replace("RIGHT",   "R")
                .replace("_",       "");
        return b.substring(0, Math.min(b.length(), 4)).toUpperCase();
    }

    private void renderPotions(MatrixStack stack) {
        if (mc.player == null) return;
        float scale = getScale();
        float posX = potionHUD.getX(), posY = potionHUD.getY();
        float headerH = 15f * scale, itemH = 9f * scale;

        Collection<EffectInstance> current = mc.player.getActivePotionEffects();
        for (EffectInstance eff : current) {
            int id = System.identityHashCode(eff);
            lastKnownEffects.put(id, eff);
            potionAnimations.computeIfAbsent(id, k -> new EaseBackIn(300, 1, 1.5f))
                    .setDirection(Direction.FORWARDS);
        }
        potionAnimations.forEach((id, anim) -> {
            if (current.stream().noneMatch(e -> System.identityHashCode(e) == id))
                anim.setDirection(Direction.BACKWARDS);
        });

        List<Integer> toRender = new ArrayList<>();
        float maxW = 0;
        StyledFont effFont = font(13), durFont = font(12);

        for (Map.Entry<Integer, Animation> e : potionAnimations.entrySet()) {
            int id = e.getKey();
            if (!e.getValue().isDone() || e.getValue().getDirection() == Direction.FORWARDS) {
                EffectInstance inst = lastKnownEffects.get(id);
                if (inst != null) {
                    toRender.add(id);
                    float w = effFont.getWidth(I18n.format(inst.getEffectName()))
                            + durFont.getWidth(EffectUtils.getPotionDurationString(inst, 1f))
                            + 35f * scale;
                    if (w > maxW) maxW = w;
                }
            }
        }

        boolean isChatOpen = mc.currentScreen instanceof ChatScreen;
        potionAlphaAnim.setDirection((!toRender.isEmpty() || isChatOpen) ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) Math.max(0, Math.min(1, potionAlphaAnim.getOutput()));
        if (alpha <= 0f) { animatedPotionWidth = 75f * scale; return; }

        float targetW = Math.max(75f * scale, maxW);
        animatedPotionWidth += (targetW - animatedPotionWidth) * 0.15f;

        int elAlpha     = (int)(255 * alpha);
        int fonColor    = ColorUtils.setAlpha(getColorByName("fonColor"),    getBgOpacity(alpha));
        int infoColor   = ColorUtils.setAlpha(getColorByName("infoColor"),   elAlpha);
        int iconColor   = ColorUtils.setAlpha(getColorByName("iconColor"),   elAlpha);
        int textColor   = ColorUtils.setAlpha(getColorByName("textColor"),   elAlpha);
        int iconnoColor = ColorUtils.setAlpha(getColorByName("iconnoColor"), (int)(30 * alpha));

        float yOff = 0;
        for (int id : toRender)
            yOff += itemH * (float) Math.max(0, potionAnimations.get(id).getOutput());
        float winH = headerH + (toRender.isEmpty() ? (isChatOpen ? 3f * scale : 0f) : yOff + 4f * scale);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(posX, posY, animatedPotionWidth, winH, 4f * scale, fonColor, alpha);

        int i2sz = icon2Sz(15);
        Fonts.icon2[i2sz].drawString(stack, "e", posX + 4f * scale, posY + 5.5f * scale, iconColor);
        font(14).drawString(stack, "Potions",
                posX + 4f * scale + Fonts.icon2[i2sz].getWidth("e") + 3f * scale,
                posY + 6f * scale, infoColor);

        float renderY = posY + headerH + 1f * scale;
        for (int id : toRender) {
            EffectInstance inst = lastKnownEffects.get(id);
            Animation anim = potionAnimations.get(id);
            float animP = (float) Math.max(0, anim.getOutput());
            if (animP > 0.001f) {
                float flash = (inst.getDuration() > 0 && inst.getDuration() <= 100)
                        ? 0.4f + (float)(Math.sin(System.currentTimeMillis() / 150.0) + 1.0) / 3.33f
                        : 1f;

                stack.push();
                float cy = renderY + itemH / 2f;
                stack.translate(posX + animatedPotionWidth / 2f, cy, 0);
                stack.scale(1f, animP, 1f);
                stack.translate(-(posX + animatedPotionWidth / 2f), -cy, 0);

                float slide = (1f - animP) * 10f * scale;
                int fAlpha = Math.max(0, Math.min(255, (int)(elAlpha * animP * flash)));
                Effect eff = inst.getPotion();
                String text = I18n.format(inst.getEffectName());
                String dur  = EffectUtils.getPotionDurationString(inst, 1f);
                String lvl  = inst.getAmplifier() != 0 ? " " + (inst.getAmplifier() + 1) : "";
                int effColor = !eff.isBeneficial()
                        ? new Color(182, 35, 35, fAlpha).getRGB()
                        : ColorUtils.setAlpha(textColor, (int)(220 * animP * flash));

                RenderSystem.depthMask(false);
                RenderSystem.enableBlend();
                RenderSystem.defaultBlendFunc();
                TextureAtlasSprite sprite = mc.getPotionSpriteUploader().getSprite(eff);
                mc.getTextureManager().bindTexture(sprite.getAtlasTexture().getTextureLocation());
                blitSprite(stack, posX + 4.5f * scale - slide, renderY + 1f * scale, 10,
                        (int)(7 * scale), (int)(7 * scale), sprite, fAlpha / 255f);
                RenderSystem.depthMask(true);

                effFont.drawString(stack, text, posX + 13f * scale - slide, renderY + 3f * scale, effColor);
                if (inst.getAmplifier() != 0)
                    durFont.drawString(stack, lvl,
                            posX + 13f * scale + effFont.getWidth(text) - slide,
                            renderY + 3f * scale,
                            ColorUtils.setAlpha(textColor, (int)(200 * animP * flash)));

                float tw = durFont.getWidth(dur);
                float tx = posX + animatedPotionWidth - tw - 6f * scale + slide;
                RenderUtils.Render2D.drawRoundedRect(tx - 2f * scale, renderY + 0.5f * scale,
                        tw + 4f * scale, 8f * scale, 1.5f * scale,
                        ColorUtils.setAlpha(iconnoColor, (int)(fAlpha * 0.4f)));
                durFont.drawString(stack, dur, tx, renderY + 3.5f * scale,
                        ColorUtils.setAlpha(textColor, (int)(180 * animP * flash)));

                stack.pop();
                renderY += itemH * animP;
            }
        }

        potionAnimations.entrySet().removeIf(e -> {
            if (e.getValue().isDone() && e.getValue().getDirection() == Direction.BACKWARDS) {
                lastKnownEffects.remove(e.getKey());
                return true;
            }
            return false;
        });

        potionHUD.setWidth(animatedPotionWidth);
        potionHUD.setHeight(winH);
    }

    private void renderTarget(MatrixStack stack) {
        if (mc.player == null || Manager.FUNCTION_MANAGER == null) return;
        float scale = getScale();
        target = resolveTarget(target);
        if (target == null) return;

        thudAlpha.setDirection(allow ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) thudAlpha.getOutput();

        if (target.hurtTime > 0 && !particlesSpawnedThisHit) {
            spawnParticles(); particlesSpawnedThisHit = true;
        } else if (target.hurtTime == 0) {
            particlesSpawnedThisHit = false;
        }

        if (alpha <= 0f) { target = null; return; }

        float x = targetHUD.getX(), y = targetHUD.getY();
        float w = 90f * scale;

        int firstColor = getColorByName("primaryColor");
        int textColor  = getColorByName("textColor");
        int iconColor  = getColorByName("iconColor");
        int goldColor  = getColorByName("goldColor");
        int elAlpha    = (int)(255 * alpha);
        int fonColor   = ColorUtils.setAlpha(getColorByName("fonColor"), getBgOpacity(alpha));

        float faceSize = 24f * scale;
        float itemRowH = 10f * scale;
        float infoH    = faceSize;
        float h        = itemRowH + infoH + 6f * scale;
     
        RenderUtils.Render2D.drawBlurredRoundedRectangle(x, y + itemRowH, w, infoH + 6f * scale,
                4f * scale, fonColor, alpha);
     
     
        renderItemRow(stack, target, x, y, w, scale, elAlpha);

        float contentY = y + itemRowH;
        float faceX    = x + 3f * scale;
        float faceY    = contentY + 3f * scale;

        if (target instanceof AbstractClientPlayerEntity acp) {
            RenderUtils.Render2D.drawRoundFace(faceX, faceY, (int) faceSize, (int) faceSize,
                    3f * scale, alpha, acp);
            if (target.hurtTime > 0)
                RenderUtils.Render2D.drawRoundedRect(
                        faceX - 0.3f * scale, faceY - 0.3f * scale,
                        faceSize + 0.6f * scale, faceSize + 0.6f * scale, 2.5f * scale,
                        new Color(255, 0, 0, (int)(target.hurtTime / 10f * alpha * 100)).getRGB());
        } else {
            StencilUtils.initStencilToWrite();
            RenderUtils.Render2D.drawRoundedRect(faceX, faceY, faceSize, faceSize, 3f * scale,
                    ColorUtils.rgba(21, 21, 21, (int)(190 * alpha)));
            StencilUtils.readStencilBuffer(1);
            int fSz = iconSz(50);
            float iw = Fonts.icon[fSz].getWidth(">");
            Fonts.icon[fSz].drawString(stack, ">",
                    faceX + (faceSize - iw) / 2f, faceY + 2.5f * scale,
                    ColorUtils.setAlpha(iconColor, elAlpha));
            StencilUtils.uninitStencilBuffer();
        }

        float textX = x + faceSize + 6f * scale;
        float textY = contentY + 4f * scale;

        font(13).drawScissorString(stack, target.getName().getString(), textX, textY,
                ColorUtils.setAlpha(textColor, elAlpha), (int)(w - faceSize - 9f * scale));

        health      = MathHelper.clamp(AnimationMath.fast(health,      target.getHealth() / target.getMaxHealth(),           12),   0, 1);
        health2     = MathHelper.clamp(AnimationMath.fast(health2,     target.getHealth() / target.getMaxHealth(),           4.5f), 0, 1);
        healthplus  = MathHelper.clamp(AnimationMath.fast(healthplus,  target.getAbsorptionAmount() / target.getMaxHealth(), 12),   0, 1);
        healthplus2 = MathHelper.clamp(AnimationMath.fast(healthplus2, target.getAbsorptionAmount() / target.getMaxHealth(), 4.5f), 0, 1);

        Color bc = new Color(firstColor);
        float[] hsb = Color.RGBtoHSB(bc.getRed(), bc.getGreen(), bc.getBlue(), null);
        int darker   = Color.getHSBColor(hsb[0], hsb[1], Math.max(0f, hsb[2] - 0.4f)).getRGB();
        Color gC     = new Color(goldColor);
        int darkGold = new Color((int)(gC.getRed()*0.6f),(int)(gC.getGreen()*0.6f),(int)(gC.getBlue()*0.6f)).getRGB();

        String hpStr = (int)(health * target.getMaxHealth()) + " HP";
        Color tc2 = new Color(textColor);
        float[] hsbt = Color.RGBtoHSB(tc2.getRed(), tc2.getGreen(), tc2.getBlue(), null);
        int dimText = ColorUtils.setAlpha(
                Color.getHSBColor(hsbt[0], hsbt[1], Math.max(0f, hsbt[2] - 0.15f)).getRGB(), elAlpha);
        font(11).drawString(stack, hpStr, textX, textY + 9f * scale, dimText);

        float barX = textX;
        float barY = contentY + infoH - 5f * scale;
        float barW = w - faceSize - 9f * scale;
        float barH = 4f * scale;
     
        RenderUtils.Render2D.drawRoundedRect(barX, barY, barW, barH, 2f * scale,
                ColorUtils.setAlpha(firstColor, (int)(55 * alpha)));
     
        if (health >= healthplus) {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health2,  barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(firstColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darker,     (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health,   barH, 2f * scale,
                    ColorUtils.setAlpha(firstColor, elAlpha),
                    ColorUtils.setAlpha(darker,     elAlpha));
        } else {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * healthplus2, barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(goldColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darkGold,  (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * healthplus,  barH, 2f * scale,
                    ColorUtils.setAlpha(goldColor, elAlpha),
                    ColorUtils.setAlpha(darkGold,  elAlpha));
        }
        if (health < healthplus && healthplus > 0) {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health2,  barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(firstColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darker,     (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health,   barH, 2f * scale,
                    ColorUtils.setAlpha(firstColor, elAlpha),
                    ColorUtils.setAlpha(darker,     elAlpha));
        }

        particles.removeIf(p -> System.currentTimeMillis() - p.time > 2000L);
        for (LocalParticle p : particles) {
            p.update();
            float life = 1f - (float)(System.currentTimeMillis() - p.time) / 2000f;
            float ps   = life * 3f * scale;
            if (ps > 0)
                RenderUtils.Render2D.drawRoundedCorner((float) p.pos.x, (float) p.pos.y,
                        ps, ps, ps / 2f,
                        ColorUtils.setAlpha(firstColor, (int)(255f * p.alpha * life)));
        }

        targetHUD.setWidth(w);
        targetHUD.setHeight(h);
    }

    private void renderItemRow(MatrixStack stack, LivingEntity entity,
                               float x, float y, float w, float scale, int elAlpha) {
        float itemSz = 9f * scale;
        float rowH   = 10f * scale;
        float itemY  = y + (rowH - itemSz) / 2f;

        List<ItemStack> all = new ArrayList<>();

        ItemStack offHand = entity.getHeldItemOffhand();
        if (!offHand.isEmpty()) all.add(offHand);

        List<ItemStack> armor = new ArrayList<>();
        for (ItemStack s : entity.getArmorInventoryList()) armor.add(s);
        all.addAll(armor);

        ItemStack mainHand = entity.getHeldItemMainhand();
        if (!mainHand.isEmpty()) all.add(mainHand);

        int count = (int) all.stream().filter(s -> !s.isEmpty()).count();
        if (count == 0) return;

        float totalItemW = count * itemSz + (count - 1) * scale;
        float startX     = x + (w - totalItemW) / 2f;
        float sc         = itemSz / 16f;

        com.mojang.blaze3d.platform.GlStateManager.pushMatrix();
        com.mojang.blaze3d.platform.GlStateManager.scaled(sc, sc, 1.0);

        float cx = startX;
        for (ItemStack s : all) {
            if (s.isEmpty()) continue;
            Hud.drawItemStack(s, cx / sc, itemY / sc, "", false);
            cx += itemSz + scale;
        }

        com.mojang.blaze3d.platform.GlStateManager.popMatrix();
    }

    private LivingEntity resolveTarget(LivingEntity prev) {
        if (Manager.FUNCTION_MANAGER == null) return null;
        LivingEntity t = prev;
        Object auraTarget = Manager.FUNCTION_MANAGER.auraFunction.getTarget();
        if (auraTarget instanceof LivingEntity le) {
            t = le; targetTimer.reset(); allow = true;
        } else if (mc.currentScreen instanceof ChatScreen) {
            t = mc.player; targetTimer.reset(); allow = true;
        } else if (allow && targetTimer.isReached(200)) {
            allow = false;
        }
        return t;
    }

    private void spawnParticles() {
        float hx = targetHUD.getX() + 12f * getScale();
        float hy = targetHUD.getY() + 20f * getScale();
        for (int i = 0; i < 8; i++)
            particles.add(new LocalParticle(new Vector3d(hx, hy, 0)));
    }

    private void blitSprite(MatrixStack ms, float x, float y, int blitOffset,
                            int width, int height, TextureAtlasSprite sprite, float alpha) {
        Matrix4f matrix = ms.getLast().getMatrix();
        BufferBuilder bb = Tessellator.getInstance().getBuffer();
        int a = (int)(alpha * 255);
        bb.begin(7, DefaultVertexFormats.POSITION_COLOR_TEX);
        bb.pos(matrix, x,         y + height, blitOffset).color(255,255,255,a).tex(sprite.getMinU(), sprite.getMaxV()).endVertex();
        bb.pos(matrix, x + width, y + height, blitOffset).color(255,255,255,a).tex(sprite.getMaxU(), sprite.getMaxV()).endVertex();
        bb.pos(matrix, x + width, y,          blitOffset).color(255,255,255,a).tex(sprite.getMaxU(), sprite.getMinV()).endVertex();
        bb.pos(matrix, x,         y,          blitOffset).color(255,255,255,a).tex(sprite.getMinU(), sprite.getMinV()).endVertex();
        bb.finishDrawing();
        RenderSystem.enableBlend();
        RenderSystem.defaultBlendFunc();
        WorldVertexBufferUploader.draw(bb);
    }
}
чел, это даже не похоже а еще ты видно на нуклеаре сидишь, ливни от туда
 
Попытка заскидить старый худ абузика можно настроить прозрачность, размер. Надеюсь оцените (nuclear beta base)

ss
Посмотреть вложение 332592

hud2:
Expand Collapse Copy
package social.module.impl.render;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Vector3d;
import social.Social;
import social.control.Manager;
import social.control.drag.Dragging;
import social.control.events.Event;
import social.control.events.impl.render.EventRender;
import social.module.TypeList;
import social.module.api.Annotation;
import social.module.api.Module;
import social.module.settings.imp.BooleanSetting;
import social.module.settings.imp.MultiBoxSetting;
import social.module.settings.imp.SliderSetting;
import social.utils.ClientUtils;
import social.utils.anim.Animation;
import social.utils.anim.Direction;
import social.utils.anim.impl.DecelerateAnimation;
import social.utils.anim.impl.EaseBackIn;
import social.utils.font.Fonts;
import social.utils.font.styled.StyledFont;
import social.utils.misc.TimerUtil;
import social.utils.render.ColorUtils;
import social.utils.render.RenderUtils;
import social.utils.render.StencilUtils;
import social.utils.render.animation.AnimationMath;

import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

import static social.ui.clickgui.Panel.getColorByName;

@Annotation(name = "Hud2", type = TypeList.Render, desc = "второйхудепты")
public class Hud2 extends Module {

    public MultiBoxSetting elements = new MultiBoxSetting("Elements",
            new BooleanSetting("Watermark", true),
            new BooleanSetting("Keybinds", true),
            new BooleanSetting("Potions", true),
            new BooleanSetting("Target HUD", true));

    public SliderSetting size      = new SliderSetting("Scale",      1,   0.8f, 1.2f, 0.05f);
    public SliderSetting bgOpacity = new SliderSetting("BG Opacity", 200, 0,    255,   5);

    public final Dragging watermark = Social.createDrag(this, "H2Watermark", 7,   7);
    public final Dragging keyBinds  = Social.createDrag(this, "H2KeyBinds",  7,  30);
    public final Dragging potionHUD = Social.createDrag(this, "H2Potion",    7,  80);
    public final Dragging targetHUD = Social.createDrag(this, "H2Target",  300, 200);

    private float wmHue = 0f;

    private float animatedWidth   = 70f;
    private float lastTargetWidth = 0f;
    private float startWidth      = 70f;
    private final Animation kbAlpha   = new DecelerateAnimation(250, 1.0);
    private final Animation widthAnim = new DecelerateAnimation(250, 1.0);

    private final Map<Integer, Animation>      potionAnimations = new HashMap<>();
    private final Map<Integer, EffectInstance> lastKnownEffects = new HashMap<>();
    private float animatedPotionWidth = 75f;
    private final Animation potionAlphaAnim = new EaseBackIn(300, 1, 1.5f);

    private LivingEntity target                 = null;
    private boolean      allow                  = false;
    private boolean      particlesSpawnedThisHit = false;
    private float        health = 0, health2 = 0;
    private float        healthplus = 0, healthplus2 = 0;
    private final Animation thudAlpha   = new DecelerateAnimation(250, 1.0);
    private final TimerUtil targetTimer = new TimerUtil();

    private static class LocalParticle {
        Vector3d pos;
        final Vector3d end;
        final long time;
        float alpha;

        LocalParticle(Vector3d origin) {
            this.pos   = origin;
            this.end   = origin.add(
                    ThreadLocalRandom.current().nextDouble(-40, 40),
                    ThreadLocalRandom.current().nextDouble(-40, 40),
                    0);
            this.time  = System.currentTimeMillis();
            this.alpha = 0f;
        }

        void update() {
            alpha = MathHelper.lerp(alpha, 1f, 0.1f);
            pos   = AnimationMath.fast(pos, end, 0.5f);
        }
    }

    private final List<LocalParticle> particles = new ArrayList<>();

    public Hud2() {
        addSettings(elements, size, bgOpacity);
    }

    private float getScale() {
        return size.getValue().floatValue();
    }

    private int getBgOpacity(float alpha) {
        return (int)(bgOpacity.getValue().floatValue() * alpha);
    }

    private StyledFont font(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.newcode.length - 1));
        if (Fonts.newcode[s] != null) return Fonts.newcode[s];
        for (int i = s; i >= 10; i--)
            if (i < Fonts.newcode.length && Fonts.newcode[i] != null) return Fonts.newcode[i];
        return Fonts.newcode[Math.min(14, Fonts.newcode.length - 1)];
    }

    private int iconSz(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.icon.length - 1));
        if (Fonts.icon[s] != null) return s;
        for (int i = s; i >= 10; i--)
            if (i < Fonts.icon.length && Fonts.icon[i] != null) return i;
        return Math.min(15, Fonts.icon.length - 1);
    }

    private int icon2Sz(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.icon2.length - 1));
        if (Fonts.icon2[s] != null) return s;
        for (int i = s; i >= 10; i--)
            if (i < Fonts.icon2.length && Fonts.icon2[i] != null) return i;
        return Math.min(15, Fonts.icon2.length - 1);
    }

    @Override
    public boolean onEvent(Event event) {
        if (!(event instanceof EventRender er) || !er.isRender2D()) return false;
        MatrixStack stack = er.matrixStack;
        if (mc.gameSettings.showDebugInfo) return false;
        if (elements.get(0)) renderWatermark(stack);
        if (elements.get(1)) renderKeyBinds(stack);
        if (elements.get(2)) renderPotions(stack);
        if (elements.get(3)) renderTarget(stack);
        return false;
    }

    private void renderWatermark(MatrixStack stack) {
        if (mc.player == null) return;
        float scale = getScale();
        float x = watermark.getX(), y = watermark.getY();
        float h = 13f * scale, r = 3f * scale, pad = 5f * scale;

        StyledFont f = font(13);

        wmHue += 0.005f;
        if (wmHue > 1f) wmHue -= 1f;
        float hue = 0.611f + (float)(Math.sin(wmHue * Math.PI * 2) * 0.5 + 0.5) * 0.056f;
        int arbuzColor = Color.HSBtoRGB(hue, 0.65f, 1.00f) | 0xFF000000;

        String clientName = "social";
        String gap        = "    ";
        String serverIp   = getServerIp();
        String playerName = mc.player.getName().getString();

        float nameW   = f.getWidth(clientName);
        float gapW    = f.getWidth(gap);
        float ipW     = f.getWidth(serverIp);
        float playerW = f.getWidth(playerName);
        float totalW  = pad + nameW + gapW + ipW + gapW + playerW + pad;

        int fonColor  = ColorUtils.setAlpha(getColorByName("fonColor"), getBgOpacity(1f));
        int textColor = getColorByName("textColor");
        int dotColor  = ColorUtils.setAlpha(textColor, 130);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(x, y, totalW, h, r, fonColor, 1f);

        float fontH = f.getFontHeight() / 2f;
        float ty    = y + (h - fontH) / 2f;
        float dotY  = y + h / 2f;
        float dotR  = 1.2f * scale;

        float cx = x + pad;

        f.drawString(stack, clientName, cx, ty, arbuzColor);
        cx += nameW + gapW / 2f;

        RenderUtils.Render2D.drawCircle2(cx, dotY - 0.5f * scale, dotR * 0.55f, dotColor);
        cx += gapW / 2f;

        f.drawString(stack, serverIp, cx, ty, textColor);
        cx += ipW + gapW / 2f;

        RenderUtils.Render2D.drawCircle2(cx, dotY - 0.5f * scale, dotR * 0.55f, dotColor);
        cx += gapW / 2f;

        f.drawString(stack, playerName, cx, ty, textColor);

        watermark.setWidth(totalW);
        watermark.setHeight(h);
    }

    private String getServerIp() {
        if (mc.getCurrentServerData() != null) {
            String ip = mc.getCurrentServerData().serverIP;
            return (ip != null && !ip.isEmpty()) ? ip : "singleplayer";
        }
        return "singleplayer";
    }

    private void renderKeyBinds(MatrixStack stack) {
        if (Manager.FUNCTION_MANAGER == null) return;
        float scale = getScale();
        boolean isChatOpen = mc.currentScreen instanceof ChatScreen;

        StyledFont nameFont = font(13), bindFont = font(11);
        int i2sz = icon2Sz(15);

        List<Module> activeBinds = new ArrayList<>();
        float maxW = 0;

        for (Module f : Manager.FUNCTION_MANAGER.getFunctions()) {
            if (f == null) continue;
            f.animation.setDirection(f.state && f.bind != 0 ? Direction.FORWARDS : Direction.BACKWARDS);
            if (!f.animation.isDone() || (f.state && f.bind != 0)) {
                activeBinds.add(f);
                String bind = formatBind(f.bind);
                float w = nameFont.getWidth(f.name) + bindFont.getWidth(bind) + 24f * scale;
                if (w > maxW) maxW = w;
            }
        }

        kbAlpha.setDirection((!activeBinds.isEmpty() || isChatOpen) ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) kbAlpha.getOutput();
        if (alpha <= 0.01f) { animatedWidth = 70f * scale; return; }

        float targetW = Math.max(70f * scale, maxW);
        if (targetW != lastTargetWidth) {
            startWidth = animatedWidth; lastTargetWidth = targetW; widthAnim.reset();
        }
        animatedWidth = widthAnim.isDone()
                ? targetW
                : startWidth + (targetW - startWidth) * (float) widthAnim.getOutput();

        float posX = keyBinds.getX(), posY = keyBinds.getY();
        float headerH = 15f * scale, itemH = 9f * scale;

        float yOff = 0;
        for (Module f : activeBinds) yOff += itemH * f.animation.getOutput();
        float winH = headerH + (activeBinds.isEmpty() ? (isChatOpen ? 3f * scale : 0f) : yOff + 4f * scale);

        int elAlpha   = (int)(255 * alpha);
        int fonColor  = ColorUtils.setAlpha(getColorByName("fonColor"),  getBgOpacity(alpha));
        int infoColor = ColorUtils.setAlpha(getColorByName("infoColor"), elAlpha);
        int iconColor = ColorUtils.setAlpha(getColorByName("iconColor"), elAlpha);
        int textColor = ColorUtils.setAlpha(getColorByName("textColor"), elAlpha);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(posX, posY, animatedWidth, winH, 4f * scale, fonColor, alpha);

        String headerIcon = "f";
        float iconW = Fonts.icon2[i2sz].getWidth(headerIcon);
        Fonts.icon2[i2sz].drawString(stack, headerIcon, posX + 4f * scale, posY + 5.5f * scale, iconColor);
        font(14).drawString(stack, "Binds", posX + 4f * scale + iconW + 3f * scale, posY + 6f * scale, infoColor);

        float renderY = posY + headerH + 1f * scale;
        for (Module f : activeBinds) {
            float anim = (float) f.animation.getOutput();
            if (anim > 0.01f) {
                stack.push();
                float cy = renderY + itemH / 2f;
                stack.translate(posX + animatedWidth / 2f, cy, 0);
                stack.scale(1f, anim, 1f);
                stack.translate(-(posX + animatedWidth / 2f), -cy, 0);

                nameFont.drawString(stack, f.name, posX + 6f * scale, renderY + 3f * scale,
                        ColorUtils.setAlpha(textColor, (int)(220 * anim)));

                String bind = formatBind(f.bind);
                float bw = bindFont.getWidth(bind);
                bindFont.drawString(stack, bind, posX + animatedWidth - bw - 5f * scale, renderY + 3.5f * scale,
                        ColorUtils.setAlpha(textColor, (int)(160 * anim)));

                stack.pop();
                renderY += itemH * anim;
            }
        }

        keyBinds.setWidth(animatedWidth);
        keyBinds.setHeight(winH);
    }

    private String formatBind(int bind) {
        String b = ClientUtils.getKey(bind)
                .replace("MOUSE",   "M")
                .replace("CONTROL", "C")
                .replace("LEFT",    "L")
                .replace("RIGHT",   "R")
                .replace("_",       "");
        return b.substring(0, Math.min(b.length(), 4)).toUpperCase();
    }

    private void renderPotions(MatrixStack stack) {
        if (mc.player == null) return;
        float scale = getScale();
        float posX = potionHUD.getX(), posY = potionHUD.getY();
        float headerH = 15f * scale, itemH = 9f * scale;

        Collection<EffectInstance> current = mc.player.getActivePotionEffects();
        for (EffectInstance eff : current) {
            int id = System.identityHashCode(eff);
            lastKnownEffects.put(id, eff);
            potionAnimations.computeIfAbsent(id, k -> new EaseBackIn(300, 1, 1.5f))
                    .setDirection(Direction.FORWARDS);
        }
        potionAnimations.forEach((id, anim) -> {
            if (current.stream().noneMatch(e -> System.identityHashCode(e) == id))
                anim.setDirection(Direction.BACKWARDS);
        });

        List<Integer> toRender = new ArrayList<>();
        float maxW = 0;
        StyledFont effFont = font(13), durFont = font(12);

        for (Map.Entry<Integer, Animation> e : potionAnimations.entrySet()) {
            int id = e.getKey();
            if (!e.getValue().isDone() || e.getValue().getDirection() == Direction.FORWARDS) {
                EffectInstance inst = lastKnownEffects.get(id);
                if (inst != null) {
                    toRender.add(id);
                    float w = effFont.getWidth(I18n.format(inst.getEffectName()))
                            + durFont.getWidth(EffectUtils.getPotionDurationString(inst, 1f))
                            + 35f * scale;
                    if (w > maxW) maxW = w;
                }
            }
        }

        boolean isChatOpen = mc.currentScreen instanceof ChatScreen;
        potionAlphaAnim.setDirection((!toRender.isEmpty() || isChatOpen) ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) Math.max(0, Math.min(1, potionAlphaAnim.getOutput()));
        if (alpha <= 0f) { animatedPotionWidth = 75f * scale; return; }

        float targetW = Math.max(75f * scale, maxW);
        animatedPotionWidth += (targetW - animatedPotionWidth) * 0.15f;

        int elAlpha     = (int)(255 * alpha);
        int fonColor    = ColorUtils.setAlpha(getColorByName("fonColor"),    getBgOpacity(alpha));
        int infoColor   = ColorUtils.setAlpha(getColorByName("infoColor"),   elAlpha);
        int iconColor   = ColorUtils.setAlpha(getColorByName("iconColor"),   elAlpha);
        int textColor   = ColorUtils.setAlpha(getColorByName("textColor"),   elAlpha);
        int iconnoColor = ColorUtils.setAlpha(getColorByName("iconnoColor"), (int)(30 * alpha));

        float yOff = 0;
        for (int id : toRender)
            yOff += itemH * (float) Math.max(0, potionAnimations.get(id).getOutput());
        float winH = headerH + (toRender.isEmpty() ? (isChatOpen ? 3f * scale : 0f) : yOff + 4f * scale);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(posX, posY, animatedPotionWidth, winH, 4f * scale, fonColor, alpha);

        int i2sz = icon2Sz(15);
        Fonts.icon2[i2sz].drawString(stack, "e", posX + 4f * scale, posY + 5.5f * scale, iconColor);
        font(14).drawString(stack, "Potions",
                posX + 4f * scale + Fonts.icon2[i2sz].getWidth("e") + 3f * scale,
                posY + 6f * scale, infoColor);

        float renderY = posY + headerH + 1f * scale;
        for (int id : toRender) {
            EffectInstance inst = lastKnownEffects.get(id);
            Animation anim = potionAnimations.get(id);
            float animP = (float) Math.max(0, anim.getOutput());
            if (animP > 0.001f) {
                float flash = (inst.getDuration() > 0 && inst.getDuration() <= 100)
                        ? 0.4f + (float)(Math.sin(System.currentTimeMillis() / 150.0) + 1.0) / 3.33f
                        : 1f;

                stack.push();
                float cy = renderY + itemH / 2f;
                stack.translate(posX + animatedPotionWidth / 2f, cy, 0);
                stack.scale(1f, animP, 1f);
                stack.translate(-(posX + animatedPotionWidth / 2f), -cy, 0);

                float slide = (1f - animP) * 10f * scale;
                int fAlpha = Math.max(0, Math.min(255, (int)(elAlpha * animP * flash)));
                Effect eff = inst.getPotion();
                String text = I18n.format(inst.getEffectName());
                String dur  = EffectUtils.getPotionDurationString(inst, 1f);
                String lvl  = inst.getAmplifier() != 0 ? " " + (inst.getAmplifier() + 1) : "";
                int effColor = !eff.isBeneficial()
                        ? new Color(182, 35, 35, fAlpha).getRGB()
                        : ColorUtils.setAlpha(textColor, (int)(220 * animP * flash));

                RenderSystem.depthMask(false);
                RenderSystem.enableBlend();
                RenderSystem.defaultBlendFunc();
                TextureAtlasSprite sprite = mc.getPotionSpriteUploader().getSprite(eff);
                mc.getTextureManager().bindTexture(sprite.getAtlasTexture().getTextureLocation());
                blitSprite(stack, posX + 4.5f * scale - slide, renderY + 1f * scale, 10,
                        (int)(7 * scale), (int)(7 * scale), sprite, fAlpha / 255f);
                RenderSystem.depthMask(true);

                effFont.drawString(stack, text, posX + 13f * scale - slide, renderY + 3f * scale, effColor);
                if (inst.getAmplifier() != 0)
                    durFont.drawString(stack, lvl,
                            posX + 13f * scale + effFont.getWidth(text) - slide,
                            renderY + 3f * scale,
                            ColorUtils.setAlpha(textColor, (int)(200 * animP * flash)));

                float tw = durFont.getWidth(dur);
                float tx = posX + animatedPotionWidth - tw - 6f * scale + slide;
                RenderUtils.Render2D.drawRoundedRect(tx - 2f * scale, renderY + 0.5f * scale,
                        tw + 4f * scale, 8f * scale, 1.5f * scale,
                        ColorUtils.setAlpha(iconnoColor, (int)(fAlpha * 0.4f)));
                durFont.drawString(stack, dur, tx, renderY + 3.5f * scale,
                        ColorUtils.setAlpha(textColor, (int)(180 * animP * flash)));

                stack.pop();
                renderY += itemH * animP;
            }
        }

        potionAnimations.entrySet().removeIf(e -> {
            if (e.getValue().isDone() && e.getValue().getDirection() == Direction.BACKWARDS) {
                lastKnownEffects.remove(e.getKey());
                return true;
            }
            return false;
        });

        potionHUD.setWidth(animatedPotionWidth);
        potionHUD.setHeight(winH);
    }

    private void renderTarget(MatrixStack stack) {
        if (mc.player == null || Manager.FUNCTION_MANAGER == null) return;
        float scale = getScale();
        target = resolveTarget(target);
        if (target == null) return;

        thudAlpha.setDirection(allow ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) thudAlpha.getOutput();

        if (target.hurtTime > 0 && !particlesSpawnedThisHit) {
            spawnParticles(); particlesSpawnedThisHit = true;
        } else if (target.hurtTime == 0) {
            particlesSpawnedThisHit = false;
        }

        if (alpha <= 0f) { target = null; return; }

        float x = targetHUD.getX(), y = targetHUD.getY();
        float w = 90f * scale;

        int firstColor = getColorByName("primaryColor");
        int textColor  = getColorByName("textColor");
        int iconColor  = getColorByName("iconColor");
        int goldColor  = getColorByName("goldColor");
        int elAlpha    = (int)(255 * alpha);
        int fonColor   = ColorUtils.setAlpha(getColorByName("fonColor"), getBgOpacity(alpha));

        float faceSize = 24f * scale;
        float itemRowH = 10f * scale;
        float infoH    = faceSize;
        float h        = itemRowH + infoH + 6f * scale;
     
        RenderUtils.Render2D.drawBlurredRoundedRectangle(x, y + itemRowH, w, infoH + 6f * scale,
                4f * scale, fonColor, alpha);
     
     
        renderItemRow(stack, target, x, y, w, scale, elAlpha);

        float contentY = y + itemRowH;
        float faceX    = x + 3f * scale;
        float faceY    = contentY + 3f * scale;

        if (target instanceof AbstractClientPlayerEntity acp) {
            RenderUtils.Render2D.drawRoundFace(faceX, faceY, (int) faceSize, (int) faceSize,
                    3f * scale, alpha, acp);
            if (target.hurtTime > 0)
                RenderUtils.Render2D.drawRoundedRect(
                        faceX - 0.3f * scale, faceY - 0.3f * scale,
                        faceSize + 0.6f * scale, faceSize + 0.6f * scale, 2.5f * scale,
                        new Color(255, 0, 0, (int)(target.hurtTime / 10f * alpha * 100)).getRGB());
        } else {
            StencilUtils.initStencilToWrite();
            RenderUtils.Render2D.drawRoundedRect(faceX, faceY, faceSize, faceSize, 3f * scale,
                    ColorUtils.rgba(21, 21, 21, (int)(190 * alpha)));
            StencilUtils.readStencilBuffer(1);
            int fSz = iconSz(50);
            float iw = Fonts.icon[fSz].getWidth(">");
            Fonts.icon[fSz].drawString(stack, ">",
                    faceX + (faceSize - iw) / 2f, faceY + 2.5f * scale,
                    ColorUtils.setAlpha(iconColor, elAlpha));
            StencilUtils.uninitStencilBuffer();
        }

        float textX = x + faceSize + 6f * scale;
        float textY = contentY + 4f * scale;

        font(13).drawScissorString(stack, target.getName().getString(), textX, textY,
                ColorUtils.setAlpha(textColor, elAlpha), (int)(w - faceSize - 9f * scale));

        health      = MathHelper.clamp(AnimationMath.fast(health,      target.getHealth() / target.getMaxHealth(),           12),   0, 1);
        health2     = MathHelper.clamp(AnimationMath.fast(health2,     target.getHealth() / target.getMaxHealth(),           4.5f), 0, 1);
        healthplus  = MathHelper.clamp(AnimationMath.fast(healthplus,  target.getAbsorptionAmount() / target.getMaxHealth(), 12),   0, 1);
        healthplus2 = MathHelper.clamp(AnimationMath.fast(healthplus2, target.getAbsorptionAmount() / target.getMaxHealth(), 4.5f), 0, 1);

        Color bc = new Color(firstColor);
        float[] hsb = Color.RGBtoHSB(bc.getRed(), bc.getGreen(), bc.getBlue(), null);
        int darker   = Color.getHSBColor(hsb[0], hsb[1], Math.max(0f, hsb[2] - 0.4f)).getRGB();
        Color gC     = new Color(goldColor);
        int darkGold = new Color((int)(gC.getRed()*0.6f),(int)(gC.getGreen()*0.6f),(int)(gC.getBlue()*0.6f)).getRGB();

        String hpStr = (int)(health * target.getMaxHealth()) + " HP";
        Color tc2 = new Color(textColor);
        float[] hsbt = Color.RGBtoHSB(tc2.getRed(), tc2.getGreen(), tc2.getBlue(), null);
        int dimText = ColorUtils.setAlpha(
                Color.getHSBColor(hsbt[0], hsbt[1], Math.max(0f, hsbt[2] - 0.15f)).getRGB(), elAlpha);
        font(11).drawString(stack, hpStr, textX, textY + 9f * scale, dimText);

        float barX = textX;
        float barY = contentY + infoH - 5f * scale;
        float barW = w - faceSize - 9f * scale;
        float barH = 4f * scale;
     
        RenderUtils.Render2D.drawRoundedRect(barX, barY, barW, barH, 2f * scale,
                ColorUtils.setAlpha(firstColor, (int)(55 * alpha)));
     
        if (health >= healthplus) {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health2,  barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(firstColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darker,     (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health,   barH, 2f * scale,
                    ColorUtils.setAlpha(firstColor, elAlpha),
                    ColorUtils.setAlpha(darker,     elAlpha));
        } else {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * healthplus2, barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(goldColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darkGold,  (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * healthplus,  barH, 2f * scale,
                    ColorUtils.setAlpha(goldColor, elAlpha),
                    ColorUtils.setAlpha(darkGold,  elAlpha));
        }
        if (health < healthplus && healthplus > 0) {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health2,  barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(firstColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darker,     (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health,   barH, 2f * scale,
                    ColorUtils.setAlpha(firstColor, elAlpha),
                    ColorUtils.setAlpha(darker,     elAlpha));
        }

        particles.removeIf(p -> System.currentTimeMillis() - p.time > 2000L);
        for (LocalParticle p : particles) {
            p.update();
            float life = 1f - (float)(System.currentTimeMillis() - p.time) / 2000f;
            float ps   = life * 3f * scale;
            if (ps > 0)
                RenderUtils.Render2D.drawRoundedCorner((float) p.pos.x, (float) p.pos.y,
                        ps, ps, ps / 2f,
                        ColorUtils.setAlpha(firstColor, (int)(255f * p.alpha * life)));
        }

        targetHUD.setWidth(w);
        targetHUD.setHeight(h);
    }

    private void renderItemRow(MatrixStack stack, LivingEntity entity,
                               float x, float y, float w, float scale, int elAlpha) {
        float itemSz = 9f * scale;
        float rowH   = 10f * scale;
        float itemY  = y + (rowH - itemSz) / 2f;

        List<ItemStack> all = new ArrayList<>();

        ItemStack offHand = entity.getHeldItemOffhand();
        if (!offHand.isEmpty()) all.add(offHand);

        List<ItemStack> armor = new ArrayList<>();
        for (ItemStack s : entity.getArmorInventoryList()) armor.add(s);
        all.addAll(armor);

        ItemStack mainHand = entity.getHeldItemMainhand();
        if (!mainHand.isEmpty()) all.add(mainHand);

        int count = (int) all.stream().filter(s -> !s.isEmpty()).count();
        if (count == 0) return;

        float totalItemW = count * itemSz + (count - 1) * scale;
        float startX     = x + (w - totalItemW) / 2f;
        float sc         = itemSz / 16f;

        com.mojang.blaze3d.platform.GlStateManager.pushMatrix();
        com.mojang.blaze3d.platform.GlStateManager.scaled(sc, sc, 1.0);

        float cx = startX;
        for (ItemStack s : all) {
            if (s.isEmpty()) continue;
            Hud.drawItemStack(s, cx / sc, itemY / sc, "", false);
            cx += itemSz + scale;
        }

        com.mojang.blaze3d.platform.GlStateManager.popMatrix();
    }

    private LivingEntity resolveTarget(LivingEntity prev) {
        if (Manager.FUNCTION_MANAGER == null) return null;
        LivingEntity t = prev;
        Object auraTarget = Manager.FUNCTION_MANAGER.auraFunction.getTarget();
        if (auraTarget instanceof LivingEntity le) {
            t = le; targetTimer.reset(); allow = true;
        } else if (mc.currentScreen instanceof ChatScreen) {
            t = mc.player; targetTimer.reset(); allow = true;
        } else if (allow && targetTimer.isReached(200)) {
            allow = false;
        }
        return t;
    }

    private void spawnParticles() {
        float hx = targetHUD.getX() + 12f * getScale();
        float hy = targetHUD.getY() + 20f * getScale();
        for (int i = 0; i < 8; i++)
            particles.add(new LocalParticle(new Vector3d(hx, hy, 0)));
    }

    private void blitSprite(MatrixStack ms, float x, float y, int blitOffset,
                            int width, int height, TextureAtlasSprite sprite, float alpha) {
        Matrix4f matrix = ms.getLast().getMatrix();
        BufferBuilder bb = Tessellator.getInstance().getBuffer();
        int a = (int)(alpha * 255);
        bb.begin(7, DefaultVertexFormats.POSITION_COLOR_TEX);
        bb.pos(matrix, x,         y + height, blitOffset).color(255,255,255,a).tex(sprite.getMinU(), sprite.getMaxV()).endVertex();
        bb.pos(matrix, x + width, y + height, blitOffset).color(255,255,255,a).tex(sprite.getMaxU(), sprite.getMaxV()).endVertex();
        bb.pos(matrix, x + width, y,          blitOffset).color(255,255,255,a).tex(sprite.getMaxU(), sprite.getMinV()).endVertex();
        bb.pos(matrix, x,         y,          blitOffset).color(255,255,255,a).tex(sprite.getMinU(), sprite.getMinV()).endVertex();
        bb.finishDrawing();
        RenderSystem.enableBlend();
        RenderSystem.defaultBlendFunc();
        WorldVertexBufferUploader.draw(bb);
    }
}
/del хуйня
 
Попытка заскидить старый худ абузика можно настроить прозрачность, размер. Надеюсь оцените (nuclear beta base)

ss
Посмотреть вложение 332592

hud2:
Expand Collapse Copy
package social.module.impl.render;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Vector3d;
import social.Social;
import social.control.Manager;
import social.control.drag.Dragging;
import social.control.events.Event;
import social.control.events.impl.render.EventRender;
import social.module.TypeList;
import social.module.api.Annotation;
import social.module.api.Module;
import social.module.settings.imp.BooleanSetting;
import social.module.settings.imp.MultiBoxSetting;
import social.module.settings.imp.SliderSetting;
import social.utils.ClientUtils;
import social.utils.anim.Animation;
import social.utils.anim.Direction;
import social.utils.anim.impl.DecelerateAnimation;
import social.utils.anim.impl.EaseBackIn;
import social.utils.font.Fonts;
import social.utils.font.styled.StyledFont;
import social.utils.misc.TimerUtil;
import social.utils.render.ColorUtils;
import social.utils.render.RenderUtils;
import social.utils.render.StencilUtils;
import social.utils.render.animation.AnimationMath;

import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

import static social.ui.clickgui.Panel.getColorByName;

@Annotation(name = "Hud2", type = TypeList.Render, desc = "второйхудепты")
public class Hud2 extends Module {

    public MultiBoxSetting elements = new MultiBoxSetting("Elements",
            new BooleanSetting("Watermark", true),
            new BooleanSetting("Keybinds", true),
            new BooleanSetting("Potions", true),
            new BooleanSetting("Target HUD", true));

    public SliderSetting size      = new SliderSetting("Scale",      1,   0.8f, 1.2f, 0.05f);
    public SliderSetting bgOpacity = new SliderSetting("BG Opacity", 200, 0,    255,   5);

    public final Dragging watermark = Social.createDrag(this, "H2Watermark", 7,   7);
    public final Dragging keyBinds  = Social.createDrag(this, "H2KeyBinds",  7,  30);
    public final Dragging potionHUD = Social.createDrag(this, "H2Potion",    7,  80);
    public final Dragging targetHUD = Social.createDrag(this, "H2Target",  300, 200);

    private float wmHue = 0f;

    private float animatedWidth   = 70f;
    private float lastTargetWidth = 0f;
    private float startWidth      = 70f;
    private final Animation kbAlpha   = new DecelerateAnimation(250, 1.0);
    private final Animation widthAnim = new DecelerateAnimation(250, 1.0);

    private final Map<Integer, Animation>      potionAnimations = new HashMap<>();
    private final Map<Integer, EffectInstance> lastKnownEffects = new HashMap<>();
    private float animatedPotionWidth = 75f;
    private final Animation potionAlphaAnim = new EaseBackIn(300, 1, 1.5f);

    private LivingEntity target                 = null;
    private boolean      allow                  = false;
    private boolean      particlesSpawnedThisHit = false;
    private float        health = 0, health2 = 0;
    private float        healthplus = 0, healthplus2 = 0;
    private final Animation thudAlpha   = new DecelerateAnimation(250, 1.0);
    private final TimerUtil targetTimer = new TimerUtil();

    private static class LocalParticle {
        Vector3d pos;
        final Vector3d end;
        final long time;
        float alpha;

        LocalParticle(Vector3d origin) {
            this.pos   = origin;
            this.end   = origin.add(
                    ThreadLocalRandom.current().nextDouble(-40, 40),
                    ThreadLocalRandom.current().nextDouble(-40, 40),
                    0);
            this.time  = System.currentTimeMillis();
            this.alpha = 0f;
        }

        void update() {
            alpha = MathHelper.lerp(alpha, 1f, 0.1f);
            pos   = AnimationMath.fast(pos, end, 0.5f);
        }
    }

    private final List<LocalParticle> particles = new ArrayList<>();

    public Hud2() {
        addSettings(elements, size, bgOpacity);
    }

    private float getScale() {
        return size.getValue().floatValue();
    }

    private int getBgOpacity(float alpha) {
        return (int)(bgOpacity.getValue().floatValue() * alpha);
    }

    private StyledFont font(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.newcode.length - 1));
        if (Fonts.newcode[s] != null) return Fonts.newcode[s];
        for (int i = s; i >= 10; i--)
            if (i < Fonts.newcode.length && Fonts.newcode[i] != null) return Fonts.newcode[i];
        return Fonts.newcode[Math.min(14, Fonts.newcode.length - 1)];
    }

    private int iconSz(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.icon.length - 1));
        if (Fonts.icon[s] != null) return s;
        for (int i = s; i >= 10; i--)
            if (i < Fonts.icon.length && Fonts.icon[i] != null) return i;
        return Math.min(15, Fonts.icon.length - 1);
    }

    private int icon2Sz(int base) {
        int s = Math.max(10, Math.min((int)(base * getScale()), Fonts.icon2.length - 1));
        if (Fonts.icon2[s] != null) return s;
        for (int i = s; i >= 10; i--)
            if (i < Fonts.icon2.length && Fonts.icon2[i] != null) return i;
        return Math.min(15, Fonts.icon2.length - 1);
    }

    @Override
    public boolean onEvent(Event event) {
        if (!(event instanceof EventRender er) || !er.isRender2D()) return false;
        MatrixStack stack = er.matrixStack;
        if (mc.gameSettings.showDebugInfo) return false;
        if (elements.get(0)) renderWatermark(stack);
        if (elements.get(1)) renderKeyBinds(stack);
        if (elements.get(2)) renderPotions(stack);
        if (elements.get(3)) renderTarget(stack);
        return false;
    }

    private void renderWatermark(MatrixStack stack) {
        if (mc.player == null) return;
        float scale = getScale();
        float x = watermark.getX(), y = watermark.getY();
        float h = 13f * scale, r = 3f * scale, pad = 5f * scale;

        StyledFont f = font(13);

        wmHue += 0.005f;
        if (wmHue > 1f) wmHue -= 1f;
        float hue = 0.611f + (float)(Math.sin(wmHue * Math.PI * 2) * 0.5 + 0.5) * 0.056f;
        int arbuzColor = Color.HSBtoRGB(hue, 0.65f, 1.00f) | 0xFF000000;

        String clientName = "social";
        String gap        = "    ";
        String serverIp   = getServerIp();
        String playerName = mc.player.getName().getString();

        float nameW   = f.getWidth(clientName);
        float gapW    = f.getWidth(gap);
        float ipW     = f.getWidth(serverIp);
        float playerW = f.getWidth(playerName);
        float totalW  = pad + nameW + gapW + ipW + gapW + playerW + pad;

        int fonColor  = ColorUtils.setAlpha(getColorByName("fonColor"), getBgOpacity(1f));
        int textColor = getColorByName("textColor");
        int dotColor  = ColorUtils.setAlpha(textColor, 130);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(x, y, totalW, h, r, fonColor, 1f);

        float fontH = f.getFontHeight() / 2f;
        float ty    = y + (h - fontH) / 2f;
        float dotY  = y + h / 2f;
        float dotR  = 1.2f * scale;

        float cx = x + pad;

        f.drawString(stack, clientName, cx, ty, arbuzColor);
        cx += nameW + gapW / 2f;

        RenderUtils.Render2D.drawCircle2(cx, dotY - 0.5f * scale, dotR * 0.55f, dotColor);
        cx += gapW / 2f;

        f.drawString(stack, serverIp, cx, ty, textColor);
        cx += ipW + gapW / 2f;

        RenderUtils.Render2D.drawCircle2(cx, dotY - 0.5f * scale, dotR * 0.55f, dotColor);
        cx += gapW / 2f;

        f.drawString(stack, playerName, cx, ty, textColor);

        watermark.setWidth(totalW);
        watermark.setHeight(h);
    }

    private String getServerIp() {
        if (mc.getCurrentServerData() != null) {
            String ip = mc.getCurrentServerData().serverIP;
            return (ip != null && !ip.isEmpty()) ? ip : "singleplayer";
        }
        return "singleplayer";
    }

    private void renderKeyBinds(MatrixStack stack) {
        if (Manager.FUNCTION_MANAGER == null) return;
        float scale = getScale();
        boolean isChatOpen = mc.currentScreen instanceof ChatScreen;

        StyledFont nameFont = font(13), bindFont = font(11);
        int i2sz = icon2Sz(15);

        List<Module> activeBinds = new ArrayList<>();
        float maxW = 0;

        for (Module f : Manager.FUNCTION_MANAGER.getFunctions()) {
            if (f == null) continue;
            f.animation.setDirection(f.state && f.bind != 0 ? Direction.FORWARDS : Direction.BACKWARDS);
            if (!f.animation.isDone() || (f.state && f.bind != 0)) {
                activeBinds.add(f);
                String bind = formatBind(f.bind);
                float w = nameFont.getWidth(f.name) + bindFont.getWidth(bind) + 24f * scale;
                if (w > maxW) maxW = w;
            }
        }

        kbAlpha.setDirection((!activeBinds.isEmpty() || isChatOpen) ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) kbAlpha.getOutput();
        if (alpha <= 0.01f) { animatedWidth = 70f * scale; return; }

        float targetW = Math.max(70f * scale, maxW);
        if (targetW != lastTargetWidth) {
            startWidth = animatedWidth; lastTargetWidth = targetW; widthAnim.reset();
        }
        animatedWidth = widthAnim.isDone()
                ? targetW
                : startWidth + (targetW - startWidth) * (float) widthAnim.getOutput();

        float posX = keyBinds.getX(), posY = keyBinds.getY();
        float headerH = 15f * scale, itemH = 9f * scale;

        float yOff = 0;
        for (Module f : activeBinds) yOff += itemH * f.animation.getOutput();
        float winH = headerH + (activeBinds.isEmpty() ? (isChatOpen ? 3f * scale : 0f) : yOff + 4f * scale);

        int elAlpha   = (int)(255 * alpha);
        int fonColor  = ColorUtils.setAlpha(getColorByName("fonColor"),  getBgOpacity(alpha));
        int infoColor = ColorUtils.setAlpha(getColorByName("infoColor"), elAlpha);
        int iconColor = ColorUtils.setAlpha(getColorByName("iconColor"), elAlpha);
        int textColor = ColorUtils.setAlpha(getColorByName("textColor"), elAlpha);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(posX, posY, animatedWidth, winH, 4f * scale, fonColor, alpha);

        String headerIcon = "f";
        float iconW = Fonts.icon2[i2sz].getWidth(headerIcon);
        Fonts.icon2[i2sz].drawString(stack, headerIcon, posX + 4f * scale, posY + 5.5f * scale, iconColor);
        font(14).drawString(stack, "Binds", posX + 4f * scale + iconW + 3f * scale, posY + 6f * scale, infoColor);

        float renderY = posY + headerH + 1f * scale;
        for (Module f : activeBinds) {
            float anim = (float) f.animation.getOutput();
            if (anim > 0.01f) {
                stack.push();
                float cy = renderY + itemH / 2f;
                stack.translate(posX + animatedWidth / 2f, cy, 0);
                stack.scale(1f, anim, 1f);
                stack.translate(-(posX + animatedWidth / 2f), -cy, 0);

                nameFont.drawString(stack, f.name, posX + 6f * scale, renderY + 3f * scale,
                        ColorUtils.setAlpha(textColor, (int)(220 * anim)));

                String bind = formatBind(f.bind);
                float bw = bindFont.getWidth(bind);
                bindFont.drawString(stack, bind, posX + animatedWidth - bw - 5f * scale, renderY + 3.5f * scale,
                        ColorUtils.setAlpha(textColor, (int)(160 * anim)));

                stack.pop();
                renderY += itemH * anim;
            }
        }

        keyBinds.setWidth(animatedWidth);
        keyBinds.setHeight(winH);
    }

    private String formatBind(int bind) {
        String b = ClientUtils.getKey(bind)
                .replace("MOUSE",   "M")
                .replace("CONTROL", "C")
                .replace("LEFT",    "L")
                .replace("RIGHT",   "R")
                .replace("_",       "");
        return b.substring(0, Math.min(b.length(), 4)).toUpperCase();
    }

    private void renderPotions(MatrixStack stack) {
        if (mc.player == null) return;
        float scale = getScale();
        float posX = potionHUD.getX(), posY = potionHUD.getY();
        float headerH = 15f * scale, itemH = 9f * scale;

        Collection<EffectInstance> current = mc.player.getActivePotionEffects();
        for (EffectInstance eff : current) {
            int id = System.identityHashCode(eff);
            lastKnownEffects.put(id, eff);
            potionAnimations.computeIfAbsent(id, k -> new EaseBackIn(300, 1, 1.5f))
                    .setDirection(Direction.FORWARDS);
        }
        potionAnimations.forEach((id, anim) -> {
            if (current.stream().noneMatch(e -> System.identityHashCode(e) == id))
                anim.setDirection(Direction.BACKWARDS);
        });

        List<Integer> toRender = new ArrayList<>();
        float maxW = 0;
        StyledFont effFont = font(13), durFont = font(12);

        for (Map.Entry<Integer, Animation> e : potionAnimations.entrySet()) {
            int id = e.getKey();
            if (!e.getValue().isDone() || e.getValue().getDirection() == Direction.FORWARDS) {
                EffectInstance inst = lastKnownEffects.get(id);
                if (inst != null) {
                    toRender.add(id);
                    float w = effFont.getWidth(I18n.format(inst.getEffectName()))
                            + durFont.getWidth(EffectUtils.getPotionDurationString(inst, 1f))
                            + 35f * scale;
                    if (w > maxW) maxW = w;
                }
            }
        }

        boolean isChatOpen = mc.currentScreen instanceof ChatScreen;
        potionAlphaAnim.setDirection((!toRender.isEmpty() || isChatOpen) ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) Math.max(0, Math.min(1, potionAlphaAnim.getOutput()));
        if (alpha <= 0f) { animatedPotionWidth = 75f * scale; return; }

        float targetW = Math.max(75f * scale, maxW);
        animatedPotionWidth += (targetW - animatedPotionWidth) * 0.15f;

        int elAlpha     = (int)(255 * alpha);
        int fonColor    = ColorUtils.setAlpha(getColorByName("fonColor"),    getBgOpacity(alpha));
        int infoColor   = ColorUtils.setAlpha(getColorByName("infoColor"),   elAlpha);
        int iconColor   = ColorUtils.setAlpha(getColorByName("iconColor"),   elAlpha);
        int textColor   = ColorUtils.setAlpha(getColorByName("textColor"),   elAlpha);
        int iconnoColor = ColorUtils.setAlpha(getColorByName("iconnoColor"), (int)(30 * alpha));

        float yOff = 0;
        for (int id : toRender)
            yOff += itemH * (float) Math.max(0, potionAnimations.get(id).getOutput());
        float winH = headerH + (toRender.isEmpty() ? (isChatOpen ? 3f * scale : 0f) : yOff + 4f * scale);

        RenderUtils.Render2D.drawBlurredRoundedRectangle(posX, posY, animatedPotionWidth, winH, 4f * scale, fonColor, alpha);

        int i2sz = icon2Sz(15);
        Fonts.icon2[i2sz].drawString(stack, "e", posX + 4f * scale, posY + 5.5f * scale, iconColor);
        font(14).drawString(stack, "Potions",
                posX + 4f * scale + Fonts.icon2[i2sz].getWidth("e") + 3f * scale,
                posY + 6f * scale, infoColor);

        float renderY = posY + headerH + 1f * scale;
        for (int id : toRender) {
            EffectInstance inst = lastKnownEffects.get(id);
            Animation anim = potionAnimations.get(id);
            float animP = (float) Math.max(0, anim.getOutput());
            if (animP > 0.001f) {
                float flash = (inst.getDuration() > 0 && inst.getDuration() <= 100)
                        ? 0.4f + (float)(Math.sin(System.currentTimeMillis() / 150.0) + 1.0) / 3.33f
                        : 1f;

                stack.push();
                float cy = renderY + itemH / 2f;
                stack.translate(posX + animatedPotionWidth / 2f, cy, 0);
                stack.scale(1f, animP, 1f);
                stack.translate(-(posX + animatedPotionWidth / 2f), -cy, 0);

                float slide = (1f - animP) * 10f * scale;
                int fAlpha = Math.max(0, Math.min(255, (int)(elAlpha * animP * flash)));
                Effect eff = inst.getPotion();
                String text = I18n.format(inst.getEffectName());
                String dur  = EffectUtils.getPotionDurationString(inst, 1f);
                String lvl  = inst.getAmplifier() != 0 ? " " + (inst.getAmplifier() + 1) : "";
                int effColor = !eff.isBeneficial()
                        ? new Color(182, 35, 35, fAlpha).getRGB()
                        : ColorUtils.setAlpha(textColor, (int)(220 * animP * flash));

                RenderSystem.depthMask(false);
                RenderSystem.enableBlend();
                RenderSystem.defaultBlendFunc();
                TextureAtlasSprite sprite = mc.getPotionSpriteUploader().getSprite(eff);
                mc.getTextureManager().bindTexture(sprite.getAtlasTexture().getTextureLocation());
                blitSprite(stack, posX + 4.5f * scale - slide, renderY + 1f * scale, 10,
                        (int)(7 * scale), (int)(7 * scale), sprite, fAlpha / 255f);
                RenderSystem.depthMask(true);

                effFont.drawString(stack, text, posX + 13f * scale - slide, renderY + 3f * scale, effColor);
                if (inst.getAmplifier() != 0)
                    durFont.drawString(stack, lvl,
                            posX + 13f * scale + effFont.getWidth(text) - slide,
                            renderY + 3f * scale,
                            ColorUtils.setAlpha(textColor, (int)(200 * animP * flash)));

                float tw = durFont.getWidth(dur);
                float tx = posX + animatedPotionWidth - tw - 6f * scale + slide;
                RenderUtils.Render2D.drawRoundedRect(tx - 2f * scale, renderY + 0.5f * scale,
                        tw + 4f * scale, 8f * scale, 1.5f * scale,
                        ColorUtils.setAlpha(iconnoColor, (int)(fAlpha * 0.4f)));
                durFont.drawString(stack, dur, tx, renderY + 3.5f * scale,
                        ColorUtils.setAlpha(textColor, (int)(180 * animP * flash)));

                stack.pop();
                renderY += itemH * animP;
            }
        }

        potionAnimations.entrySet().removeIf(e -> {
            if (e.getValue().isDone() && e.getValue().getDirection() == Direction.BACKWARDS) {
                lastKnownEffects.remove(e.getKey());
                return true;
            }
            return false;
        });

        potionHUD.setWidth(animatedPotionWidth);
        potionHUD.setHeight(winH);
    }

    private void renderTarget(MatrixStack stack) {
        if (mc.player == null || Manager.FUNCTION_MANAGER == null) return;
        float scale = getScale();
        target = resolveTarget(target);
        if (target == null) return;

        thudAlpha.setDirection(allow ? Direction.FORWARDS : Direction.BACKWARDS);
        float alpha = (float) thudAlpha.getOutput();

        if (target.hurtTime > 0 && !particlesSpawnedThisHit) {
            spawnParticles(); particlesSpawnedThisHit = true;
        } else if (target.hurtTime == 0) {
            particlesSpawnedThisHit = false;
        }

        if (alpha <= 0f) { target = null; return; }

        float x = targetHUD.getX(), y = targetHUD.getY();
        float w = 90f * scale;

        int firstColor = getColorByName("primaryColor");
        int textColor  = getColorByName("textColor");
        int iconColor  = getColorByName("iconColor");
        int goldColor  = getColorByName("goldColor");
        int elAlpha    = (int)(255 * alpha);
        int fonColor   = ColorUtils.setAlpha(getColorByName("fonColor"), getBgOpacity(alpha));

        float faceSize = 24f * scale;
        float itemRowH = 10f * scale;
        float infoH    = faceSize;
        float h        = itemRowH + infoH + 6f * scale;
     
        RenderUtils.Render2D.drawBlurredRoundedRectangle(x, y + itemRowH, w, infoH + 6f * scale,
                4f * scale, fonColor, alpha);
     
     
        renderItemRow(stack, target, x, y, w, scale, elAlpha);

        float contentY = y + itemRowH;
        float faceX    = x + 3f * scale;
        float faceY    = contentY + 3f * scale;

        if (target instanceof AbstractClientPlayerEntity acp) {
            RenderUtils.Render2D.drawRoundFace(faceX, faceY, (int) faceSize, (int) faceSize,
                    3f * scale, alpha, acp);
            if (target.hurtTime > 0)
                RenderUtils.Render2D.drawRoundedRect(
                        faceX - 0.3f * scale, faceY - 0.3f * scale,
                        faceSize + 0.6f * scale, faceSize + 0.6f * scale, 2.5f * scale,
                        new Color(255, 0, 0, (int)(target.hurtTime / 10f * alpha * 100)).getRGB());
        } else {
            StencilUtils.initStencilToWrite();
            RenderUtils.Render2D.drawRoundedRect(faceX, faceY, faceSize, faceSize, 3f * scale,
                    ColorUtils.rgba(21, 21, 21, (int)(190 * alpha)));
            StencilUtils.readStencilBuffer(1);
            int fSz = iconSz(50);
            float iw = Fonts.icon[fSz].getWidth(">");
            Fonts.icon[fSz].drawString(stack, ">",
                    faceX + (faceSize - iw) / 2f, faceY + 2.5f * scale,
                    ColorUtils.setAlpha(iconColor, elAlpha));
            StencilUtils.uninitStencilBuffer();
        }

        float textX = x + faceSize + 6f * scale;
        float textY = contentY + 4f * scale;

        font(13).drawScissorString(stack, target.getName().getString(), textX, textY,
                ColorUtils.setAlpha(textColor, elAlpha), (int)(w - faceSize - 9f * scale));

        health      = MathHelper.clamp(AnimationMath.fast(health,      target.getHealth() / target.getMaxHealth(),           12),   0, 1);
        health2     = MathHelper.clamp(AnimationMath.fast(health2,     target.getHealth() / target.getMaxHealth(),           4.5f), 0, 1);
        healthplus  = MathHelper.clamp(AnimationMath.fast(healthplus,  target.getAbsorptionAmount() / target.getMaxHealth(), 12),   0, 1);
        healthplus2 = MathHelper.clamp(AnimationMath.fast(healthplus2, target.getAbsorptionAmount() / target.getMaxHealth(), 4.5f), 0, 1);

        Color bc = new Color(firstColor);
        float[] hsb = Color.RGBtoHSB(bc.getRed(), bc.getGreen(), bc.getBlue(), null);
        int darker   = Color.getHSBColor(hsb[0], hsb[1], Math.max(0f, hsb[2] - 0.4f)).getRGB();
        Color gC     = new Color(goldColor);
        int darkGold = new Color((int)(gC.getRed()*0.6f),(int)(gC.getGreen()*0.6f),(int)(gC.getBlue()*0.6f)).getRGB();

        String hpStr = (int)(health * target.getMaxHealth()) + " HP";
        Color tc2 = new Color(textColor);
        float[] hsbt = Color.RGBtoHSB(tc2.getRed(), tc2.getGreen(), tc2.getBlue(), null);
        int dimText = ColorUtils.setAlpha(
                Color.getHSBColor(hsbt[0], hsbt[1], Math.max(0f, hsbt[2] - 0.15f)).getRGB(), elAlpha);
        font(11).drawString(stack, hpStr, textX, textY + 9f * scale, dimText);

        float barX = textX;
        float barY = contentY + infoH - 5f * scale;
        float barW = w - faceSize - 9f * scale;
        float barH = 4f * scale;
     
        RenderUtils.Render2D.drawRoundedRect(barX, barY, barW, barH, 2f * scale,
                ColorUtils.setAlpha(firstColor, (int)(55 * alpha)));
     
        if (health >= healthplus) {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health2,  barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(firstColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darker,     (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health,   barH, 2f * scale,
                    ColorUtils.setAlpha(firstColor, elAlpha),
                    ColorUtils.setAlpha(darker,     elAlpha));
        } else {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * healthplus2, barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(goldColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darkGold,  (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * healthplus,  barH, 2f * scale,
                    ColorUtils.setAlpha(goldColor, elAlpha),
                    ColorUtils.setAlpha(darkGold,  elAlpha));
        }
        if (health < healthplus && healthplus > 0) {
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health2,  barH * 0.9f, 2f * scale,
                    ColorUtils.setAlpha(firstColor, (int)(90 * alpha)),
                    ColorUtils.setAlpha(darker,     (int)(90 * alpha)));
            RenderUtils.Render2D.drawRoundedRect(barX, barY, barW * health,   barH, 2f * scale,
                    ColorUtils.setAlpha(firstColor, elAlpha),
                    ColorUtils.setAlpha(darker,     elAlpha));
        }

        particles.removeIf(p -> System.currentTimeMillis() - p.time > 2000L);
        for (LocalParticle p : particles) {
            p.update();
            float life = 1f - (float)(System.currentTimeMillis() - p.time) / 2000f;
            float ps   = life * 3f * scale;
            if (ps > 0)
                RenderUtils.Render2D.drawRoundedCorner((float) p.pos.x, (float) p.pos.y,
                        ps, ps, ps / 2f,
                        ColorUtils.setAlpha(firstColor, (int)(255f * p.alpha * life)));
        }

        targetHUD.setWidth(w);
        targetHUD.setHeight(h);
    }

    private void renderItemRow(MatrixStack stack, LivingEntity entity,
                               float x, float y, float w, float scale, int elAlpha) {
        float itemSz = 9f * scale;
        float rowH   = 10f * scale;
        float itemY  = y + (rowH - itemSz) / 2f;

        List<ItemStack> all = new ArrayList<>();

        ItemStack offHand = entity.getHeldItemOffhand();
        if (!offHand.isEmpty()) all.add(offHand);

        List<ItemStack> armor = new ArrayList<>();
        for (ItemStack s : entity.getArmorInventoryList()) armor.add(s);
        all.addAll(armor);

        ItemStack mainHand = entity.getHeldItemMainhand();
        if (!mainHand.isEmpty()) all.add(mainHand);

        int count = (int) all.stream().filter(s -> !s.isEmpty()).count();
        if (count == 0) return;

        float totalItemW = count * itemSz + (count - 1) * scale;
        float startX     = x + (w - totalItemW) / 2f;
        float sc         = itemSz / 16f;

        com.mojang.blaze3d.platform.GlStateManager.pushMatrix();
        com.mojang.blaze3d.platform.GlStateManager.scaled(sc, sc, 1.0);

        float cx = startX;
        for (ItemStack s : all) {
            if (s.isEmpty()) continue;
            Hud.drawItemStack(s, cx / sc, itemY / sc, "", false);
            cx += itemSz + scale;
        }

        com.mojang.blaze3d.platform.GlStateManager.popMatrix();
    }

    private LivingEntity resolveTarget(LivingEntity prev) {
        if (Manager.FUNCTION_MANAGER == null) return null;
        LivingEntity t = prev;
        Object auraTarget = Manager.FUNCTION_MANAGER.auraFunction.getTarget();
        if (auraTarget instanceof LivingEntity le) {
            t = le; targetTimer.reset(); allow = true;
        } else if (mc.currentScreen instanceof ChatScreen) {
            t = mc.player; targetTimer.reset(); allow = true;
        } else if (allow && targetTimer.isReached(200)) {
            allow = false;
        }
        return t;
    }

    private void spawnParticles() {
        float hx = targetHUD.getX() + 12f * getScale();
        float hy = targetHUD.getY() + 20f * getScale();
        for (int i = 0; i < 8; i++)
            particles.add(new LocalParticle(new Vector3d(hx, hy, 0)));
    }

    private void blitSprite(MatrixStack ms, float x, float y, int blitOffset,
                            int width, int height, TextureAtlasSprite sprite, float alpha) {
        Matrix4f matrix = ms.getLast().getMatrix();
        BufferBuilder bb = Tessellator.getInstance().getBuffer();
        int a = (int)(alpha * 255);
        bb.begin(7, DefaultVertexFormats.POSITION_COLOR_TEX);
        bb.pos(matrix, x,         y + height, blitOffset).color(255,255,255,a).tex(sprite.getMinU(), sprite.getMaxV()).endVertex();
        bb.pos(matrix, x + width, y + height, blitOffset).color(255,255,255,a).tex(sprite.getMaxU(), sprite.getMaxV()).endVertex();
        bb.pos(matrix, x + width, y,          blitOffset).color(255,255,255,a).tex(sprite.getMaxU(), sprite.getMinV()).endVertex();
        bb.pos(matrix, x,         y,          blitOffset).color(255,255,255,a).tex(sprite.getMinU(), sprite.getMinV()).endVertex();
        bb.finishDrawing();
        RenderSystem.enableBlend();
        RenderSystem.defaultBlendFunc();
        WorldVertexBufferUploader.draw(bb);
    }
}
/del некрасивый худ так ещё и плохо скиднул
 
Назад
Сверху Снизу