Исходник Слив топового Hud expensive 2.0

Начинающий
Статус
Оффлайн
Регистрация
22 Сен 2023
Сообщения
43
Реакции[?]
0
Поинты[?]
0
Доделанный худ из HudFunction в expensive 2.0
1722413184836.png

Код:
package Anova.modules.impl.render;

import Anova.modules.settings.imp.ModeSetting;
import Anova.ui.midnight.StyleManager;
import Anova.util.misc.TimerUtil;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import lombok.Getter;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.network.play.NetworkPlayerInfo;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.AirItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Team;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.GameType;
import org.joml.Vector2i;
import org.joml.Vector4i;
import org.lwjgl.opengl.GL11;
import Anova.Initilization;
import Anova.events.Event;
import Anova.events.impl.player.EventUpdate;
import Anova.events.impl.render.EventRender;
import Anova.managment.Managment;
import Anova.modules.Function;
import Anova.modules.FunctionModule;
import Anova.modules.Category;
import Anova.modules.settings.imp.BooleanOption;
import Anova.modules.settings.imp.MultiBoxSetting;
import Anova.modules.settings.imp.SliderSetting;
import Anova.util.ClientUtil;
import Anova.util.animations.Animation;
import Anova.util.animations.Direction;
import Anova.util.animations.impl.EaseBackIn;
import Anova.util.drag.Dragging;
import Anova.util.font.Fonts;
import Anova.util.font.styled.StyledFont;
import Anova.util.math.MathUtil;
import Anova.util.misc.HudUtil;
import Anova.util.render.BloomHelper;
import Anova.util.render.ColorUtil;
import Anova.util.render.RenderUtil;
import Anova.util.render.animation.AnimationMath;
import Anova.util.render.RenderUtil.SmartScissor;

import java.awt.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;
import java.text.SimpleDateFormat;
import java.util.Date;

import static Anova.modules.impl.render.HudFunction.Status.*;
import static Anova.modules.impl.render.HudFunction.Status.VANISHED;
import static Anova.ui.alt.AltManager.white;
import static Anova.ui.clickgui.Window.dark;
import static Anova.util.render.ColorUtil.rgba;
import static Anova.util.render.RenderUtil.Render2D.*;

/**
 * @author Swoe228
 * @since 23.07.2024
 */

@FunctionModule(name = "HUD", type = Category.Render)
    public class HUD2 extends Function {
    int firstColor;
    int secondColor;
    public final MultiBoxSetting elements = new MultiBoxSetting("Элементы",
            new BooleanOption("Ватермарка", true),
            new BooleanOption("Активные функции", true),
            new BooleanOption("Активный таргет", true),
            new BooleanOption("Активные стаффы", true),
            new BooleanOption("Активные бинды", true),
            new BooleanOption("Активные эффекты", true),
            new BooleanOption("Таймер", true),
            new BooleanOption("Броня",true)
    );
    public static final BooleanOption Renderutils = new BooleanOption("Невьебический рендер",false);


    List<Function> sortedFunctions = new ArrayList<>();
    TimerUtil delay = new TimerUtil();

    public HUD2() {
        addsetting(elements,Renderutils);
    }
    final float round_degree = 3;

    final float cWidth = 4;

    final Vector4f left_vec = new Vector4f(round_degree, round_degree, 0, 0);
    final Vector4f right_vec = new Vector4f(0, 0, round_degree, round_degree);

    final int b_color = new Color(0, 0, 0, 128).getRGB();
    final int t_color = Color.WHITE.getRGB();

    int[] colors = new int[360];

    final StyledFont icons = Fonts.icons1[20];
    final StyledFont medium = Fonts.msMedium[16];
    final StyledFont small = Fonts.msMedium[14];

    MainWindow window;

    List<Function> functions = new ArrayList<>();
    public Dragging potionStatus = Initilization.createDrag(this, "PotionStatus", 200, 50);
    final Dragging keyBinds = Initilization.createDrag(this, "KeyBinds-new", 10, 100);
    final Dragging staffList = Initilization.createDrag(this, "StaffList-new", 10, 200);

    private final Animation targetHudAnimation = new EaseBackIn(200, 1, 1.5f);
    final Dragging timerHUD = Initilization.createDrag(this, "TimerHUD-new", 10, 400);

    Animation tHudAnimation = new EaseBackIn(400, 1, 1.5f);
    PlayerEntity target = null;


    private final Pattern namePattern = Pattern.compile("^\\w{3,16}$");
    private final Pattern prefixMatches = Pattern.compile(".*(mod|der|stager|adm|help|wne|мод|хелп|помо|адм|владе|отри|таф|taf|curat|курато|dev|раз|supp|сапп|yt|ютуб).*");



    @Override
    public void onEventModule(Event event) {
        if (mc.player == null || mc.world == null) return;

        if (event instanceof EventUpdate) {
            staffPlayers.clear();

            for (ScorePlayerTeam team : mc.world.getScoreboard().getTeams().stream().sorted(Comparator.comparing(Team::getName)).toList()) {
                String name = team.getMembershipCollection().toString();
                name = name.substring(1, name.length() - 1);
                if (namePattern.matcher(name).matches()) {
                    if (prefixMatches.matcher(team.getPrefix().getString().toLowerCase(Locale.ROOT)).matches() || Managment.STAFF_MANAGER.isStaff(name)) {
                    }
                }
            }

            if (Managment.FUNCTION_MANAGER.getFunctions().isEmpty() || !functions.isEmpty()) return;
            updateFunctions();
        }

        if (event instanceof EventRender e && e.isRender2D()) {
            for (int i = 0; i < colors.length; i++) {
                colors[i] = Managment.STYLE_MANAGER.getCurrentStyle().getColor(i);
            }

            window = e.scaledResolution;

            final MatrixStack matrixStack = e.matrixStack;

            if (elements.get(0)) renderWatermark(matrixStack);
            if (elements.get(1)) renderArrayList(matrixStack);
            if (elements.get(2)) onRenderTargetHUD(matrixStack);
            if (elements.get(3)) onStaffListRender(matrixStack, e);
            if (elements.get(4)) onKeyBindsRender(matrixStack);
            if (elements.get(5)) renderPotions(matrixStack,e);
            if (elements.get(6))renderTimer(matrixStack);
            if (elements.get(7)) RenderArmor(e);
        }
    }

    private void renderWatermark(MatrixStack matrixStack) {
        final Vector4i colorVec = new Vector4i(
                ColorUtil.getColorStyle(0),
                ColorUtil.getColorStyle(90),
                ColorUtil.getColorStyle(180),
                ColorUtil.getColorStyle(270)
        );
        int roundDegree = 4;
        int headerHeight = 14;
        //Время
        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
        String time = now.format(formatter);
        final String title = " | " + " " + time + " " + " | " +  " " +  mc.debugFPS + " " + " | " + " " + HudUtil.calculatePing();

        final String gradientText = "anova gamma ";
        // Координаты ватермарки
        final float x = 1;
        final float y = 1;
        final float titleWidth = Fonts.gilroyBold[15].getWidth(gradientText + title) + 45;
        final float titleHeight = 18;

        drawShadow(x, y, titleWidth, titleHeight, 5, colorVec.x, colorVec.y, colorVec.w, colorVec.z);
        drawGradientRound(x, y, titleWidth, titleHeight + headerHeight + 2.5f, roundDegree, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));
        drawRoundedRect(x, y, titleWidth, titleHeight, 3, rgba(20, 20, 20, 255));

        Fonts.gilroyBold[18].drawString(matrixStack, gradientText, x + 3, y + Fonts.gilroyBold[18].getFontHeight() / 2f + 0.3f, ColorUtil.getColorStyle(255));
        Fonts.gilroyBold[18].drawString(matrixStack, title, x + Fonts.gilroyBold[18].getWidth(gradientText) + 3.5f, y + Fonts.gilroyBold[18].getFontHeight() / 2f + 0.3f, ColorUtil.getColorStyle(255));
    }
    private void RenderArmor(final EventRender renderEvent) {
        int count = 0;
        for (int i = 0; i < mc.player.inventory.getSizeInventory(); i++) {
            ItemStack s = mc.player.inventory.getStackInSlot(i);
            if (s.getItem() == Items.TOTEM_OF_UNDYING) {
                count++;
            }
        }
        float xPos = renderEvent.scaledResolution.scaledWidth() / 2f;
        float yPos = renderEvent.scaledResolution.scaledHeight();

        boolean totemInInv = mc.player.inventory.mainInventory.stream().map(ItemStack::getItem).toList().contains(Items.TOTEM_OF_UNDYING);
        int off = totemInInv ? +5 : 0;
        if (mc.player.isCreative()) {
            yPos += 17;
        }

        for (ItemStack s : mc.player.inventory.armorInventory) {
            ESPFunction.drawItemStack(s, xPos - off + 74 * (mc.gameSettings.guiScale / 2f), yPos - 56 * (mc.gameSettings.guiScale / 2f), null, false);
            off += 15;
        }
        if (totemInInv)
            ESPFunction.drawItemStack(new ItemStack(Items.TOTEM_OF_UNDYING), xPos - off + 73 * (mc.gameSettings.guiScale / 2f), yPos - 56 * (mc.gameSettings.guiScale / 2f), String.valueOf(count), false);


    }
    int fontSize = 18;




    private void renderArrayList(MatrixStack stack) {
        float x = 1;
        float y = 25;
        float height = 10;
        float yOffset = 0;

        final StyledFont font = Fonts.gilroyBold[fontSize];
        StyleManager styleManager = Managment.STYLE_MANAGER;

        if (delay.hasTimeElapsed(10000)) {
            sortedFunctions = HudUtil.getSorted(font);
            delay.reset();
        }

        float gradientForce = 1;
        int fontOffset = (fontSize > 14 ? -14 + fontSize
                - (fontSize > 14 ? 1 : 0) : 0);
        int firstColor;
        int secondColor;

        for (Function function : sortedFunctions) {
            function.animation = AnimationMath.lerp(function.animation, function.state ? 1 : 0, 15);
            if (function.animation >= 0.01) {
                float width = font.getWidth(function.name) + 5;
                firstColor = styleManager.getCurrentStyle()
                        .getColor((int) ((yOffset + height * function.animation) * gradientForce));
                secondColor = styleManager.getCurrentStyle()
                        .getColor((int) (yOffset * gradientForce));
                RenderSystem.pushMatrix();
                RenderSystem.translatef(x + width / 2F, y + yOffset, 0);
                RenderSystem.scalef(1, function.animation, 1);
                RenderSystem.translatef(-(x + width / 2F), -(y + yOffset), 0);
                drawShadow(x, y + yOffset, width, height, 10, firstColor, secondColor);
                RenderSystem.popMatrix();
                yOffset += height * function.animation;
            }
        }
        yOffset = 0;
        for (Function function : sortedFunctions) {
            function.animation = AnimationMath.lerp(function.animation, function.state ? 1 : 0, 15);

            if (function.animation >= 0.01) {
                float width = font.getWidth(function.name) + 5;
                secondColor = styleManager.getCurrentStyle()
                        .getColor((int) (yOffset * gradientForce));

                RenderSystem.pushMatrix();
                RenderSystem.translatef(x + width / 2F, y + yOffset, 0);
                RenderSystem.scalef(1, function.animation, 1);
                RenderSystem.translatef(-(x + width / 2F), -(y + yOffset), 0);
                RenderUtil.Render2D.drawRect(x, y + yOffset, width, height, rgba(21, 21, 21, 200));
                font.drawString(stack, function.name, x + 3,
                        y + yOffset + font.getFontHeight() / 2f - fontOffset - 1, secondColor);
                RenderSystem.popMatrix();

                yOffset += height * function.animation;
            }
        }
        yOffset = 0;
        for (Function function : sortedFunctions) {
            function.animation = AnimationMath.lerp(function.animation, function.state ? 1 : 0, 15);
            if (function.animation >= 0.01) {
                float width = font.getWidth(function.name) + 4;
                firstColor = styleManager.getCurrentStyle()
                        .getColor((int) ((yOffset + height * function.animation) * gradientForce));
                secondColor = styleManager.getCurrentStyle()
                        .getColor((int) (yOffset * gradientForce));

                RenderSystem.pushMatrix();
                RenderSystem.translatef(x + width / 2F, y + yOffset, 0);
                RenderSystem.scalef(1, function.animation, 1);
                RenderSystem.translatef(-(x + width / 2F), -(y + yOffset), 0);
                RenderUtil.Render2D.drawShadow(x, y + yOffset, 1, height, 8, firstColor, secondColor);
                RenderUtil.Render2D.drawVertical(x, y + yOffset, 1, height, firstColor, secondColor);
                RenderSystem.popMatrix();

                yOffset += height * function.animation;
            }
        }
    }


    private float hDynamic = 0;
    private int activePotions = 0;
    private void renderPotions(final MatrixStack matrixStack, final EventRender renderEvent) {
        float posX = potionStatus.getX();
        float posY = potionStatus.getY();

        int roundDegree = 4;
        int headerHeight = 14;
        int width = 100;
        int padding = 5;
        int offset = 10;

        int headerColor = new Color(30, 30, 30, 200).getRGB();
        int backgroundColor = new Color(40, 40, 40, 230).getRGB();

        int firstColor = ColorUtil.getColorStyle(0);
        int secondColor = ColorUtil.getColorStyle(90);

        float height = activePotions * offset;

        this.hDynamic = AnimationMath.fast(this.hDynamic, height, 15);

        RenderUtil.Render2D.drawShadow(posX, posY, width, headerHeight + hDynamic + padding / 2f, 10, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawGradientRound(posX, posY, width, hDynamic + headerHeight + 2.5f, roundDegree, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawRoundedCorner(potionStatus.getX(), posY, width, headerHeight, new Vector4f(roundDegree, 0, roundDegree, 0), headerColor);
        Fonts.gilroyBold[18].drawCenteredString(matrixStack, ClientUtil.gradient("active potions", firstColor, secondColor), potionStatus.getX() + width / 2f, posY + 5.5f, firstColor);

        RenderUtil.Render2D.drawRoundedCorner(posX, posY + headerHeight, width, hDynamic + padding / 2f, new Vector4f(0, roundDegree, 0, roundDegree), backgroundColor);
        RenderUtil.SmartScissor.push();
        RenderUtil.SmartScissor.setFromComponentCoordinates(posX, posY, width, headerHeight + hDynamic + padding / 2f);
        int index = 0;

        for (EffectInstance p : mc.player.getActivePotionEffects()) {
            if (p.isShowIcon()) {

                String durationText = EffectUtils.getPotionDurationString(p, 1);
                float durationWidth = Fonts.gilroyBold[12].getWidth(durationText);

                Fonts.gilroyBold[18].drawString(matrixStack, I18n.format(p.getEffectName()), posX + padding - 2, posY + headerHeight + padding + (index * offset), ColorUtil.getColorStyle(255));
                Fonts.gilroyBold[18].drawString(matrixStack, durationText, posX + width - durationWidth - padding - 2, posY + headerHeight + padding + (index * offset), ColorUtil.getColorStyle(255));

                index++;
            }
        }
        RenderUtil.SmartScissor.unset();
        RenderUtil.SmartScissor.pop();
        activePotions = index;

        potionStatus.setWidth(width);
        potionStatus.setHeight(activePotions * offset + headerHeight);
    }
    private float heightDynamic = 0;
    float kbHeight = 0;
    float kbWidth = 100;
    float yOffset = 5;
    float height = 5;
    float kbHeightAnimation = 0;
    int fontOffset = (fontSize > 18 ? -18 + fontSize - (fontSize > 18 ? 1 : 0) : 0);
    float kbWidthAnimation = 0;

    private int activeModules = 0;

    private void onKeyBindsRender(MatrixStack stack) {
        float posX = keyBinds.getX();
        float posY = keyBinds.getY();

        int roundDegree = 4;//Нужная залупа
        int headerHeight = 14;//Нужная залупа
        int width = 100;//Нужная залупа
        int padding = 5;//Нужная залупа
        int offset = 10;//Нужная залупа

        int headerColor = new Color(30, 30, 30, 200).getRGB();//Цвета
        int backgroundColor = new Color(40, 40, 40, 230).getRGB();//Цвета

        int firstColor = ColorUtil.getColorStyle(0);//Цвета
        int secondColor = ColorUtil.getColorStyle(90);//Цвета

        float height = activeModules * offset;

        this.heightDynamic = AnimationMath.fast(this.heightDynamic, height, 10);

        RenderUtil.Render2D.drawShadow(posX, posY, width, headerHeight + heightDynamic + padding / 2f, 10, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawGradientRound(posX, posY, width, heightDynamic + headerHeight + 2.5f, roundDegree - 1, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawRoundedCorner(keyBinds.getX(), posY, width, headerHeight, new Vector4f(roundDegree, 0, roundDegree, 0), headerColor);
        Fonts.gilroyBold[18].drawCenteredString(stack, ClientUtil.gradient("key bind", firstColor, secondColor), keyBinds.getX() + width / 2f, posY + 5.5f, firstColor);//Текст

        RenderUtil.Render2D.drawRoundedCorner(posX, posY + headerHeight, width, heightDynamic + padding / 2f, new Vector4f(0, roundDegree, 0, roundDegree), backgroundColor);
        RenderUtil.SmartScissor.push();
        RenderUtil.SmartScissor.setFromComponentCoordinates(posX, posY, width, headerHeight + heightDynamic + padding / 2f);
        int index = 0;

        for (Function f : Managment.FUNCTION_MANAGER.getFunctions()) {
            if (f.bind != 0 && f.state) {

                String text = ClientUtil.getKey(f.bind);

                if (text == null) {
                    continue;
                }


                String bindText = "[" + text.toUpperCase() + "]";
                float bindWidth = Fonts.gilroyBold[12].getWidth(bindText);

                Fonts.gilroyBold[18].drawString(stack, f.name, posX + padding -1, posY + headerHeight + padding + (index * offset)- 1, ColorUtil.getColorStyle(255));
                Fonts.gilroyBold[18].drawString(stack, bindText, posX + width - bindWidth - padding - 1, posY + headerHeight + padding + (index * offset) - 1, ColorUtil.getColorStyle(255));

                index++;
            }
        }
        RenderUtil.SmartScissor.unset();
        RenderUtil.SmartScissor.pop();
        activeModules = index;

        keyBinds.setWidth(width);
        keyBinds.setHeight(activeModules * offset + headerHeight);
    }





    private int activeStaff = 0;
    private float hDynam = 0;
    private float widthDynamic = 0;
    private float nameWidth = 0;
    List<HUD2.StaffPlayer> staffPlayers = new ArrayList<>();
    private void onStaffListRender(MatrixStack matrixStack, EventRender render) {
        float posX = staffList.getX();
        float posY = staffList.getY();

        int roundDegree = 4;
        int headerHeight = 14;
        float width = Math.max(nameWidth + 40, 100);
        int padding = 5;
        int offset = 10;

        int headerColor = new Color(30, 30, 30, 200).getRGB();
        int backgroundColor = new Color(35, 35, 35, 230).getRGB();

        int firstColor = ColorUtil.getColorStyle(0);
        int secondColor = ColorUtil.getColorStyle(90);
        float height = activeStaff * offset;

        this.hDynam = AnimationMath.fast(this.hDynam, height, 10);
        this.widthDynamic = AnimationMath.fast(this.widthDynamic, width, 10);
        RenderUtil.Render2D.drawShadow(posX, posY, widthDynamic, headerHeight + hDynam + padding / 2f, 10, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawGradientRound(posX, posY, widthDynamic, hDynam + headerHeight + 2.5f, roundDegree - 1, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawRoundedCorner(posX, posY, widthDynamic, headerHeight, new Vector4f(roundDegree, 0, roundDegree, 0), headerColor);
        Fonts.gilroyBold[18].drawCenteredString(matrixStack, ClientUtil.gradient("staff list", firstColor, secondColor), posX + widthDynamic / 2f, posY + 5.5f, ColorUtil.getColorStyle(255));

        RenderUtil.Render2D.drawRoundedCorner(posX, posY + headerHeight, widthDynamic, hDynam + padding / 2f, new Vector4f(0, roundDegree, 0, roundDegree), backgroundColor);

        int index = 0;

        SmartScissor.push();
        SmartScissor.setFromComponentCoordinates(posX, posY, widthDynamic, headerHeight + hDynam + padding / 2f);
        if (!staffPlayers.isEmpty()) {
            for (HUD2.StaffPlayer staff : staffPlayers) {
                String name = staff.getName();
                ITextComponent prefix = staff.getPrefix();
                String status = staff.getStatus().getString();

                Fonts.gilroyBold[12].drawString(matrixStack, prefix, posX + padding, posY + headerHeight + padding + (index * offset), -1);
                Fonts.gilroyBold[12].drawString(matrixStack, name + status, posX + padding + Fonts.gilroyBold[12].getWidth(prefix.getString()), posY + headerHeight + padding + (index * offset), -1);
                nameWidth = Fonts.gilroyBold[12].getWidth(prefix.getString() + name + status);
                index++;
            }
        } else {
            nameWidth = 0;
        }
        SmartScissor.unset();
        SmartScissor.pop();

        activeStaff = index;
        staffList.setWidth(widthDynamic);
        staffList.setHeight(hDynam + headerHeight);
    }
    private class StaffPlayer {

        @Getter
        String name;
        @Getter
        ITextComponent prefix;
        @Getter
        HudFunction.Status status;

        private StaffPlayer(String name, ITextComponent prefix) {
            this.name = name;
            this.prefix = prefix;

            updateStatus();
        }

        private void updateStatus() {
            for (AbstractClientPlayerEntity player : mc.world.getPlayers()) {
                if (player.getNameClear().equals(name)) {
                    status = NEAR;
                    return;
                }
            }

            for (NetworkPlayerInfo info : mc.getConnection().getPlayerInfoMap()) {
                if (info.getGameProfile().getName().equals(name)) {
                    if (info.getGameType() == GameType.SPECTATOR) {
                        status = SPEC;
                        return;
                    }

                    status = NONE;
                    return;
                }
            }

            status = VANISHED;
        }
    }
    public final Dragging targetHUD = Initilization.createDrag(this, "TargetHUD", 500, 50);
    private float health = 0;
    private double scale = 0.0D;

    private void onRenderTargetHUD(final MatrixStack stack) {
        this.target = getTarget(this.target);
        this.targetHudAnimation.setDuration(300);
        this.scale = targetHudAnimation.getOutput();
        if (scale == 0.0F) {
            target = null;
        }
        if (target == null) {
            return;
        }
        final String targetName = this.target.getName().getString();

        String substring = targetName.substring(0, Math.min(targetName.length(), 10));//Нужная залупа
        final float nameWidth = Fonts.gilroyBold[18].getWidth(substring);//Нужная залупа
        final float xPosition = this.targetHUD.getX();//Нужная залупа
        final float yPosition = this.targetHUD.getY();//Нужная залупа
        final float maxWidth = Math.max(nameWidth + 50, 120);//Нужная залупа
        final float maxHeight = 30;//Нужная залупа

        this.health = AnimationMath.fast(health, target.getHealth() / target.getMaxHealth(), 5);//Типо должна быть анимация
        this.health = MathHelper.clamp(this.health, 0, 1);//Типо должна быть анимация

        GlStateManager.pushMatrix();
        AnimationMath.sizeAnimation(xPosition + (maxWidth / 2), yPosition + (maxHeight / 2), scale);

        Vector2i colorVec = new Vector2i(ColorUtil.getColorStyle(0), ColorUtil.getColorStyle(90));

        RenderUtil.Render2D.drawShadow(xPosition, yPosition, maxWidth, maxHeight, 10, colorVec.x, colorVec.y, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawGradientRound(xPosition, yPosition, maxWidth, maxHeight, 3, colorVec.x, colorVec.y, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawRoundedRect(xPosition, yPosition, maxWidth, maxHeight, 2.5f, rgba(21, 21, 21, 200));
        drawFace(xPosition + 4, yPosition + 3.25f, 8F, 8F, 8F, 8F, 24, 24, 64F, 64F, (AbstractClientPlayerEntity) target);//Ебло чела
        drawCircle(
                xPosition + maxWidth - 15, // X-координата
                yPosition + maxHeight / 2, // Y-координата
                12.0f,                     // Радиус круга
                4.0f,                      // Ширина линии
                false,                     // Не заполненный круг
                ColorUtil.getColorStyle(255), // Цвет
                360                        // Количество сегментов
        );



        drawItemStack(xPosition + 32, yPosition + 22 - 5.5f, 10);

        Fonts.gilroyBold[18].drawString(stack, substring, xPosition + maxWidth - 90, yPosition + 6, -1);//Ник

        String healthValue = (int) MathUtil.round(this.health * 20 + target.getAbsorptionAmount(), 0.5f) + "";
        Fonts.gilroyBold[18].drawCenteredString(stack, healthValue, xPosition + maxWidth - 15, yPosition + maxHeight / 2 - 2.2f, ColorUtil.rgba(255, 255, 255, 255));//Hp
        GlStateManager.popMatrix();
        this.targetHUD.setWidth(maxWidth);
        this.targetHUD.setHeight(maxHeight);
    }




    private void drawItemStack(float x, float y, float offset) {
        List<ItemStack> stackList = new ArrayList<>(Arrays.asList(target.getHeldItemMainhand(), target.getHeldItemOffhand()));
        stackList.addAll((Collection<? extends ItemStack>) target.getArmorInventoryList());

        final AtomicReference<Float> posX = new AtomicReference<>(x);

        stackList.stream()
                .filter(stack -> !stack.isEmpty())
                .forEach(stack -> HudUtil.drawItemStack(stack,
                        posX.getAndAccumulate(offset, Float::sum),
                        y,
                        true,
                        true, 0.6f));
    }

    private float perc;

    private void renderTimer(MatrixStack matrixStack) {
        float posX = timerHUD.getX();
        float posY = timerHUD.getY();
        int firstColor = ColorUtil.getColorStyle(0);
        int secondColor = ColorUtil.getColorStyle(90);

        float quotient = Managment.FUNCTION_MANAGER.timerFunction.maxViolation / Managment.FUNCTION_MANAGER.timerFunction.timerAmount.getValue().floatValue();
        float minimumValue = Math.min(Managment.FUNCTION_MANAGER.timerFunction.getViolation(), quotient);
        perc = AnimationMath.lerp(perc, ((quotient - minimumValue) / quotient), 10);

        String text = (int) (perc * 100) + "%";
        float width = 80;
        int width2 = 70;
        timerHUD.setWidth(width);
        timerHUD.setHeight(20);
        RenderUtil.Render2D.drawShadow(posX, posY, width, 27, 10, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));
        RenderUtil.Render2D.drawGradientRound(posX - 0.25f, posY - 0.25f, width + 0.25f, 27 + 0.25f, 3, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));
        RenderUtil.Render2D.drawRoundedRect(posX, posY, width, 27,3, RenderUtil.reAlphaInt(ColorUtil.rgba(15, 15, 15, 255), 170));

        medium.drawString(matrixStack, "Timer", posX + 27.5, posY + 6, ColorUtil.getColorStyle(255));

        RenderUtil.Render2D.drawGradientRound(posX + 5f, posY + 24 - 8, width2 * perc, 7,1, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));
        medium.drawString(matrixStack, text, posX + width - medium.getWidth(text) - 3 - 27, posY + 17.5, t_color);
    }

    private PlayerEntity getTarget(PlayerEntity nullTarget) {
        PlayerEntity target = nullTarget;

        if (Managment.FUNCTION_MANAGER.auraFunction.getTarget() instanceof PlayerEntity) {
            target = (PlayerEntity) Managment.FUNCTION_MANAGER.auraFunction.getTarget();
            tHudAnimation.setDirection(Direction.FORWARDS);
        } else if (mc.currentScreen instanceof ChatScreen) {
            target = mc.player;
            tHudAnimation.setDirection(Direction.FORWARDS);
        } else {
            tHudAnimation.setDirection(Direction.BACKWARDS);
        }

        return target;
    }

    private void updateFunctions() {
        for (Function function : Managment.FUNCTION_MANAGER.getFunctions()) {
            if (function.category == Category.Render) continue;

            functions.add(function);
        }

        functions.sort((f1, f2) -> Float.compare(small.getWidth(f2.name), small.getWidth(f1.name)));
    }

    private int getColor(int index) {
        return colors[index % colors.length];
    }
}
 
Начинающий
Статус
Оффлайн
Регистрация
17 Май 2023
Сообщения
221
Реакции[?]
2
Поинты[?]
1K
Блять... Ватермарку настолько тяжело включить, далбоебы ебанные сука дельните это блять, нахуй меня рвет, но похуй я был таким же далбоебом, но самое первое что я сделал это БЛЯТЬ ВАТЕРМАРКУ СУКА ПОФИКСИЛ...
 
Начинающий
Статус
Оффлайн
Регистрация
22 Сен 2023
Сообщения
43
Реакции[?]
0
Поинты[?]
0
Ты который делал себе в софт, слил, думая, что всем зайдет😅 А зашло те по горло 🥺🔥
🥺🔥 🥺🔥 🥺🔥 🥺🔥 🥺🔥 🥺🔥 🥺🔥 🥺🔥 🥺🔥
Это говорит человек который не может перенести с экселеннта на экспу targetStrafe
 
Начинающий
Статус
Оффлайн
Регистрация
25 Фев 2024
Сообщения
328
Реакции[?]
0
Поинты[?]
0
Доделанный худ из HudFunction в expensive 2.0
Посмотреть вложение 282407

Код:
package Anova.modules.impl.render;

import Anova.modules.settings.imp.ModeSetting;
import Anova.ui.midnight.StyleManager;
import Anova.util.misc.TimerUtil;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import lombok.Getter;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.network.play.NetworkPlayerInfo;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.AirItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Team;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.GameType;
import org.joml.Vector2i;
import org.joml.Vector4i;
import org.lwjgl.opengl.GL11;
import Anova.Initilization;
import Anova.events.Event;
import Anova.events.impl.player.EventUpdate;
import Anova.events.impl.render.EventRender;
import Anova.managment.Managment;
import Anova.modules.Function;
import Anova.modules.FunctionModule;
import Anova.modules.Category;
import Anova.modules.settings.imp.BooleanOption;
import Anova.modules.settings.imp.MultiBoxSetting;
import Anova.modules.settings.imp.SliderSetting;
import Anova.util.ClientUtil;
import Anova.util.animations.Animation;
import Anova.util.animations.Direction;
import Anova.util.animations.impl.EaseBackIn;
import Anova.util.drag.Dragging;
import Anova.util.font.Fonts;
import Anova.util.font.styled.StyledFont;
import Anova.util.math.MathUtil;
import Anova.util.misc.HudUtil;
import Anova.util.render.BloomHelper;
import Anova.util.render.ColorUtil;
import Anova.util.render.RenderUtil;
import Anova.util.render.animation.AnimationMath;
import Anova.util.render.RenderUtil.SmartScissor;

import java.awt.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;
import java.text.SimpleDateFormat;
import java.util.Date;

import static Anova.modules.impl.render.HudFunction.Status.*;
import static Anova.modules.impl.render.HudFunction.Status.VANISHED;
import static Anova.ui.alt.AltManager.white;
import static Anova.ui.clickgui.Window.dark;
import static Anova.util.render.ColorUtil.rgba;
import static Anova.util.render.RenderUtil.Render2D.*;

/**
* @author Swoe228
* @since 23.07.2024
*/

@FunctionModule(name = "HUD", type = Category.Render)
    public class HUD2 extends Function {
    int firstColor;
    int secondColor;
    public final MultiBoxSetting elements = new MultiBoxSetting("Элементы",
            new BooleanOption("Ватермарка", true),
            new BooleanOption("Активные функции", true),
            new BooleanOption("Активный таргет", true),
            new BooleanOption("Активные стаффы", true),
            new BooleanOption("Активные бинды", true),
            new BooleanOption("Активные эффекты", true),
            new BooleanOption("Таймер", true),
            new BooleanOption("Броня",true)
    );
    public static final BooleanOption Renderutils = new BooleanOption("Невьебический рендер",false);


    List<Function> sortedFunctions = new ArrayList<>();
    TimerUtil delay = new TimerUtil();

    public HUD2() {
        addsetting(elements,Renderutils);
    }
    final float round_degree = 3;

    final float cWidth = 4;

    final Vector4f left_vec = new Vector4f(round_degree, round_degree, 0, 0);
    final Vector4f right_vec = new Vector4f(0, 0, round_degree, round_degree);

    final int b_color = new Color(0, 0, 0, 128).getRGB();
    final int t_color = Color.WHITE.getRGB();

    int[] colors = new int[360];

    final StyledFont icons = Fonts.icons1[20];
    final StyledFont medium = Fonts.msMedium[16];
    final StyledFont small = Fonts.msMedium[14];

    MainWindow window;

    List<Function> functions = new ArrayList<>();
    public Dragging potionStatus = Initilization.createDrag(this, "PotionStatus", 200, 50);
    final Dragging keyBinds = Initilization.createDrag(this, "KeyBinds-new", 10, 100);
    final Dragging staffList = Initilization.createDrag(this, "StaffList-new", 10, 200);

    private final Animation targetHudAnimation = new EaseBackIn(200, 1, 1.5f);
    final Dragging timerHUD = Initilization.createDrag(this, "TimerHUD-new", 10, 400);

    Animation tHudAnimation = new EaseBackIn(400, 1, 1.5f);
    PlayerEntity target = null;


    private final Pattern namePattern = Pattern.compile("^\\w{3,16}$");
    private final Pattern prefixMatches = Pattern.compile(".*(mod|der|stager|adm|help|wne|мод|хелп|помо|адм|владе|отри|таф|taf|curat|курато|dev|раз|supp|сапп|yt|ютуб).*");



    @Override
    public void onEventModule(Event event) {
        if (mc.player == null || mc.world == null) return;

        if (event instanceof EventUpdate) {
            staffPlayers.clear();

            for (ScorePlayerTeam team : mc.world.getScoreboard().getTeams().stream().sorted(Comparator.comparing(Team::getName)).toList()) {
                String name = team.getMembershipCollection().toString();
                name = name.substring(1, name.length() - 1);
                if (namePattern.matcher(name).matches()) {
                    if (prefixMatches.matcher(team.getPrefix().getString().toLowerCase(Locale.ROOT)).matches() || Managment.STAFF_MANAGER.isStaff(name)) {
                    }
                }
            }

            if (Managment.FUNCTION_MANAGER.getFunctions().isEmpty() || !functions.isEmpty()) return;
            updateFunctions();
        }

        if (event instanceof EventRender e && e.isRender2D()) {
            for (int i = 0; i < colors.length; i++) {
                colors[i] = Managment.STYLE_MANAGER.getCurrentStyle().getColor(i);
            }

            window = e.scaledResolution;

            final MatrixStack matrixStack = e.matrixStack;

            if (elements.get(0)) renderWatermark(matrixStack);
            if (elements.get(1)) renderArrayList(matrixStack);
            if (elements.get(2)) onRenderTargetHUD(matrixStack);
            if (elements.get(3)) onStaffListRender(matrixStack, e);
            if (elements.get(4)) onKeyBindsRender(matrixStack);
            if (elements.get(5)) renderPotions(matrixStack,e);
            if (elements.get(6))renderTimer(matrixStack);
            if (elements.get(7)) RenderArmor(e);
        }
    }

    private void renderWatermark(MatrixStack matrixStack) {
        final Vector4i colorVec = new Vector4i(
                ColorUtil.getColorStyle(0),
                ColorUtil.getColorStyle(90),
                ColorUtil.getColorStyle(180),
                ColorUtil.getColorStyle(270)
        );
        int roundDegree = 4;
        int headerHeight = 14;
        //Время
        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
        String time = now.format(formatter);
        final String title = " | " + " " + time + " " + " | " +  " " +  mc.debugFPS + " " + " | " + " " + HudUtil.calculatePing();

        final String gradientText = "anova gamma ";
        // Координаты ватермарки
        final float x = 1;
        final float y = 1;
        final float titleWidth = Fonts.gilroyBold[15].getWidth(gradientText + title) + 45;
        final float titleHeight = 18;

        drawShadow(x, y, titleWidth, titleHeight, 5, colorVec.x, colorVec.y, colorVec.w, colorVec.z);
        drawGradientRound(x, y, titleWidth, titleHeight + headerHeight + 2.5f, roundDegree, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));
        drawRoundedRect(x, y, titleWidth, titleHeight, 3, rgba(20, 20, 20, 255));

        Fonts.gilroyBold[18].drawString(matrixStack, gradientText, x + 3, y + Fonts.gilroyBold[18].getFontHeight() / 2f + 0.3f, ColorUtil.getColorStyle(255));
        Fonts.gilroyBold[18].drawString(matrixStack, title, x + Fonts.gilroyBold[18].getWidth(gradientText) + 3.5f, y + Fonts.gilroyBold[18].getFontHeight() / 2f + 0.3f, ColorUtil.getColorStyle(255));
    }
    private void RenderArmor(final EventRender renderEvent) {
        int count = 0;
        for (int i = 0; i < mc.player.inventory.getSizeInventory(); i++) {
            ItemStack s = mc.player.inventory.getStackInSlot(i);
            if (s.getItem() == Items.TOTEM_OF_UNDYING) {
                count++;
            }
        }
        float xPos = renderEvent.scaledResolution.scaledWidth() / 2f;
        float yPos = renderEvent.scaledResolution.scaledHeight();

        boolean totemInInv = mc.player.inventory.mainInventory.stream().map(ItemStack::getItem).toList().contains(Items.TOTEM_OF_UNDYING);
        int off = totemInInv ? +5 : 0;
        if (mc.player.isCreative()) {
            yPos += 17;
        }

        for (ItemStack s : mc.player.inventory.armorInventory) {
            ESPFunction.drawItemStack(s, xPos - off + 74 * (mc.gameSettings.guiScale / 2f), yPos - 56 * (mc.gameSettings.guiScale / 2f), null, false);
            off += 15;
        }
        if (totemInInv)
            ESPFunction.drawItemStack(new ItemStack(Items.TOTEM_OF_UNDYING), xPos - off + 73 * (mc.gameSettings.guiScale / 2f), yPos - 56 * (mc.gameSettings.guiScale / 2f), String.valueOf(count), false);


    }
    int fontSize = 18;




    private void renderArrayList(MatrixStack stack) {
        float x = 1;
        float y = 25;
        float height = 10;
        float yOffset = 0;

        final StyledFont font = Fonts.gilroyBold[fontSize];
        StyleManager styleManager = Managment.STYLE_MANAGER;

        if (delay.hasTimeElapsed(10000)) {
            sortedFunctions = HudUtil.getSorted(font);
            delay.reset();
        }

        float gradientForce = 1;
        int fontOffset = (fontSize > 14 ? -14 + fontSize
                - (fontSize > 14 ? 1 : 0) : 0);
        int firstColor;
        int secondColor;

        for (Function function : sortedFunctions) {
            function.animation = AnimationMath.lerp(function.animation, function.state ? 1 : 0, 15);
            if (function.animation >= 0.01) {
                float width = font.getWidth(function.name) + 5;
                firstColor = styleManager.getCurrentStyle()
                        .getColor((int) ((yOffset + height * function.animation) * gradientForce));
                secondColor = styleManager.getCurrentStyle()
                        .getColor((int) (yOffset * gradientForce));
                RenderSystem.pushMatrix();
                RenderSystem.translatef(x + width / 2F, y + yOffset, 0);
                RenderSystem.scalef(1, function.animation, 1);
                RenderSystem.translatef(-(x + width / 2F), -(y + yOffset), 0);
                drawShadow(x, y + yOffset, width, height, 10, firstColor, secondColor);
                RenderSystem.popMatrix();
                yOffset += height * function.animation;
            }
        }
        yOffset = 0;
        for (Function function : sortedFunctions) {
            function.animation = AnimationMath.lerp(function.animation, function.state ? 1 : 0, 15);

            if (function.animation >= 0.01) {
                float width = font.getWidth(function.name) + 5;
                secondColor = styleManager.getCurrentStyle()
                        .getColor((int) (yOffset * gradientForce));

                RenderSystem.pushMatrix();
                RenderSystem.translatef(x + width / 2F, y + yOffset, 0);
                RenderSystem.scalef(1, function.animation, 1);
                RenderSystem.translatef(-(x + width / 2F), -(y + yOffset), 0);
                RenderUtil.Render2D.drawRect(x, y + yOffset, width, height, rgba(21, 21, 21, 200));
                font.drawString(stack, function.name, x + 3,
                        y + yOffset + font.getFontHeight() / 2f - fontOffset - 1, secondColor);
                RenderSystem.popMatrix();

                yOffset += height * function.animation;
            }
        }
        yOffset = 0;
        for (Function function : sortedFunctions) {
            function.animation = AnimationMath.lerp(function.animation, function.state ? 1 : 0, 15);
            if (function.animation >= 0.01) {
                float width = font.getWidth(function.name) + 4;
                firstColor = styleManager.getCurrentStyle()
                        .getColor((int) ((yOffset + height * function.animation) * gradientForce));
                secondColor = styleManager.getCurrentStyle()
                        .getColor((int) (yOffset * gradientForce));

                RenderSystem.pushMatrix();
                RenderSystem.translatef(x + width / 2F, y + yOffset, 0);
                RenderSystem.scalef(1, function.animation, 1);
                RenderSystem.translatef(-(x + width / 2F), -(y + yOffset), 0);
                RenderUtil.Render2D.drawShadow(x, y + yOffset, 1, height, 8, firstColor, secondColor);
                RenderUtil.Render2D.drawVertical(x, y + yOffset, 1, height, firstColor, secondColor);
                RenderSystem.popMatrix();

                yOffset += height * function.animation;
            }
        }
    }


    private float hDynamic = 0;
    private int activePotions = 0;
    private void renderPotions(final MatrixStack matrixStack, final EventRender renderEvent) {
        float posX = potionStatus.getX();
        float posY = potionStatus.getY();

        int roundDegree = 4;
        int headerHeight = 14;
        int width = 100;
        int padding = 5;
        int offset = 10;

        int headerColor = new Color(30, 30, 30, 200).getRGB();
        int backgroundColor = new Color(40, 40, 40, 230).getRGB();

        int firstColor = ColorUtil.getColorStyle(0);
        int secondColor = ColorUtil.getColorStyle(90);

        float height = activePotions * offset;

        this.hDynamic = AnimationMath.fast(this.hDynamic, height, 15);

        RenderUtil.Render2D.drawShadow(posX, posY, width, headerHeight + hDynamic + padding / 2f, 10, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawGradientRound(posX, posY, width, hDynamic + headerHeight + 2.5f, roundDegree, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawRoundedCorner(potionStatus.getX(), posY, width, headerHeight, new Vector4f(roundDegree, 0, roundDegree, 0), headerColor);
        Fonts.gilroyBold[18].drawCenteredString(matrixStack, ClientUtil.gradient("active potions", firstColor, secondColor), potionStatus.getX() + width / 2f, posY + 5.5f, firstColor);

        RenderUtil.Render2D.drawRoundedCorner(posX, posY + headerHeight, width, hDynamic + padding / 2f, new Vector4f(0, roundDegree, 0, roundDegree), backgroundColor);
        RenderUtil.SmartScissor.push();
        RenderUtil.SmartScissor.setFromComponentCoordinates(posX, posY, width, headerHeight + hDynamic + padding / 2f);
        int index = 0;

        for (EffectInstance p : mc.player.getActivePotionEffects()) {
            if (p.isShowIcon()) {

                String durationText = EffectUtils.getPotionDurationString(p, 1);
                float durationWidth = Fonts.gilroyBold[12].getWidth(durationText);

                Fonts.gilroyBold[18].drawString(matrixStack, I18n.format(p.getEffectName()), posX + padding - 2, posY + headerHeight + padding + (index * offset), ColorUtil.getColorStyle(255));
                Fonts.gilroyBold[18].drawString(matrixStack, durationText, posX + width - durationWidth - padding - 2, posY + headerHeight + padding + (index * offset), ColorUtil.getColorStyle(255));

                index++;
            }
        }
        RenderUtil.SmartScissor.unset();
        RenderUtil.SmartScissor.pop();
        activePotions = index;

        potionStatus.setWidth(width);
        potionStatus.setHeight(activePotions * offset + headerHeight);
    }
    private float heightDynamic = 0;
    float kbHeight = 0;
    float kbWidth = 100;
    float yOffset = 5;
    float height = 5;
    float kbHeightAnimation = 0;
    int fontOffset = (fontSize > 18 ? -18 + fontSize - (fontSize > 18 ? 1 : 0) : 0);
    float kbWidthAnimation = 0;

    private int activeModules = 0;

    private void onKeyBindsRender(MatrixStack stack) {
        float posX = keyBinds.getX();
        float posY = keyBinds.getY();

        int roundDegree = 4;//Нужная залупа
        int headerHeight = 14;//Нужная залупа
        int width = 100;//Нужная залупа
        int padding = 5;//Нужная залупа
        int offset = 10;//Нужная залупа

        int headerColor = new Color(30, 30, 30, 200).getRGB();//Цвета
        int backgroundColor = new Color(40, 40, 40, 230).getRGB();//Цвета

        int firstColor = ColorUtil.getColorStyle(0);//Цвета
        int secondColor = ColorUtil.getColorStyle(90);//Цвета

        float height = activeModules * offset;

        this.heightDynamic = AnimationMath.fast(this.heightDynamic, height, 10);

        RenderUtil.Render2D.drawShadow(posX, posY, width, headerHeight + heightDynamic + padding / 2f, 10, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawGradientRound(posX, posY, width, heightDynamic + headerHeight + 2.5f, roundDegree - 1, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawRoundedCorner(keyBinds.getX(), posY, width, headerHeight, new Vector4f(roundDegree, 0, roundDegree, 0), headerColor);
        Fonts.gilroyBold[18].drawCenteredString(stack, ClientUtil.gradient("key bind", firstColor, secondColor), keyBinds.getX() + width / 2f, posY + 5.5f, firstColor);//Текст

        RenderUtil.Render2D.drawRoundedCorner(posX, posY + headerHeight, width, heightDynamic + padding / 2f, new Vector4f(0, roundDegree, 0, roundDegree), backgroundColor);
        RenderUtil.SmartScissor.push();
        RenderUtil.SmartScissor.setFromComponentCoordinates(posX, posY, width, headerHeight + heightDynamic + padding / 2f);
        int index = 0;

        for (Function f : Managment.FUNCTION_MANAGER.getFunctions()) {
            if (f.bind != 0 && f.state) {

                String text = ClientUtil.getKey(f.bind);

                if (text == null) {
                    continue;
                }


                String bindText = "[" + text.toUpperCase() + "]";
                float bindWidth = Fonts.gilroyBold[12].getWidth(bindText);

                Fonts.gilroyBold[18].drawString(stack, f.name, posX + padding -1, posY + headerHeight + padding + (index * offset)- 1, ColorUtil.getColorStyle(255));
                Fonts.gilroyBold[18].drawString(stack, bindText, posX + width - bindWidth - padding - 1, posY + headerHeight + padding + (index * offset) - 1, ColorUtil.getColorStyle(255));

                index++;
            }
        }
        RenderUtil.SmartScissor.unset();
        RenderUtil.SmartScissor.pop();
        activeModules = index;

        keyBinds.setWidth(width);
        keyBinds.setHeight(activeModules * offset + headerHeight);
    }





    private int activeStaff = 0;
    private float hDynam = 0;
    private float widthDynamic = 0;
    private float nameWidth = 0;
    List<HUD2.StaffPlayer> staffPlayers = new ArrayList<>();
    private void onStaffListRender(MatrixStack matrixStack, EventRender render) {
        float posX = staffList.getX();
        float posY = staffList.getY();

        int roundDegree = 4;
        int headerHeight = 14;
        float width = Math.max(nameWidth + 40, 100);
        int padding = 5;
        int offset = 10;

        int headerColor = new Color(30, 30, 30, 200).getRGB();
        int backgroundColor = new Color(35, 35, 35, 230).getRGB();

        int firstColor = ColorUtil.getColorStyle(0);
        int secondColor = ColorUtil.getColorStyle(90);
        float height = activeStaff * offset;

        this.hDynam = AnimationMath.fast(this.hDynam, height, 10);
        this.widthDynamic = AnimationMath.fast(this.widthDynamic, width, 10);
        RenderUtil.Render2D.drawShadow(posX, posY, widthDynamic, headerHeight + hDynam + padding / 2f, 10, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawGradientRound(posX, posY, widthDynamic, hDynam + headerHeight + 2.5f, roundDegree - 1, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawRoundedCorner(posX, posY, widthDynamic, headerHeight, new Vector4f(roundDegree, 0, roundDegree, 0), headerColor);
        Fonts.gilroyBold[18].drawCenteredString(matrixStack, ClientUtil.gradient("staff list", firstColor, secondColor), posX + widthDynamic / 2f, posY + 5.5f, ColorUtil.getColorStyle(255));

        RenderUtil.Render2D.drawRoundedCorner(posX, posY + headerHeight, widthDynamic, hDynam + padding / 2f, new Vector4f(0, roundDegree, 0, roundDegree), backgroundColor);

        int index = 0;

        SmartScissor.push();
        SmartScissor.setFromComponentCoordinates(posX, posY, widthDynamic, headerHeight + hDynam + padding / 2f);
        if (!staffPlayers.isEmpty()) {
            for (HUD2.StaffPlayer staff : staffPlayers) {
                String name = staff.getName();
                ITextComponent prefix = staff.getPrefix();
                String status = staff.getStatus().getString();

                Fonts.gilroyBold[12].drawString(matrixStack, prefix, posX + padding, posY + headerHeight + padding + (index * offset), -1);
                Fonts.gilroyBold[12].drawString(matrixStack, name + status, posX + padding + Fonts.gilroyBold[12].getWidth(prefix.getString()), posY + headerHeight + padding + (index * offset), -1);
                nameWidth = Fonts.gilroyBold[12].getWidth(prefix.getString() + name + status);
                index++;
            }
        } else {
            nameWidth = 0;
        }
        SmartScissor.unset();
        SmartScissor.pop();

        activeStaff = index;
        staffList.setWidth(widthDynamic);
        staffList.setHeight(hDynam + headerHeight);
    }
    private class StaffPlayer {

        @Getter
        String name;
        @Getter
        ITextComponent prefix;
        @Getter
        HudFunction.Status status;

        private StaffPlayer(String name, ITextComponent prefix) {
            this.name = name;
            this.prefix = prefix;

            updateStatus();
        }

        private void updateStatus() {
            for (AbstractClientPlayerEntity player : mc.world.getPlayers()) {
                if (player.getNameClear().equals(name)) {
                    status = NEAR;
                    return;
                }
            }

            for (NetworkPlayerInfo info : mc.getConnection().getPlayerInfoMap()) {
                if (info.getGameProfile().getName().equals(name)) {
                    if (info.getGameType() == GameType.SPECTATOR) {
                        status = SPEC;
                        return;
                    }

                    status = NONE;
                    return;
                }
            }

            status = VANISHED;
        }
    }
    public final Dragging targetHUD = Initilization.createDrag(this, "TargetHUD", 500, 50);
    private float health = 0;
    private double scale = 0.0D;

    private void onRenderTargetHUD(final MatrixStack stack) {
        this.target = getTarget(this.target);
        this.targetHudAnimation.setDuration(300);
        this.scale = targetHudAnimation.getOutput();
        if (scale == 0.0F) {
            target = null;
        }
        if (target == null) {
            return;
        }
        final String targetName = this.target.getName().getString();

        String substring = targetName.substring(0, Math.min(targetName.length(), 10));//Нужная залупа
        final float nameWidth = Fonts.gilroyBold[18].getWidth(substring);//Нужная залупа
        final float xPosition = this.targetHUD.getX();//Нужная залупа
        final float yPosition = this.targetHUD.getY();//Нужная залупа
        final float maxWidth = Math.max(nameWidth + 50, 120);//Нужная залупа
        final float maxHeight = 30;//Нужная залупа

        this.health = AnimationMath.fast(health, target.getHealth() / target.getMaxHealth(), 5);//Типо должна быть анимация
        this.health = MathHelper.clamp(this.health, 0, 1);//Типо должна быть анимация

        GlStateManager.pushMatrix();
        AnimationMath.sizeAnimation(xPosition + (maxWidth / 2), yPosition + (maxHeight / 2), scale);

        Vector2i colorVec = new Vector2i(ColorUtil.getColorStyle(0), ColorUtil.getColorStyle(90));

        RenderUtil.Render2D.drawShadow(xPosition, yPosition, maxWidth, maxHeight, 10, colorVec.x, colorVec.y, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawGradientRound(xPosition, yPosition, maxWidth, maxHeight, 3, colorVec.x, colorVec.y, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawRoundedRect(xPosition, yPosition, maxWidth, maxHeight, 2.5f, rgba(21, 21, 21, 200));
        drawFace(xPosition + 4, yPosition + 3.25f, 8F, 8F, 8F, 8F, 24, 24, 64F, 64F, (AbstractClientPlayerEntity) target);//Ебло чела
        drawCircle(
                xPosition + maxWidth - 15, // X-координата
                yPosition + maxHeight / 2, // Y-координата
                12.0f,                     // Радиус круга
                4.0f,                      // Ширина линии
                false,                     // Не заполненный круг
                ColorUtil.getColorStyle(255), // Цвет
                360                        // Количество сегментов
        );



        drawItemStack(xPosition + 32, yPosition + 22 - 5.5f, 10);

        Fonts.gilroyBold[18].drawString(stack, substring, xPosition + maxWidth - 90, yPosition + 6, -1);//Ник

        String healthValue = (int) MathUtil.round(this.health * 20 + target.getAbsorptionAmount(), 0.5f) + "";
        Fonts.gilroyBold[18].drawCenteredString(stack, healthValue, xPosition + maxWidth - 15, yPosition + maxHeight / 2 - 2.2f, ColorUtil.rgba(255, 255, 255, 255));//Hp
        GlStateManager.popMatrix();
        this.targetHUD.setWidth(maxWidth);
        this.targetHUD.setHeight(maxHeight);
    }




    private void drawItemStack(float x, float y, float offset) {
        List<ItemStack> stackList = new ArrayList<>(Arrays.asList(target.getHeldItemMainhand(), target.getHeldItemOffhand()));
        stackList.addAll((Collection<? extends ItemStack>) target.getArmorInventoryList());

        final AtomicReference<Float> posX = new AtomicReference<>(x);

        stackList.stream()
                .filter(stack -> !stack.isEmpty())
                .forEach(stack -> HudUtil.drawItemStack(stack,
                        posX.getAndAccumulate(offset, Float::sum),
                        y,
                        true,
                        true, 0.6f));
    }

    private float perc;

    private void renderTimer(MatrixStack matrixStack) {
        float posX = timerHUD.getX();
        float posY = timerHUD.getY();
        int firstColor = ColorUtil.getColorStyle(0);
        int secondColor = ColorUtil.getColorStyle(90);

        float quotient = Managment.FUNCTION_MANAGER.timerFunction.maxViolation / Managment.FUNCTION_MANAGER.timerFunction.timerAmount.getValue().floatValue();
        float minimumValue = Math.min(Managment.FUNCTION_MANAGER.timerFunction.getViolation(), quotient);
        perc = AnimationMath.lerp(perc, ((quotient - minimumValue) / quotient), 10);

        String text = (int) (perc * 100) + "%";
        float width = 80;
        int width2 = 70;
        timerHUD.setWidth(width);
        timerHUD.setHeight(20);
        RenderUtil.Render2D.drawShadow(posX, posY, width, 27, 10, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));
        RenderUtil.Render2D.drawGradientRound(posX - 0.25f, posY - 0.25f, width + 0.25f, 27 + 0.25f, 3, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));
        RenderUtil.Render2D.drawRoundedRect(posX, posY, width, 27,3, RenderUtil.reAlphaInt(ColorUtil.rgba(15, 15, 15, 255), 170));

        medium.drawString(matrixStack, "Timer", posX + 27.5, posY + 6, ColorUtil.getColorStyle(255));

        RenderUtil.Render2D.drawGradientRound(posX + 5f, posY + 24 - 8, width2 * perc, 7,1, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));
        medium.drawString(matrixStack, text, posX + width - medium.getWidth(text) - 3 - 27, posY + 17.5, t_color);
    }

    private PlayerEntity getTarget(PlayerEntity nullTarget) {
        PlayerEntity target = nullTarget;

        if (Managment.FUNCTION_MANAGER.auraFunction.getTarget() instanceof PlayerEntity) {
            target = (PlayerEntity) Managment.FUNCTION_MANAGER.auraFunction.getTarget();
            tHudAnimation.setDirection(Direction.FORWARDS);
        } else if (mc.currentScreen instanceof ChatScreen) {
            target = mc.player;
            tHudAnimation.setDirection(Direction.FORWARDS);
        } else {
            tHudAnimation.setDirection(Direction.BACKWARDS);
        }

        return target;
    }

    private void updateFunctions() {
        for (Function function : Managment.FUNCTION_MANAGER.getFunctions()) {
            if (function.category == Category.Render) continue;

            functions.add(function);
        }

        functions.sort((f1, f2) -> Float.compare(small.getWidth(f2.name), small.getWidth(f1.name)));
    }

    private int getColor(int index) {
        return colors[index % colors.length];
    }
}
ну тх нормальный больше говорить ничего не буду на базе 2.0 не сижу ее не знаю ну выглядит хуево
 
Начинающий
Статус
Оффлайн
Регистрация
22 Сен 2023
Сообщения
43
Реакции[?]
0
Поинты[?]
0
ну тх нормальный больше говорить ничего не буду на базе 2.0 не сижу ее не знаю ну выглядит хуево
Этот код даже не мой, я ток шрифты сделал больше и сделал тх.
 
Начинающий
Статус
Оффлайн
Регистрация
3 Май 2023
Сообщения
345
Реакции[?]
2
Поинты[?]
2K
Начинающий
Статус
Оффлайн
Регистрация
22 Янв 2024
Сообщения
79
Реакции[?]
0
Поинты[?]
0
Доделанный худ из HudFunction в expensive 2.0
Посмотреть вложение 282407

Код:
package Anova.modules.impl.render;

import Anova.modules.settings.imp.ModeSetting;
import Anova.ui.midnight.StyleManager;
import Anova.util.misc.TimerUtil;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import lombok.Getter;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.network.play.NetworkPlayerInfo;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.AirItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Team;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.GameType;
import org.joml.Vector2i;
import org.joml.Vector4i;
import org.lwjgl.opengl.GL11;
import Anova.Initilization;
import Anova.events.Event;
import Anova.events.impl.player.EventUpdate;
import Anova.events.impl.render.EventRender;
import Anova.managment.Managment;
import Anova.modules.Function;
import Anova.modules.FunctionModule;
import Anova.modules.Category;
import Anova.modules.settings.imp.BooleanOption;
import Anova.modules.settings.imp.MultiBoxSetting;
import Anova.modules.settings.imp.SliderSetting;
import Anova.util.ClientUtil;
import Anova.util.animations.Animation;
import Anova.util.animations.Direction;
import Anova.util.animations.impl.EaseBackIn;
import Anova.util.drag.Dragging;
import Anova.util.font.Fonts;
import Anova.util.font.styled.StyledFont;
import Anova.util.math.MathUtil;
import Anova.util.misc.HudUtil;
import Anova.util.render.BloomHelper;
import Anova.util.render.ColorUtil;
import Anova.util.render.RenderUtil;
import Anova.util.render.animation.AnimationMath;
import Anova.util.render.RenderUtil.SmartScissor;

import java.awt.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;
import java.text.SimpleDateFormat;
import java.util.Date;

import static Anova.modules.impl.render.HudFunction.Status.*;
import static Anova.modules.impl.render.HudFunction.Status.VANISHED;
import static Anova.ui.alt.AltManager.white;
import static Anova.ui.clickgui.Window.dark;
import static Anova.util.render.ColorUtil.rgba;
import static Anova.util.render.RenderUtil.Render2D.*;

/**
* @author Swoe228
* @since 23.07.2024
*/

@FunctionModule(name = "HUD", type = Category.Render)
    public class HUD2 extends Function {
    int firstColor;
    int secondColor;
    public final MultiBoxSetting elements = new MultiBoxSetting("Элементы",
            new BooleanOption("Ватермарка", true),
            new BooleanOption("Активные функции", true),
            new BooleanOption("Активный таргет", true),
            new BooleanOption("Активные стаффы", true),
            new BooleanOption("Активные бинды", true),
            new BooleanOption("Активные эффекты", true),
            new BooleanOption("Таймер", true),
            new BooleanOption("Броня",true)
    );
    public static final BooleanOption Renderutils = new BooleanOption("Невьебический рендер",false);


    List<Function> sortedFunctions = new ArrayList<>();
    TimerUtil delay = new TimerUtil();

    public HUD2() {
        addsetting(elements,Renderutils);
    }
    final float round_degree = 3;

    final float cWidth = 4;

    final Vector4f left_vec = new Vector4f(round_degree, round_degree, 0, 0);
    final Vector4f right_vec = new Vector4f(0, 0, round_degree, round_degree);

    final int b_color = new Color(0, 0, 0, 128).getRGB();
    final int t_color = Color.WHITE.getRGB();

    int[] colors = new int[360];

    final StyledFont icons = Fonts.icons1[20];
    final StyledFont medium = Fonts.msMedium[16];
    final StyledFont small = Fonts.msMedium[14];

    MainWindow window;

    List<Function> functions = new ArrayList<>();
    public Dragging potionStatus = Initilization.createDrag(this, "PotionStatus", 200, 50);
    final Dragging keyBinds = Initilization.createDrag(this, "KeyBinds-new", 10, 100);
    final Dragging staffList = Initilization.createDrag(this, "StaffList-new", 10, 200);

    private final Animation targetHudAnimation = new EaseBackIn(200, 1, 1.5f);
    final Dragging timerHUD = Initilization.createDrag(this, "TimerHUD-new", 10, 400);

    Animation tHudAnimation = new EaseBackIn(400, 1, 1.5f);
    PlayerEntity target = null;


    private final Pattern namePattern = Pattern.compile("^\\w{3,16}$");
    private final Pattern prefixMatches = Pattern.compile(".*(mod|der|stager|adm|help|wne|мод|хелп|помо|адм|владе|отри|таф|taf|curat|курато|dev|раз|supp|сапп|yt|ютуб).*");



    @Override
    public void onEventModule(Event event) {
        if (mc.player == null || mc.world == null) return;

        if (event instanceof EventUpdate) {
            staffPlayers.clear();

            for (ScorePlayerTeam team : mc.world.getScoreboard().getTeams().stream().sorted(Comparator.comparing(Team::getName)).toList()) {
                String name = team.getMembershipCollection().toString();
                name = name.substring(1, name.length() - 1);
                if (namePattern.matcher(name).matches()) {
                    if (prefixMatches.matcher(team.getPrefix().getString().toLowerCase(Locale.ROOT)).matches() || Managment.STAFF_MANAGER.isStaff(name)) {
                    }
                }
            }

            if (Managment.FUNCTION_MANAGER.getFunctions().isEmpty() || !functions.isEmpty()) return;
            updateFunctions();
        }

        if (event instanceof EventRender e && e.isRender2D()) {
            for (int i = 0; i < colors.length; i++) {
                colors[i] = Managment.STYLE_MANAGER.getCurrentStyle().getColor(i);
            }

            window = e.scaledResolution;

            final MatrixStack matrixStack = e.matrixStack;

            if (elements.get(0)) renderWatermark(matrixStack);
            if (elements.get(1)) renderArrayList(matrixStack);
            if (elements.get(2)) onRenderTargetHUD(matrixStack);
            if (elements.get(3)) onStaffListRender(matrixStack, e);
            if (elements.get(4)) onKeyBindsRender(matrixStack);
            if (elements.get(5)) renderPotions(matrixStack,e);
            if (elements.get(6))renderTimer(matrixStack);
            if (elements.get(7)) RenderArmor(e);
        }
    }

    private void renderWatermark(MatrixStack matrixStack) {
        final Vector4i colorVec = new Vector4i(
                ColorUtil.getColorStyle(0),
                ColorUtil.getColorStyle(90),
                ColorUtil.getColorStyle(180),
                ColorUtil.getColorStyle(270)
        );
        int roundDegree = 4;
        int headerHeight = 14;
        //Время
        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
        String time = now.format(formatter);
        final String title = " | " + " " + time + " " + " | " +  " " +  mc.debugFPS + " " + " | " + " " + HudUtil.calculatePing();

        final String gradientText = "anova gamma ";
        // Координаты ватермарки
        final float x = 1;
        final float y = 1;
        final float titleWidth = Fonts.gilroyBold[15].getWidth(gradientText + title) + 45;
        final float titleHeight = 18;

        drawShadow(x, y, titleWidth, titleHeight, 5, colorVec.x, colorVec.y, colorVec.w, colorVec.z);
        drawGradientRound(x, y, titleWidth, titleHeight + headerHeight + 2.5f, roundDegree, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));
        drawRoundedRect(x, y, titleWidth, titleHeight, 3, rgba(20, 20, 20, 255));

        Fonts.gilroyBold[18].drawString(matrixStack, gradientText, x + 3, y + Fonts.gilroyBold[18].getFontHeight() / 2f + 0.3f, ColorUtil.getColorStyle(255));
        Fonts.gilroyBold[18].drawString(matrixStack, title, x + Fonts.gilroyBold[18].getWidth(gradientText) + 3.5f, y + Fonts.gilroyBold[18].getFontHeight() / 2f + 0.3f, ColorUtil.getColorStyle(255));
    }
    private void RenderArmor(final EventRender renderEvent) {
        int count = 0;
        for (int i = 0; i < mc.player.inventory.getSizeInventory(); i++) {
            ItemStack s = mc.player.inventory.getStackInSlot(i);
            if (s.getItem() == Items.TOTEM_OF_UNDYING) {
                count++;
            }
        }
        float xPos = renderEvent.scaledResolution.scaledWidth() / 2f;
        float yPos = renderEvent.scaledResolution.scaledHeight();

        boolean totemInInv = mc.player.inventory.mainInventory.stream().map(ItemStack::getItem).toList().contains(Items.TOTEM_OF_UNDYING);
        int off = totemInInv ? +5 : 0;
        if (mc.player.isCreative()) {
            yPos += 17;
        }

        for (ItemStack s : mc.player.inventory.armorInventory) {
            ESPFunction.drawItemStack(s, xPos - off + 74 * (mc.gameSettings.guiScale / 2f), yPos - 56 * (mc.gameSettings.guiScale / 2f), null, false);
            off += 15;
        }
        if (totemInInv)
            ESPFunction.drawItemStack(new ItemStack(Items.TOTEM_OF_UNDYING), xPos - off + 73 * (mc.gameSettings.guiScale / 2f), yPos - 56 * (mc.gameSettings.guiScale / 2f), String.valueOf(count), false);


    }
    int fontSize = 18;




    private void renderArrayList(MatrixStack stack) {
        float x = 1;
        float y = 25;
        float height = 10;
        float yOffset = 0;

        final StyledFont font = Fonts.gilroyBold[fontSize];
        StyleManager styleManager = Managment.STYLE_MANAGER;

        if (delay.hasTimeElapsed(10000)) {
            sortedFunctions = HudUtil.getSorted(font);
            delay.reset();
        }

        float gradientForce = 1;
        int fontOffset = (fontSize > 14 ? -14 + fontSize
                - (fontSize > 14 ? 1 : 0) : 0);
        int firstColor;
        int secondColor;

        for (Function function : sortedFunctions) {
            function.animation = AnimationMath.lerp(function.animation, function.state ? 1 : 0, 15);
            if (function.animation >= 0.01) {
                float width = font.getWidth(function.name) + 5;
                firstColor = styleManager.getCurrentStyle()
                        .getColor((int) ((yOffset + height * function.animation) * gradientForce));
                secondColor = styleManager.getCurrentStyle()
                        .getColor((int) (yOffset * gradientForce));
                RenderSystem.pushMatrix();
                RenderSystem.translatef(x + width / 2F, y + yOffset, 0);
                RenderSystem.scalef(1, function.animation, 1);
                RenderSystem.translatef(-(x + width / 2F), -(y + yOffset), 0);
                drawShadow(x, y + yOffset, width, height, 10, firstColor, secondColor);
                RenderSystem.popMatrix();
                yOffset += height * function.animation;
            }
        }
        yOffset = 0;
        for (Function function : sortedFunctions) {
            function.animation = AnimationMath.lerp(function.animation, function.state ? 1 : 0, 15);

            if (function.animation >= 0.01) {
                float width = font.getWidth(function.name) + 5;
                secondColor = styleManager.getCurrentStyle()
                        .getColor((int) (yOffset * gradientForce));

                RenderSystem.pushMatrix();
                RenderSystem.translatef(x + width / 2F, y + yOffset, 0);
                RenderSystem.scalef(1, function.animation, 1);
                RenderSystem.translatef(-(x + width / 2F), -(y + yOffset), 0);
                RenderUtil.Render2D.drawRect(x, y + yOffset, width, height, rgba(21, 21, 21, 200));
                font.drawString(stack, function.name, x + 3,
                        y + yOffset + font.getFontHeight() / 2f - fontOffset - 1, secondColor);
                RenderSystem.popMatrix();

                yOffset += height * function.animation;
            }
        }
        yOffset = 0;
        for (Function function : sortedFunctions) {
            function.animation = AnimationMath.lerp(function.animation, function.state ? 1 : 0, 15);
            if (function.animation >= 0.01) {
                float width = font.getWidth(function.name) + 4;
                firstColor = styleManager.getCurrentStyle()
                        .getColor((int) ((yOffset + height * function.animation) * gradientForce));
                secondColor = styleManager.getCurrentStyle()
                        .getColor((int) (yOffset * gradientForce));

                RenderSystem.pushMatrix();
                RenderSystem.translatef(x + width / 2F, y + yOffset, 0);
                RenderSystem.scalef(1, function.animation, 1);
                RenderSystem.translatef(-(x + width / 2F), -(y + yOffset), 0);
                RenderUtil.Render2D.drawShadow(x, y + yOffset, 1, height, 8, firstColor, secondColor);
                RenderUtil.Render2D.drawVertical(x, y + yOffset, 1, height, firstColor, secondColor);
                RenderSystem.popMatrix();

                yOffset += height * function.animation;
            }
        }
    }


    private float hDynamic = 0;
    private int activePotions = 0;
    private void renderPotions(final MatrixStack matrixStack, final EventRender renderEvent) {
        float posX = potionStatus.getX();
        float posY = potionStatus.getY();

        int roundDegree = 4;
        int headerHeight = 14;
        int width = 100;
        int padding = 5;
        int offset = 10;

        int headerColor = new Color(30, 30, 30, 200).getRGB();
        int backgroundColor = new Color(40, 40, 40, 230).getRGB();

        int firstColor = ColorUtil.getColorStyle(0);
        int secondColor = ColorUtil.getColorStyle(90);

        float height = activePotions * offset;

        this.hDynamic = AnimationMath.fast(this.hDynamic, height, 15);

        RenderUtil.Render2D.drawShadow(posX, posY, width, headerHeight + hDynamic + padding / 2f, 10, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawGradientRound(posX, posY, width, hDynamic + headerHeight + 2.5f, roundDegree, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawRoundedCorner(potionStatus.getX(), posY, width, headerHeight, new Vector4f(roundDegree, 0, roundDegree, 0), headerColor);
        Fonts.gilroyBold[18].drawCenteredString(matrixStack, ClientUtil.gradient("active potions", firstColor, secondColor), potionStatus.getX() + width / 2f, posY + 5.5f, firstColor);

        RenderUtil.Render2D.drawRoundedCorner(posX, posY + headerHeight, width, hDynamic + padding / 2f, new Vector4f(0, roundDegree, 0, roundDegree), backgroundColor);
        RenderUtil.SmartScissor.push();
        RenderUtil.SmartScissor.setFromComponentCoordinates(posX, posY, width, headerHeight + hDynamic + padding / 2f);
        int index = 0;

        for (EffectInstance p : mc.player.getActivePotionEffects()) {
            if (p.isShowIcon()) {

                String durationText = EffectUtils.getPotionDurationString(p, 1);
                float durationWidth = Fonts.gilroyBold[12].getWidth(durationText);

                Fonts.gilroyBold[18].drawString(matrixStack, I18n.format(p.getEffectName()), posX + padding - 2, posY + headerHeight + padding + (index * offset), ColorUtil.getColorStyle(255));
                Fonts.gilroyBold[18].drawString(matrixStack, durationText, posX + width - durationWidth - padding - 2, posY + headerHeight + padding + (index * offset), ColorUtil.getColorStyle(255));

                index++;
            }
        }
        RenderUtil.SmartScissor.unset();
        RenderUtil.SmartScissor.pop();
        activePotions = index;

        potionStatus.setWidth(width);
        potionStatus.setHeight(activePotions * offset + headerHeight);
    }
    private float heightDynamic = 0;
    float kbHeight = 0;
    float kbWidth = 100;
    float yOffset = 5;
    float height = 5;
    float kbHeightAnimation = 0;
    int fontOffset = (fontSize > 18 ? -18 + fontSize - (fontSize > 18 ? 1 : 0) : 0);
    float kbWidthAnimation = 0;

    private int activeModules = 0;

    private void onKeyBindsRender(MatrixStack stack) {
        float posX = keyBinds.getX();
        float posY = keyBinds.getY();

        int roundDegree = 4;//Нужная залупа
        int headerHeight = 14;//Нужная залупа
        int width = 100;//Нужная залупа
        int padding = 5;//Нужная залупа
        int offset = 10;//Нужная залупа

        int headerColor = new Color(30, 30, 30, 200).getRGB();//Цвета
        int backgroundColor = new Color(40, 40, 40, 230).getRGB();//Цвета

        int firstColor = ColorUtil.getColorStyle(0);//Цвета
        int secondColor = ColorUtil.getColorStyle(90);//Цвета

        float height = activeModules * offset;

        this.heightDynamic = AnimationMath.fast(this.heightDynamic, height, 10);

        RenderUtil.Render2D.drawShadow(posX, posY, width, headerHeight + heightDynamic + padding / 2f, 10, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawGradientRound(posX, posY, width, heightDynamic + headerHeight + 2.5f, roundDegree - 1, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawRoundedCorner(keyBinds.getX(), posY, width, headerHeight, new Vector4f(roundDegree, 0, roundDegree, 0), headerColor);
        Fonts.gilroyBold[18].drawCenteredString(stack, ClientUtil.gradient("key bind", firstColor, secondColor), keyBinds.getX() + width / 2f, posY + 5.5f, firstColor);//Текст

        RenderUtil.Render2D.drawRoundedCorner(posX, posY + headerHeight, width, heightDynamic + padding / 2f, new Vector4f(0, roundDegree, 0, roundDegree), backgroundColor);
        RenderUtil.SmartScissor.push();
        RenderUtil.SmartScissor.setFromComponentCoordinates(posX, posY, width, headerHeight + heightDynamic + padding / 2f);
        int index = 0;

        for (Function f : Managment.FUNCTION_MANAGER.getFunctions()) {
            if (f.bind != 0 && f.state) {

                String text = ClientUtil.getKey(f.bind);

                if (text == null) {
                    continue;
                }


                String bindText = "[" + text.toUpperCase() + "]";
                float bindWidth = Fonts.gilroyBold[12].getWidth(bindText);

                Fonts.gilroyBold[18].drawString(stack, f.name, posX + padding -1, posY + headerHeight + padding + (index * offset)- 1, ColorUtil.getColorStyle(255));
                Fonts.gilroyBold[18].drawString(stack, bindText, posX + width - bindWidth - padding - 1, posY + headerHeight + padding + (index * offset) - 1, ColorUtil.getColorStyle(255));

                index++;
            }
        }
        RenderUtil.SmartScissor.unset();
        RenderUtil.SmartScissor.pop();
        activeModules = index;

        keyBinds.setWidth(width);
        keyBinds.setHeight(activeModules * offset + headerHeight);
    }





    private int activeStaff = 0;
    private float hDynam = 0;
    private float widthDynamic = 0;
    private float nameWidth = 0;
    List<HUD2.StaffPlayer> staffPlayers = new ArrayList<>();
    private void onStaffListRender(MatrixStack matrixStack, EventRender render) {
        float posX = staffList.getX();
        float posY = staffList.getY();

        int roundDegree = 4;
        int headerHeight = 14;
        float width = Math.max(nameWidth + 40, 100);
        int padding = 5;
        int offset = 10;

        int headerColor = new Color(30, 30, 30, 200).getRGB();
        int backgroundColor = new Color(35, 35, 35, 230).getRGB();

        int firstColor = ColorUtil.getColorStyle(0);
        int secondColor = ColorUtil.getColorStyle(90);
        float height = activeStaff * offset;

        this.hDynam = AnimationMath.fast(this.hDynam, height, 10);
        this.widthDynamic = AnimationMath.fast(this.widthDynamic, width, 10);
        RenderUtil.Render2D.drawShadow(posX, posY, widthDynamic, headerHeight + hDynam + padding / 2f, 10, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawGradientRound(posX, posY, widthDynamic, hDynam + headerHeight + 2.5f, roundDegree - 1, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawRoundedCorner(posX, posY, widthDynamic, headerHeight, new Vector4f(roundDegree, 0, roundDegree, 0), headerColor);
        Fonts.gilroyBold[18].drawCenteredString(matrixStack, ClientUtil.gradient("staff list", firstColor, secondColor), posX + widthDynamic / 2f, posY + 5.5f, ColorUtil.getColorStyle(255));

        RenderUtil.Render2D.drawRoundedCorner(posX, posY + headerHeight, widthDynamic, hDynam + padding / 2f, new Vector4f(0, roundDegree, 0, roundDegree), backgroundColor);

        int index = 0;

        SmartScissor.push();
        SmartScissor.setFromComponentCoordinates(posX, posY, widthDynamic, headerHeight + hDynam + padding / 2f);
        if (!staffPlayers.isEmpty()) {
            for (HUD2.StaffPlayer staff : staffPlayers) {
                String name = staff.getName();
                ITextComponent prefix = staff.getPrefix();
                String status = staff.getStatus().getString();

                Fonts.gilroyBold[12].drawString(matrixStack, prefix, posX + padding, posY + headerHeight + padding + (index * offset), -1);
                Fonts.gilroyBold[12].drawString(matrixStack, name + status, posX + padding + Fonts.gilroyBold[12].getWidth(prefix.getString()), posY + headerHeight + padding + (index * offset), -1);
                nameWidth = Fonts.gilroyBold[12].getWidth(prefix.getString() + name + status);
                index++;
            }
        } else {
            nameWidth = 0;
        }
        SmartScissor.unset();
        SmartScissor.pop();

        activeStaff = index;
        staffList.setWidth(widthDynamic);
        staffList.setHeight(hDynam + headerHeight);
    }
    private class StaffPlayer {

        @Getter
        String name;
        @Getter
        ITextComponent prefix;
        @Getter
        HudFunction.Status status;

        private StaffPlayer(String name, ITextComponent prefix) {
            this.name = name;
            this.prefix = prefix;

            updateStatus();
        }

        private void updateStatus() {
            for (AbstractClientPlayerEntity player : mc.world.getPlayers()) {
                if (player.getNameClear().equals(name)) {
                    status = NEAR;
                    return;
                }
            }

            for (NetworkPlayerInfo info : mc.getConnection().getPlayerInfoMap()) {
                if (info.getGameProfile().getName().equals(name)) {
                    if (info.getGameType() == GameType.SPECTATOR) {
                        status = SPEC;
                        return;
                    }

                    status = NONE;
                    return;
                }
            }

            status = VANISHED;
        }
    }
    public final Dragging targetHUD = Initilization.createDrag(this, "TargetHUD", 500, 50);
    private float health = 0;
    private double scale = 0.0D;

    private void onRenderTargetHUD(final MatrixStack stack) {
        this.target = getTarget(this.target);
        this.targetHudAnimation.setDuration(300);
        this.scale = targetHudAnimation.getOutput();
        if (scale == 0.0F) {
            target = null;
        }
        if (target == null) {
            return;
        }
        final String targetName = this.target.getName().getString();

        String substring = targetName.substring(0, Math.min(targetName.length(), 10));//Нужная залупа
        final float nameWidth = Fonts.gilroyBold[18].getWidth(substring);//Нужная залупа
        final float xPosition = this.targetHUD.getX();//Нужная залупа
        final float yPosition = this.targetHUD.getY();//Нужная залупа
        final float maxWidth = Math.max(nameWidth + 50, 120);//Нужная залупа
        final float maxHeight = 30;//Нужная залупа

        this.health = AnimationMath.fast(health, target.getHealth() / target.getMaxHealth(), 5);//Типо должна быть анимация
        this.health = MathHelper.clamp(this.health, 0, 1);//Типо должна быть анимация

        GlStateManager.pushMatrix();
        AnimationMath.sizeAnimation(xPosition + (maxWidth / 2), yPosition + (maxHeight / 2), scale);

        Vector2i colorVec = new Vector2i(ColorUtil.getColorStyle(0), ColorUtil.getColorStyle(90));

        RenderUtil.Render2D.drawShadow(xPosition, yPosition, maxWidth, maxHeight, 10, colorVec.x, colorVec.y, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawGradientRound(xPosition, yPosition, maxWidth, maxHeight, 3, colorVec.x, colorVec.y, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawRoundedRect(xPosition, yPosition, maxWidth, maxHeight, 2.5f, rgba(21, 21, 21, 200));
        drawFace(xPosition + 4, yPosition + 3.25f, 8F, 8F, 8F, 8F, 24, 24, 64F, 64F, (AbstractClientPlayerEntity) target);//Ебло чела
        drawCircle(
                xPosition + maxWidth - 15, // X-координата
                yPosition + maxHeight / 2, // Y-координата
                12.0f,                     // Радиус круга
                4.0f,                      // Ширина линии
                false,                     // Не заполненный круг
                ColorUtil.getColorStyle(255), // Цвет
                360                        // Количество сегментов
        );



        drawItemStack(xPosition + 32, yPosition + 22 - 5.5f, 10);

        Fonts.gilroyBold[18].drawString(stack, substring, xPosition + maxWidth - 90, yPosition + 6, -1);//Ник

        String healthValue = (int) MathUtil.round(this.health * 20 + target.getAbsorptionAmount(), 0.5f) + "";
        Fonts.gilroyBold[18].drawCenteredString(stack, healthValue, xPosition + maxWidth - 15, yPosition + maxHeight / 2 - 2.2f, ColorUtil.rgba(255, 255, 255, 255));//Hp
        GlStateManager.popMatrix();
        this.targetHUD.setWidth(maxWidth);
        this.targetHUD.setHeight(maxHeight);
    }




    private void drawItemStack(float x, float y, float offset) {
        List<ItemStack> stackList = new ArrayList<>(Arrays.asList(target.getHeldItemMainhand(), target.getHeldItemOffhand()));
        stackList.addAll((Collection<? extends ItemStack>) target.getArmorInventoryList());

        final AtomicReference<Float> posX = new AtomicReference<>(x);

        stackList.stream()
                .filter(stack -> !stack.isEmpty())
                .forEach(stack -> HudUtil.drawItemStack(stack,
                        posX.getAndAccumulate(offset, Float::sum),
                        y,
                        true,
                        true, 0.6f));
    }

    private float perc;

    private void renderTimer(MatrixStack matrixStack) {
        float posX = timerHUD.getX();
        float posY = timerHUD.getY();
        int firstColor = ColorUtil.getColorStyle(0);
        int secondColor = ColorUtil.getColorStyle(90);

        float quotient = Managment.FUNCTION_MANAGER.timerFunction.maxViolation / Managment.FUNCTION_MANAGER.timerFunction.timerAmount.getValue().floatValue();
        float minimumValue = Math.min(Managment.FUNCTION_MANAGER.timerFunction.getViolation(), quotient);
        perc = AnimationMath.lerp(perc, ((quotient - minimumValue) / quotient), 10);

        String text = (int) (perc * 100) + "%";
        float width = 80;
        int width2 = 70;
        timerHUD.setWidth(width);
        timerHUD.setHeight(20);
        RenderUtil.Render2D.drawShadow(posX, posY, width, 27, 10, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));
        RenderUtil.Render2D.drawGradientRound(posX - 0.25f, posY - 0.25f, width + 0.25f, 27 + 0.25f, 3, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));
        RenderUtil.Render2D.drawRoundedRect(posX, posY, width, 27,3, RenderUtil.reAlphaInt(ColorUtil.rgba(15, 15, 15, 255), 170));

        medium.drawString(matrixStack, "Timer", posX + 27.5, posY + 6, ColorUtil.getColorStyle(255));

        RenderUtil.Render2D.drawGradientRound(posX + 5f, posY + 24 - 8, width2 * perc, 7,1, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));
        medium.drawString(matrixStack, text, posX + width - medium.getWidth(text) - 3 - 27, posY + 17.5, t_color);
    }

    private PlayerEntity getTarget(PlayerEntity nullTarget) {
        PlayerEntity target = nullTarget;

        if (Managment.FUNCTION_MANAGER.auraFunction.getTarget() instanceof PlayerEntity) {
            target = (PlayerEntity) Managment.FUNCTION_MANAGER.auraFunction.getTarget();
            tHudAnimation.setDirection(Direction.FORWARDS);
        } else if (mc.currentScreen instanceof ChatScreen) {
            target = mc.player;
            tHudAnimation.setDirection(Direction.FORWARDS);
        } else {
            tHudAnimation.setDirection(Direction.BACKWARDS);
        }

        return target;
    }

    private void updateFunctions() {
        for (Function function : Managment.FUNCTION_MANAGER.getFunctions()) {
            if (function.category == Category.Render) continue;

            functions.add(function);
        }

        functions.sort((f1, f2) -> Float.compare(small.getWidth(f2.name), small.getWidth(f1.name)));
    }

    private int getColor(int index) {
        return colors[index % colors.length];
    }
}
ГОВНО ЕБАНОЕ
 
Начинающий
Статус
Оффлайн
Регистрация
31 Июл 2024
Сообщения
4
Реакции[?]
0
Поинты[?]
0
не смотря на фотку можно сказать что в принципе сойдет за экспенсив 0.9
 
Начинающий
Статус
Оффлайн
Регистрация
24 Июл 2022
Сообщения
231
Реакции[?]
2
Поинты[?]
1K
Доделанный худ из HudFunction в expensive 2.0
Посмотреть вложение 282407

Код:
package Anova.modules.impl.render;

import Anova.modules.settings.imp.ModeSetting;
import Anova.ui.midnight.StyleManager;
import Anova.util.misc.TimerUtil;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import lombok.Getter;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.network.play.NetworkPlayerInfo;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.AirItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Team;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.GameType;
import org.joml.Vector2i;
import org.joml.Vector4i;
import org.lwjgl.opengl.GL11;
import Anova.Initilization;
import Anova.events.Event;
import Anova.events.impl.player.EventUpdate;
import Anova.events.impl.render.EventRender;
import Anova.managment.Managment;
import Anova.modules.Function;
import Anova.modules.FunctionModule;
import Anova.modules.Category;
import Anova.modules.settings.imp.BooleanOption;
import Anova.modules.settings.imp.MultiBoxSetting;
import Anova.modules.settings.imp.SliderSetting;
import Anova.util.ClientUtil;
import Anova.util.animations.Animation;
import Anova.util.animations.Direction;
import Anova.util.animations.impl.EaseBackIn;
import Anova.util.drag.Dragging;
import Anova.util.font.Fonts;
import Anova.util.font.styled.StyledFont;
import Anova.util.math.MathUtil;
import Anova.util.misc.HudUtil;
import Anova.util.render.BloomHelper;
import Anova.util.render.ColorUtil;
import Anova.util.render.RenderUtil;
import Anova.util.render.animation.AnimationMath;
import Anova.util.render.RenderUtil.SmartScissor;

import java.awt.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;
import java.text.SimpleDateFormat;
import java.util.Date;

import static Anova.modules.impl.render.HudFunction.Status.*;
import static Anova.modules.impl.render.HudFunction.Status.VANISHED;
import static Anova.ui.alt.AltManager.white;
import static Anova.ui.clickgui.Window.dark;
import static Anova.util.render.ColorUtil.rgba;
import static Anova.util.render.RenderUtil.Render2D.*;

/**
* @author Swoe228
* @since 23.07.2024
*/

@FunctionModule(name = "HUD", type = Category.Render)
    public class HUD2 extends Function {
    int firstColor;
    int secondColor;
    public final MultiBoxSetting elements = new MultiBoxSetting("Элементы",
            new BooleanOption("Ватермарка", true),
            new BooleanOption("Активные функции", true),
            new BooleanOption("Активный таргет", true),
            new BooleanOption("Активные стаффы", true),
            new BooleanOption("Активные бинды", true),
            new BooleanOption("Активные эффекты", true),
            new BooleanOption("Таймер", true),
            new BooleanOption("Броня",true)
    );
    public static final BooleanOption Renderutils = new BooleanOption("Невьебический рендер",false);


    List<Function> sortedFunctions = new ArrayList<>();
    TimerUtil delay = new TimerUtil();

    public HUD2() {
        addsetting(elements,Renderutils);
    }
    final float round_degree = 3;

    final float cWidth = 4;

    final Vector4f left_vec = new Vector4f(round_degree, round_degree, 0, 0);
    final Vector4f right_vec = new Vector4f(0, 0, round_degree, round_degree);

    final int b_color = new Color(0, 0, 0, 128).getRGB();
    final int t_color = Color.WHITE.getRGB();

    int[] colors = new int[360];

    final StyledFont icons = Fonts.icons1[20];
    final StyledFont medium = Fonts.msMedium[16];
    final StyledFont small = Fonts.msMedium[14];

    MainWindow window;

    List<Function> functions = new ArrayList<>();
    public Dragging potionStatus = Initilization.createDrag(this, "PotionStatus", 200, 50);
    final Dragging keyBinds = Initilization.createDrag(this, "KeyBinds-new", 10, 100);
    final Dragging staffList = Initilization.createDrag(this, "StaffList-new", 10, 200);

    private final Animation targetHudAnimation = new EaseBackIn(200, 1, 1.5f);
    final Dragging timerHUD = Initilization.createDrag(this, "TimerHUD-new", 10, 400);

    Animation tHudAnimation = new EaseBackIn(400, 1, 1.5f);
    PlayerEntity target = null;


    private final Pattern namePattern = Pattern.compile("^\\w{3,16}$");
    private final Pattern prefixMatches = Pattern.compile(".*(mod|der|stager|adm|help|wne|мод|хелп|помо|адм|владе|отри|таф|taf|curat|курато|dev|раз|supp|сапп|yt|ютуб).*");



    @Override
    public void onEventModule(Event event) {
        if (mc.player == null || mc.world == null) return;

        if (event instanceof EventUpdate) {
            staffPlayers.clear();

            for (ScorePlayerTeam team : mc.world.getScoreboard().getTeams().stream().sorted(Comparator.comparing(Team::getName)).toList()) {
                String name = team.getMembershipCollection().toString();
                name = name.substring(1, name.length() - 1);
                if (namePattern.matcher(name).matches()) {
                    if (prefixMatches.matcher(team.getPrefix().getString().toLowerCase(Locale.ROOT)).matches() || Managment.STAFF_MANAGER.isStaff(name)) {
                    }
                }
            }

            if (Managment.FUNCTION_MANAGER.getFunctions().isEmpty() || !functions.isEmpty()) return;
            updateFunctions();
        }

        if (event instanceof EventRender e && e.isRender2D()) {
            for (int i = 0; i < colors.length; i++) {
                colors[i] = Managment.STYLE_MANAGER.getCurrentStyle().getColor(i);
            }

            window = e.scaledResolution;

            final MatrixStack matrixStack = e.matrixStack;

            if (elements.get(0)) renderWatermark(matrixStack);
            if (elements.get(1)) renderArrayList(matrixStack);
            if (elements.get(2)) onRenderTargetHUD(matrixStack);
            if (elements.get(3)) onStaffListRender(matrixStack, e);
            if (elements.get(4)) onKeyBindsRender(matrixStack);
            if (elements.get(5)) renderPotions(matrixStack,e);
            if (elements.get(6))renderTimer(matrixStack);
            if (elements.get(7)) RenderArmor(e);
        }
    }

    private void renderWatermark(MatrixStack matrixStack) {
        final Vector4i colorVec = new Vector4i(
                ColorUtil.getColorStyle(0),
                ColorUtil.getColorStyle(90),
                ColorUtil.getColorStyle(180),
                ColorUtil.getColorStyle(270)
        );
        int roundDegree = 4;
        int headerHeight = 14;
        //Время
        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
        String time = now.format(formatter);
        final String title = " | " + " " + time + " " + " | " +  " " +  mc.debugFPS + " " + " | " + " " + HudUtil.calculatePing();

        final String gradientText = "anova gamma ";
        // Координаты ватермарки
        final float x = 1;
        final float y = 1;
        final float titleWidth = Fonts.gilroyBold[15].getWidth(gradientText + title) + 45;
        final float titleHeight = 18;

        drawShadow(x, y, titleWidth, titleHeight, 5, colorVec.x, colorVec.y, colorVec.w, colorVec.z);
        drawGradientRound(x, y, titleWidth, titleHeight + headerHeight + 2.5f, roundDegree, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));
        drawRoundedRect(x, y, titleWidth, titleHeight, 3, rgba(20, 20, 20, 255));

        Fonts.gilroyBold[18].drawString(matrixStack, gradientText, x + 3, y + Fonts.gilroyBold[18].getFontHeight() / 2f + 0.3f, ColorUtil.getColorStyle(255));
        Fonts.gilroyBold[18].drawString(matrixStack, title, x + Fonts.gilroyBold[18].getWidth(gradientText) + 3.5f, y + Fonts.gilroyBold[18].getFontHeight() / 2f + 0.3f, ColorUtil.getColorStyle(255));
    }
    private void RenderArmor(final EventRender renderEvent) {
        int count = 0;
        for (int i = 0; i < mc.player.inventory.getSizeInventory(); i++) {
            ItemStack s = mc.player.inventory.getStackInSlot(i);
            if (s.getItem() == Items.TOTEM_OF_UNDYING) {
                count++;
            }
        }
        float xPos = renderEvent.scaledResolution.scaledWidth() / 2f;
        float yPos = renderEvent.scaledResolution.scaledHeight();

        boolean totemInInv = mc.player.inventory.mainInventory.stream().map(ItemStack::getItem).toList().contains(Items.TOTEM_OF_UNDYING);
        int off = totemInInv ? +5 : 0;
        if (mc.player.isCreative()) {
            yPos += 17;
        }

        for (ItemStack s : mc.player.inventory.armorInventory) {
            ESPFunction.drawItemStack(s, xPos - off + 74 * (mc.gameSettings.guiScale / 2f), yPos - 56 * (mc.gameSettings.guiScale / 2f), null, false);
            off += 15;
        }
        if (totemInInv)
            ESPFunction.drawItemStack(new ItemStack(Items.TOTEM_OF_UNDYING), xPos - off + 73 * (mc.gameSettings.guiScale / 2f), yPos - 56 * (mc.gameSettings.guiScale / 2f), String.valueOf(count), false);


    }
    int fontSize = 18;




    private void renderArrayList(MatrixStack stack) {
        float x = 1;
        float y = 25;
        float height = 10;
        float yOffset = 0;

        final StyledFont font = Fonts.gilroyBold[fontSize];
        StyleManager styleManager = Managment.STYLE_MANAGER;

        if (delay.hasTimeElapsed(10000)) {
            sortedFunctions = HudUtil.getSorted(font);
            delay.reset();
        }

        float gradientForce = 1;
        int fontOffset = (fontSize > 14 ? -14 + fontSize
                - (fontSize > 14 ? 1 : 0) : 0);
        int firstColor;
        int secondColor;

        for (Function function : sortedFunctions) {
            function.animation = AnimationMath.lerp(function.animation, function.state ? 1 : 0, 15);
            if (function.animation >= 0.01) {
                float width = font.getWidth(function.name) + 5;
                firstColor = styleManager.getCurrentStyle()
                        .getColor((int) ((yOffset + height * function.animation) * gradientForce));
                secondColor = styleManager.getCurrentStyle()
                        .getColor((int) (yOffset * gradientForce));
                RenderSystem.pushMatrix();
                RenderSystem.translatef(x + width / 2F, y + yOffset, 0);
                RenderSystem.scalef(1, function.animation, 1);
                RenderSystem.translatef(-(x + width / 2F), -(y + yOffset), 0);
                drawShadow(x, y + yOffset, width, height, 10, firstColor, secondColor);
                RenderSystem.popMatrix();
                yOffset += height * function.animation;
            }
        }
        yOffset = 0;
        for (Function function : sortedFunctions) {
            function.animation = AnimationMath.lerp(function.animation, function.state ? 1 : 0, 15);

            if (function.animation >= 0.01) {
                float width = font.getWidth(function.name) + 5;
                secondColor = styleManager.getCurrentStyle()
                        .getColor((int) (yOffset * gradientForce));

                RenderSystem.pushMatrix();
                RenderSystem.translatef(x + width / 2F, y + yOffset, 0);
                RenderSystem.scalef(1, function.animation, 1);
                RenderSystem.translatef(-(x + width / 2F), -(y + yOffset), 0);
                RenderUtil.Render2D.drawRect(x, y + yOffset, width, height, rgba(21, 21, 21, 200));
                font.drawString(stack, function.name, x + 3,
                        y + yOffset + font.getFontHeight() / 2f - fontOffset - 1, secondColor);
                RenderSystem.popMatrix();

                yOffset += height * function.animation;
            }
        }
        yOffset = 0;
        for (Function function : sortedFunctions) {
            function.animation = AnimationMath.lerp(function.animation, function.state ? 1 : 0, 15);
            if (function.animation >= 0.01) {
                float width = font.getWidth(function.name) + 4;
                firstColor = styleManager.getCurrentStyle()
                        .getColor((int) ((yOffset + height * function.animation) * gradientForce));
                secondColor = styleManager.getCurrentStyle()
                        .getColor((int) (yOffset * gradientForce));

                RenderSystem.pushMatrix();
                RenderSystem.translatef(x + width / 2F, y + yOffset, 0);
                RenderSystem.scalef(1, function.animation, 1);
                RenderSystem.translatef(-(x + width / 2F), -(y + yOffset), 0);
                RenderUtil.Render2D.drawShadow(x, y + yOffset, 1, height, 8, firstColor, secondColor);
                RenderUtil.Render2D.drawVertical(x, y + yOffset, 1, height, firstColor, secondColor);
                RenderSystem.popMatrix();

                yOffset += height * function.animation;
            }
        }
    }


    private float hDynamic = 0;
    private int activePotions = 0;
    private void renderPotions(final MatrixStack matrixStack, final EventRender renderEvent) {
        float posX = potionStatus.getX();
        float posY = potionStatus.getY();

        int roundDegree = 4;
        int headerHeight = 14;
        int width = 100;
        int padding = 5;
        int offset = 10;

        int headerColor = new Color(30, 30, 30, 200).getRGB();
        int backgroundColor = new Color(40, 40, 40, 230).getRGB();

        int firstColor = ColorUtil.getColorStyle(0);
        int secondColor = ColorUtil.getColorStyle(90);

        float height = activePotions * offset;

        this.hDynamic = AnimationMath.fast(this.hDynamic, height, 15);

        RenderUtil.Render2D.drawShadow(posX, posY, width, headerHeight + hDynamic + padding / 2f, 10, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawGradientRound(posX, posY, width, hDynamic + headerHeight + 2.5f, roundDegree, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawRoundedCorner(potionStatus.getX(), posY, width, headerHeight, new Vector4f(roundDegree, 0, roundDegree, 0), headerColor);
        Fonts.gilroyBold[18].drawCenteredString(matrixStack, ClientUtil.gradient("active potions", firstColor, secondColor), potionStatus.getX() + width / 2f, posY + 5.5f, firstColor);

        RenderUtil.Render2D.drawRoundedCorner(posX, posY + headerHeight, width, hDynamic + padding / 2f, new Vector4f(0, roundDegree, 0, roundDegree), backgroundColor);
        RenderUtil.SmartScissor.push();
        RenderUtil.SmartScissor.setFromComponentCoordinates(posX, posY, width, headerHeight + hDynamic + padding / 2f);
        int index = 0;

        for (EffectInstance p : mc.player.getActivePotionEffects()) {
            if (p.isShowIcon()) {

                String durationText = EffectUtils.getPotionDurationString(p, 1);
                float durationWidth = Fonts.gilroyBold[12].getWidth(durationText);

                Fonts.gilroyBold[18].drawString(matrixStack, I18n.format(p.getEffectName()), posX + padding - 2, posY + headerHeight + padding + (index * offset), ColorUtil.getColorStyle(255));
                Fonts.gilroyBold[18].drawString(matrixStack, durationText, posX + width - durationWidth - padding - 2, posY + headerHeight + padding + (index * offset), ColorUtil.getColorStyle(255));

                index++;
            }
        }
        RenderUtil.SmartScissor.unset();
        RenderUtil.SmartScissor.pop();
        activePotions = index;

        potionStatus.setWidth(width);
        potionStatus.setHeight(activePotions * offset + headerHeight);
    }
    private float heightDynamic = 0;
    float kbHeight = 0;
    float kbWidth = 100;
    float yOffset = 5;
    float height = 5;
    float kbHeightAnimation = 0;
    int fontOffset = (fontSize > 18 ? -18 + fontSize - (fontSize > 18 ? 1 : 0) : 0);
    float kbWidthAnimation = 0;

    private int activeModules = 0;

    private void onKeyBindsRender(MatrixStack stack) {
        float posX = keyBinds.getX();
        float posY = keyBinds.getY();

        int roundDegree = 4;//Нужная залупа
        int headerHeight = 14;//Нужная залупа
        int width = 100;//Нужная залупа
        int padding = 5;//Нужная залупа
        int offset = 10;//Нужная залупа

        int headerColor = new Color(30, 30, 30, 200).getRGB();//Цвета
        int backgroundColor = new Color(40, 40, 40, 230).getRGB();//Цвета

        int firstColor = ColorUtil.getColorStyle(0);//Цвета
        int secondColor = ColorUtil.getColorStyle(90);//Цвета

        float height = activeModules * offset;

        this.heightDynamic = AnimationMath.fast(this.heightDynamic, height, 10);

        RenderUtil.Render2D.drawShadow(posX, posY, width, headerHeight + heightDynamic + padding / 2f, 10, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawGradientRound(posX, posY, width, heightDynamic + headerHeight + 2.5f, roundDegree - 1, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawRoundedCorner(keyBinds.getX(), posY, width, headerHeight, new Vector4f(roundDegree, 0, roundDegree, 0), headerColor);
        Fonts.gilroyBold[18].drawCenteredString(stack, ClientUtil.gradient("key bind", firstColor, secondColor), keyBinds.getX() + width / 2f, posY + 5.5f, firstColor);//Текст

        RenderUtil.Render2D.drawRoundedCorner(posX, posY + headerHeight, width, heightDynamic + padding / 2f, new Vector4f(0, roundDegree, 0, roundDegree), backgroundColor);
        RenderUtil.SmartScissor.push();
        RenderUtil.SmartScissor.setFromComponentCoordinates(posX, posY, width, headerHeight + heightDynamic + padding / 2f);
        int index = 0;

        for (Function f : Managment.FUNCTION_MANAGER.getFunctions()) {
            if (f.bind != 0 && f.state) {

                String text = ClientUtil.getKey(f.bind);

                if (text == null) {
                    continue;
                }


                String bindText = "[" + text.toUpperCase() + "]";
                float bindWidth = Fonts.gilroyBold[12].getWidth(bindText);

                Fonts.gilroyBold[18].drawString(stack, f.name, posX + padding -1, posY + headerHeight + padding + (index * offset)- 1, ColorUtil.getColorStyle(255));
                Fonts.gilroyBold[18].drawString(stack, bindText, posX + width - bindWidth - padding - 1, posY + headerHeight + padding + (index * offset) - 1, ColorUtil.getColorStyle(255));

                index++;
            }
        }
        RenderUtil.SmartScissor.unset();
        RenderUtil.SmartScissor.pop();
        activeModules = index;

        keyBinds.setWidth(width);
        keyBinds.setHeight(activeModules * offset + headerHeight);
    }





    private int activeStaff = 0;
    private float hDynam = 0;
    private float widthDynamic = 0;
    private float nameWidth = 0;
    List<HUD2.StaffPlayer> staffPlayers = new ArrayList<>();
    private void onStaffListRender(MatrixStack matrixStack, EventRender render) {
        float posX = staffList.getX();
        float posY = staffList.getY();

        int roundDegree = 4;
        int headerHeight = 14;
        float width = Math.max(nameWidth + 40, 100);
        int padding = 5;
        int offset = 10;

        int headerColor = new Color(30, 30, 30, 200).getRGB();
        int backgroundColor = new Color(35, 35, 35, 230).getRGB();

        int firstColor = ColorUtil.getColorStyle(0);
        int secondColor = ColorUtil.getColorStyle(90);
        float height = activeStaff * offset;

        this.hDynam = AnimationMath.fast(this.hDynam, height, 10);
        this.widthDynamic = AnimationMath.fast(this.widthDynamic, width, 10);
        RenderUtil.Render2D.drawShadow(posX, posY, widthDynamic, headerHeight + hDynam + padding / 2f, 10, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawGradientRound(posX, posY, widthDynamic, hDynam + headerHeight + 2.5f, roundDegree - 1, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawRoundedCorner(posX, posY, widthDynamic, headerHeight, new Vector4f(roundDegree, 0, roundDegree, 0), headerColor);
        Fonts.gilroyBold[18].drawCenteredString(matrixStack, ClientUtil.gradient("staff list", firstColor, secondColor), posX + widthDynamic / 2f, posY + 5.5f, ColorUtil.getColorStyle(255));

        RenderUtil.Render2D.drawRoundedCorner(posX, posY + headerHeight, widthDynamic, hDynam + padding / 2f, new Vector4f(0, roundDegree, 0, roundDegree), backgroundColor);

        int index = 0;

        SmartScissor.push();
        SmartScissor.setFromComponentCoordinates(posX, posY, widthDynamic, headerHeight + hDynam + padding / 2f);
        if (!staffPlayers.isEmpty()) {
            for (HUD2.StaffPlayer staff : staffPlayers) {
                String name = staff.getName();
                ITextComponent prefix = staff.getPrefix();
                String status = staff.getStatus().getString();

                Fonts.gilroyBold[12].drawString(matrixStack, prefix, posX + padding, posY + headerHeight + padding + (index * offset), -1);
                Fonts.gilroyBold[12].drawString(matrixStack, name + status, posX + padding + Fonts.gilroyBold[12].getWidth(prefix.getString()), posY + headerHeight + padding + (index * offset), -1);
                nameWidth = Fonts.gilroyBold[12].getWidth(prefix.getString() + name + status);
                index++;
            }
        } else {
            nameWidth = 0;
        }
        SmartScissor.unset();
        SmartScissor.pop();

        activeStaff = index;
        staffList.setWidth(widthDynamic);
        staffList.setHeight(hDynam + headerHeight);
    }
    private class StaffPlayer {

        @Getter
        String name;
        @Getter
        ITextComponent prefix;
        @Getter
        HudFunction.Status status;

        private StaffPlayer(String name, ITextComponent prefix) {
            this.name = name;
            this.prefix = prefix;

            updateStatus();
        }

        private void updateStatus() {
            for (AbstractClientPlayerEntity player : mc.world.getPlayers()) {
                if (player.getNameClear().equals(name)) {
                    status = NEAR;
                    return;
                }
            }

            for (NetworkPlayerInfo info : mc.getConnection().getPlayerInfoMap()) {
                if (info.getGameProfile().getName().equals(name)) {
                    if (info.getGameType() == GameType.SPECTATOR) {
                        status = SPEC;
                        return;
                    }

                    status = NONE;
                    return;
                }
            }

            status = VANISHED;
        }
    }
    public final Dragging targetHUD = Initilization.createDrag(this, "TargetHUD", 500, 50);
    private float health = 0;
    private double scale = 0.0D;

    private void onRenderTargetHUD(final MatrixStack stack) {
        this.target = getTarget(this.target);
        this.targetHudAnimation.setDuration(300);
        this.scale = targetHudAnimation.getOutput();
        if (scale == 0.0F) {
            target = null;
        }
        if (target == null) {
            return;
        }
        final String targetName = this.target.getName().getString();

        String substring = targetName.substring(0, Math.min(targetName.length(), 10));//Нужная залупа
        final float nameWidth = Fonts.gilroyBold[18].getWidth(substring);//Нужная залупа
        final float xPosition = this.targetHUD.getX();//Нужная залупа
        final float yPosition = this.targetHUD.getY();//Нужная залупа
        final float maxWidth = Math.max(nameWidth + 50, 120);//Нужная залупа
        final float maxHeight = 30;//Нужная залупа

        this.health = AnimationMath.fast(health, target.getHealth() / target.getMaxHealth(), 5);//Типо должна быть анимация
        this.health = MathHelper.clamp(this.health, 0, 1);//Типо должна быть анимация

        GlStateManager.pushMatrix();
        AnimationMath.sizeAnimation(xPosition + (maxWidth / 2), yPosition + (maxHeight / 2), scale);

        Vector2i colorVec = new Vector2i(ColorUtil.getColorStyle(0), ColorUtil.getColorStyle(90));

        RenderUtil.Render2D.drawShadow(xPosition, yPosition, maxWidth, maxHeight, 10, colorVec.x, colorVec.y, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawGradientRound(xPosition, yPosition, maxWidth, maxHeight, 3, colorVec.x, colorVec.y, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawRoundedRect(xPosition, yPosition, maxWidth, maxHeight, 2.5f, rgba(21, 21, 21, 200));
        drawFace(xPosition + 4, yPosition + 3.25f, 8F, 8F, 8F, 8F, 24, 24, 64F, 64F, (AbstractClientPlayerEntity) target);//Ебло чела
        drawCircle(
                xPosition + maxWidth - 15, // X-координата
                yPosition + maxHeight / 2, // Y-координата
                12.0f,                     // Радиус круга
                4.0f,                      // Ширина линии
                false,                     // Не заполненный круг
                ColorUtil.getColorStyle(255), // Цвет
                360                        // Количество сегментов
        );



        drawItemStack(xPosition + 32, yPosition + 22 - 5.5f, 10);

        Fonts.gilroyBold[18].drawString(stack, substring, xPosition + maxWidth - 90, yPosition + 6, -1);//Ник

        String healthValue = (int) MathUtil.round(this.health * 20 + target.getAbsorptionAmount(), 0.5f) + "";
        Fonts.gilroyBold[18].drawCenteredString(stack, healthValue, xPosition + maxWidth - 15, yPosition + maxHeight / 2 - 2.2f, ColorUtil.rgba(255, 255, 255, 255));//Hp
        GlStateManager.popMatrix();
        this.targetHUD.setWidth(maxWidth);
        this.targetHUD.setHeight(maxHeight);
    }




    private void drawItemStack(float x, float y, float offset) {
        List<ItemStack> stackList = new ArrayList<>(Arrays.asList(target.getHeldItemMainhand(), target.getHeldItemOffhand()));
        stackList.addAll((Collection<? extends ItemStack>) target.getArmorInventoryList());

        final AtomicReference<Float> posX = new AtomicReference<>(x);

        stackList.stream()
                .filter(stack -> !stack.isEmpty())
                .forEach(stack -> HudUtil.drawItemStack(stack,
                        posX.getAndAccumulate(offset, Float::sum),
                        y,
                        true,
                        true, 0.6f));
    }

    private float perc;

    private void renderTimer(MatrixStack matrixStack) {
        float posX = timerHUD.getX();
        float posY = timerHUD.getY();
        int firstColor = ColorUtil.getColorStyle(0);
        int secondColor = ColorUtil.getColorStyle(90);

        float quotient = Managment.FUNCTION_MANAGER.timerFunction.maxViolation / Managment.FUNCTION_MANAGER.timerFunction.timerAmount.getValue().floatValue();
        float minimumValue = Math.min(Managment.FUNCTION_MANAGER.timerFunction.getViolation(), quotient);
        perc = AnimationMath.lerp(perc, ((quotient - minimumValue) / quotient), 10);

        String text = (int) (perc * 100) + "%";
        float width = 80;
        int width2 = 70;
        timerHUD.setWidth(width);
        timerHUD.setHeight(20);
        RenderUtil.Render2D.drawShadow(posX, posY, width, 27, 10, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));
        RenderUtil.Render2D.drawGradientRound(posX - 0.25f, posY - 0.25f, width + 0.25f, 27 + 0.25f, 3, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));
        RenderUtil.Render2D.drawRoundedRect(posX, posY, width, 27,3, RenderUtil.reAlphaInt(ColorUtil.rgba(15, 15, 15, 255), 170));

        medium.drawString(matrixStack, "Timer", posX + 27.5, posY + 6, ColorUtil.getColorStyle(255));

        RenderUtil.Render2D.drawGradientRound(posX + 5f, posY + 24 - 8, width2 * perc, 7,1, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));
        medium.drawString(matrixStack, text, posX + width - medium.getWidth(text) - 3 - 27, posY + 17.5, t_color);
    }

    private PlayerEntity getTarget(PlayerEntity nullTarget) {
        PlayerEntity target = nullTarget;

        if (Managment.FUNCTION_MANAGER.auraFunction.getTarget() instanceof PlayerEntity) {
            target = (PlayerEntity) Managment.FUNCTION_MANAGER.auraFunction.getTarget();
            tHudAnimation.setDirection(Direction.FORWARDS);
        } else if (mc.currentScreen instanceof ChatScreen) {
            target = mc.player;
            tHudAnimation.setDirection(Direction.FORWARDS);
        } else {
            tHudAnimation.setDirection(Direction.BACKWARDS);
        }

        return target;
    }

    private void updateFunctions() {
        for (Function function : Managment.FUNCTION_MANAGER.getFunctions()) {
            if (function.category == Category.Render) continue;

            functions.add(function);
        }

        functions.sort((f1, f2) -> Float.compare(small.getWidth(f2.name), small.getWidth(f1.name)));
    }

    private int getColor(int index) {
        return colors[index % colors.length];
    }
}
Ничего топового я тут не увидел
 
Начинающий
Статус
Оффлайн
Регистрация
12 Фев 2023
Сообщения
24
Реакции[?]
0
Поинты[?]
1K
Доделанный худ из HudFunction в expensive 2.0
Посмотреть вложение 282407

Код:
package Anova.modules.impl.render;

import Anova.modules.settings.imp.ModeSetting;
import Anova.ui.midnight.StyleManager;
import Anova.util.misc.TimerUtil;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import lombok.Getter;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.network.play.NetworkPlayerInfo;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.AirItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Team;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.GameType;
import org.joml.Vector2i;
import org.joml.Vector4i;
import org.lwjgl.opengl.GL11;
import Anova.Initilization;
import Anova.events.Event;
import Anova.events.impl.player.EventUpdate;
import Anova.events.impl.render.EventRender;
import Anova.managment.Managment;
import Anova.modules.Function;
import Anova.modules.FunctionModule;
import Anova.modules.Category;
import Anova.modules.settings.imp.BooleanOption;
import Anova.modules.settings.imp.MultiBoxSetting;
import Anova.modules.settings.imp.SliderSetting;
import Anova.util.ClientUtil;
import Anova.util.animations.Animation;
import Anova.util.animations.Direction;
import Anova.util.animations.impl.EaseBackIn;
import Anova.util.drag.Dragging;
import Anova.util.font.Fonts;
import Anova.util.font.styled.StyledFont;
import Anova.util.math.MathUtil;
import Anova.util.misc.HudUtil;
import Anova.util.render.BloomHelper;
import Anova.util.render.ColorUtil;
import Anova.util.render.RenderUtil;
import Anova.util.render.animation.AnimationMath;
import Anova.util.render.RenderUtil.SmartScissor;

import java.awt.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;
import java.text.SimpleDateFormat;
import java.util.Date;

import static Anova.modules.impl.render.HudFunction.Status.*;
import static Anova.modules.impl.render.HudFunction.Status.VANISHED;
import static Anova.ui.alt.AltManager.white;
import static Anova.ui.clickgui.Window.dark;
import static Anova.util.render.ColorUtil.rgba;
import static Anova.util.render.RenderUtil.Render2D.*;

/**
* @author Swoe228
* @since 23.07.2024
*/

@FunctionModule(name = "HUD", type = Category.Render)
    public class HUD2 extends Function {
    int firstColor;
    int secondColor;
    public final MultiBoxSetting elements = new MultiBoxSetting("Элементы",
            new BooleanOption("Ватермарка", true),
            new BooleanOption("Активные функции", true),
            new BooleanOption("Активный таргет", true),
            new BooleanOption("Активные стаффы", true),
            new BooleanOption("Активные бинды", true),
            new BooleanOption("Активные эффекты", true),
            new BooleanOption("Таймер", true),
            new BooleanOption("Броня",true)
    );
    public static final BooleanOption Renderutils = new BooleanOption("Невьебический рендер",false);


    List<Function> sortedFunctions = new ArrayList<>();
    TimerUtil delay = new TimerUtil();

    public HUD2() {
        addsetting(elements,Renderutils);
    }
    final float round_degree = 3;

    final float cWidth = 4;

    final Vector4f left_vec = new Vector4f(round_degree, round_degree, 0, 0);
    final Vector4f right_vec = new Vector4f(0, 0, round_degree, round_degree);

    final int b_color = new Color(0, 0, 0, 128).getRGB();
    final int t_color = Color.WHITE.getRGB();

    int[] colors = new int[360];

    final StyledFont icons = Fonts.icons1[20];
    final StyledFont medium = Fonts.msMedium[16];
    final StyledFont small = Fonts.msMedium[14];

    MainWindow window;

    List<Function> functions = new ArrayList<>();
    public Dragging potionStatus = Initilization.createDrag(this, "PotionStatus", 200, 50);
    final Dragging keyBinds = Initilization.createDrag(this, "KeyBinds-new", 10, 100);
    final Dragging staffList = Initilization.createDrag(this, "StaffList-new", 10, 200);

    private final Animation targetHudAnimation = new EaseBackIn(200, 1, 1.5f);
    final Dragging timerHUD = Initilization.createDrag(this, "TimerHUD-new", 10, 400);

    Animation tHudAnimation = new EaseBackIn(400, 1, 1.5f);
    PlayerEntity target = null;


    private final Pattern namePattern = Pattern.compile("^\\w{3,16}$");
    private final Pattern prefixMatches = Pattern.compile(".*(mod|der|stager|adm|help|wne|мод|хелп|помо|адм|владе|отри|таф|taf|curat|курато|dev|раз|supp|сапп|yt|ютуб).*");



    @Override
    public void onEventModule(Event event) {
        if (mc.player == null || mc.world == null) return;

        if (event instanceof EventUpdate) {
            staffPlayers.clear();

            for (ScorePlayerTeam team : mc.world.getScoreboard().getTeams().stream().sorted(Comparator.comparing(Team::getName)).toList()) {
                String name = team.getMembershipCollection().toString();
                name = name.substring(1, name.length() - 1);
                if (namePattern.matcher(name).matches()) {
                    if (prefixMatches.matcher(team.getPrefix().getString().toLowerCase(Locale.ROOT)).matches() || Managment.STAFF_MANAGER.isStaff(name)) {
                    }
                }
            }

            if (Managment.FUNCTION_MANAGER.getFunctions().isEmpty() || !functions.isEmpty()) return;
            updateFunctions();
        }

        if (event instanceof EventRender e && e.isRender2D()) {
            for (int i = 0; i < colors.length; i++) {
                colors[i] = Managment.STYLE_MANAGER.getCurrentStyle().getColor(i);
            }

            window = e.scaledResolution;

            final MatrixStack matrixStack = e.matrixStack;

            if (elements.get(0)) renderWatermark(matrixStack);
            if (elements.get(1)) renderArrayList(matrixStack);
            if (elements.get(2)) onRenderTargetHUD(matrixStack);
            if (elements.get(3)) onStaffListRender(matrixStack, e);
            if (elements.get(4)) onKeyBindsRender(matrixStack);
            if (elements.get(5)) renderPotions(matrixStack,e);
            if (elements.get(6))renderTimer(matrixStack);
            if (elements.get(7)) RenderArmor(e);
        }
    }

    private void renderWatermark(MatrixStack matrixStack) {
        final Vector4i colorVec = new Vector4i(
                ColorUtil.getColorStyle(0),
                ColorUtil.getColorStyle(90),
                ColorUtil.getColorStyle(180),
                ColorUtil.getColorStyle(270)
        );
        int roundDegree = 4;
        int headerHeight = 14;
        //Время
        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
        String time = now.format(formatter);
        final String title = " | " + " " + time + " " + " | " +  " " +  mc.debugFPS + " " + " | " + " " + HudUtil.calculatePing();

        final String gradientText = "anova gamma ";
        // Координаты ватермарки
        final float x = 1;
        final float y = 1;
        final float titleWidth = Fonts.gilroyBold[15].getWidth(gradientText + title) + 45;
        final float titleHeight = 18;

        drawShadow(x, y, titleWidth, titleHeight, 5, colorVec.x, colorVec.y, colorVec.w, colorVec.z);
        drawGradientRound(x, y, titleWidth, titleHeight + headerHeight + 2.5f, roundDegree, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));
        drawRoundedRect(x, y, titleWidth, titleHeight, 3, rgba(20, 20, 20, 255));

        Fonts.gilroyBold[18].drawString(matrixStack, gradientText, x + 3, y + Fonts.gilroyBold[18].getFontHeight() / 2f + 0.3f, ColorUtil.getColorStyle(255));
        Fonts.gilroyBold[18].drawString(matrixStack, title, x + Fonts.gilroyBold[18].getWidth(gradientText) + 3.5f, y + Fonts.gilroyBold[18].getFontHeight() / 2f + 0.3f, ColorUtil.getColorStyle(255));
    }
    private void RenderArmor(final EventRender renderEvent) {
        int count = 0;
        for (int i = 0; i < mc.player.inventory.getSizeInventory(); i++) {
            ItemStack s = mc.player.inventory.getStackInSlot(i);
            if (s.getItem() == Items.TOTEM_OF_UNDYING) {
                count++;
            }
        }
        float xPos = renderEvent.scaledResolution.scaledWidth() / 2f;
        float yPos = renderEvent.scaledResolution.scaledHeight();

        boolean totemInInv = mc.player.inventory.mainInventory.stream().map(ItemStack::getItem).toList().contains(Items.TOTEM_OF_UNDYING);
        int off = totemInInv ? +5 : 0;
        if (mc.player.isCreative()) {
            yPos += 17;
        }

        for (ItemStack s : mc.player.inventory.armorInventory) {
            ESPFunction.drawItemStack(s, xPos - off + 74 * (mc.gameSettings.guiScale / 2f), yPos - 56 * (mc.gameSettings.guiScale / 2f), null, false);
            off += 15;
        }
        if (totemInInv)
            ESPFunction.drawItemStack(new ItemStack(Items.TOTEM_OF_UNDYING), xPos - off + 73 * (mc.gameSettings.guiScale / 2f), yPos - 56 * (mc.gameSettings.guiScale / 2f), String.valueOf(count), false);


    }
    int fontSize = 18;




    private void renderArrayList(MatrixStack stack) {
        float x = 1;
        float y = 25;
        float height = 10;
        float yOffset = 0;

        final StyledFont font = Fonts.gilroyBold[fontSize];
        StyleManager styleManager = Managment.STYLE_MANAGER;

        if (delay.hasTimeElapsed(10000)) {
            sortedFunctions = HudUtil.getSorted(font);
            delay.reset();
        }

        float gradientForce = 1;
        int fontOffset = (fontSize > 14 ? -14 + fontSize
                - (fontSize > 14 ? 1 : 0) : 0);
        int firstColor;
        int secondColor;

        for (Function function : sortedFunctions) {
            function.animation = AnimationMath.lerp(function.animation, function.state ? 1 : 0, 15);
            if (function.animation >= 0.01) {
                float width = font.getWidth(function.name) + 5;
                firstColor = styleManager.getCurrentStyle()
                        .getColor((int) ((yOffset + height * function.animation) * gradientForce));
                secondColor = styleManager.getCurrentStyle()
                        .getColor((int) (yOffset * gradientForce));
                RenderSystem.pushMatrix();
                RenderSystem.translatef(x + width / 2F, y + yOffset, 0);
                RenderSystem.scalef(1, function.animation, 1);
                RenderSystem.translatef(-(x + width / 2F), -(y + yOffset), 0);
                drawShadow(x, y + yOffset, width, height, 10, firstColor, secondColor);
                RenderSystem.popMatrix();
                yOffset += height * function.animation;
            }
        }
        yOffset = 0;
        for (Function function : sortedFunctions) {
            function.animation = AnimationMath.lerp(function.animation, function.state ? 1 : 0, 15);

            if (function.animation >= 0.01) {
                float width = font.getWidth(function.name) + 5;
                secondColor = styleManager.getCurrentStyle()
                        .getColor((int) (yOffset * gradientForce));

                RenderSystem.pushMatrix();
                RenderSystem.translatef(x + width / 2F, y + yOffset, 0);
                RenderSystem.scalef(1, function.animation, 1);
                RenderSystem.translatef(-(x + width / 2F), -(y + yOffset), 0);
                RenderUtil.Render2D.drawRect(x, y + yOffset, width, height, rgba(21, 21, 21, 200));
                font.drawString(stack, function.name, x + 3,
                        y + yOffset + font.getFontHeight() / 2f - fontOffset - 1, secondColor);
                RenderSystem.popMatrix();

                yOffset += height * function.animation;
            }
        }
        yOffset = 0;
        for (Function function : sortedFunctions) {
            function.animation = AnimationMath.lerp(function.animation, function.state ? 1 : 0, 15);
            if (function.animation >= 0.01) {
                float width = font.getWidth(function.name) + 4;
                firstColor = styleManager.getCurrentStyle()
                        .getColor((int) ((yOffset + height * function.animation) * gradientForce));
                secondColor = styleManager.getCurrentStyle()
                        .getColor((int) (yOffset * gradientForce));

                RenderSystem.pushMatrix();
                RenderSystem.translatef(x + width / 2F, y + yOffset, 0);
                RenderSystem.scalef(1, function.animation, 1);
                RenderSystem.translatef(-(x + width / 2F), -(y + yOffset), 0);
                RenderUtil.Render2D.drawShadow(x, y + yOffset, 1, height, 8, firstColor, secondColor);
                RenderUtil.Render2D.drawVertical(x, y + yOffset, 1, height, firstColor, secondColor);
                RenderSystem.popMatrix();

                yOffset += height * function.animation;
            }
        }
    }


    private float hDynamic = 0;
    private int activePotions = 0;
    private void renderPotions(final MatrixStack matrixStack, final EventRender renderEvent) {
        float posX = potionStatus.getX();
        float posY = potionStatus.getY();

        int roundDegree = 4;
        int headerHeight = 14;
        int width = 100;
        int padding = 5;
        int offset = 10;

        int headerColor = new Color(30, 30, 30, 200).getRGB();
        int backgroundColor = new Color(40, 40, 40, 230).getRGB();

        int firstColor = ColorUtil.getColorStyle(0);
        int secondColor = ColorUtil.getColorStyle(90);

        float height = activePotions * offset;

        this.hDynamic = AnimationMath.fast(this.hDynamic, height, 15);

        RenderUtil.Render2D.drawShadow(posX, posY, width, headerHeight + hDynamic + padding / 2f, 10, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawGradientRound(posX, posY, width, hDynamic + headerHeight + 2.5f, roundDegree, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawRoundedCorner(potionStatus.getX(), posY, width, headerHeight, new Vector4f(roundDegree, 0, roundDegree, 0), headerColor);
        Fonts.gilroyBold[18].drawCenteredString(matrixStack, ClientUtil.gradient("active potions", firstColor, secondColor), potionStatus.getX() + width / 2f, posY + 5.5f, firstColor);

        RenderUtil.Render2D.drawRoundedCorner(posX, posY + headerHeight, width, hDynamic + padding / 2f, new Vector4f(0, roundDegree, 0, roundDegree), backgroundColor);
        RenderUtil.SmartScissor.push();
        RenderUtil.SmartScissor.setFromComponentCoordinates(posX, posY, width, headerHeight + hDynamic + padding / 2f);
        int index = 0;

        for (EffectInstance p : mc.player.getActivePotionEffects()) {
            if (p.isShowIcon()) {

                String durationText = EffectUtils.getPotionDurationString(p, 1);
                float durationWidth = Fonts.gilroyBold[12].getWidth(durationText);

                Fonts.gilroyBold[18].drawString(matrixStack, I18n.format(p.getEffectName()), posX + padding - 2, posY + headerHeight + padding + (index * offset), ColorUtil.getColorStyle(255));
                Fonts.gilroyBold[18].drawString(matrixStack, durationText, posX + width - durationWidth - padding - 2, posY + headerHeight + padding + (index * offset), ColorUtil.getColorStyle(255));

                index++;
            }
        }
        RenderUtil.SmartScissor.unset();
        RenderUtil.SmartScissor.pop();
        activePotions = index;

        potionStatus.setWidth(width);
        potionStatus.setHeight(activePotions * offset + headerHeight);
    }
    private float heightDynamic = 0;
    float kbHeight = 0;
    float kbWidth = 100;
    float yOffset = 5;
    float height = 5;
    float kbHeightAnimation = 0;
    int fontOffset = (fontSize > 18 ? -18 + fontSize - (fontSize > 18 ? 1 : 0) : 0);
    float kbWidthAnimation = 0;

    private int activeModules = 0;

    private void onKeyBindsRender(MatrixStack stack) {
        float posX = keyBinds.getX();
        float posY = keyBinds.getY();

        int roundDegree = 4;//Нужная залупа
        int headerHeight = 14;//Нужная залупа
        int width = 100;//Нужная залупа
        int padding = 5;//Нужная залупа
        int offset = 10;//Нужная залупа

        int headerColor = new Color(30, 30, 30, 200).getRGB();//Цвета
        int backgroundColor = new Color(40, 40, 40, 230).getRGB();//Цвета

        int firstColor = ColorUtil.getColorStyle(0);//Цвета
        int secondColor = ColorUtil.getColorStyle(90);//Цвета

        float height = activeModules * offset;

        this.heightDynamic = AnimationMath.fast(this.heightDynamic, height, 10);

        RenderUtil.Render2D.drawShadow(posX, posY, width, headerHeight + heightDynamic + padding / 2f, 10, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawGradientRound(posX, posY, width, heightDynamic + headerHeight + 2.5f, roundDegree - 1, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawRoundedCorner(keyBinds.getX(), posY, width, headerHeight, new Vector4f(roundDegree, 0, roundDegree, 0), headerColor);
        Fonts.gilroyBold[18].drawCenteredString(stack, ClientUtil.gradient("key bind", firstColor, secondColor), keyBinds.getX() + width / 2f, posY + 5.5f, firstColor);//Текст

        RenderUtil.Render2D.drawRoundedCorner(posX, posY + headerHeight, width, heightDynamic + padding / 2f, new Vector4f(0, roundDegree, 0, roundDegree), backgroundColor);
        RenderUtil.SmartScissor.push();
        RenderUtil.SmartScissor.setFromComponentCoordinates(posX, posY, width, headerHeight + heightDynamic + padding / 2f);
        int index = 0;

        for (Function f : Managment.FUNCTION_MANAGER.getFunctions()) {
            if (f.bind != 0 && f.state) {

                String text = ClientUtil.getKey(f.bind);

                if (text == null) {
                    continue;
                }


                String bindText = "[" + text.toUpperCase() + "]";
                float bindWidth = Fonts.gilroyBold[12].getWidth(bindText);

                Fonts.gilroyBold[18].drawString(stack, f.name, posX + padding -1, posY + headerHeight + padding + (index * offset)- 1, ColorUtil.getColorStyle(255));
                Fonts.gilroyBold[18].drawString(stack, bindText, posX + width - bindWidth - padding - 1, posY + headerHeight + padding + (index * offset) - 1, ColorUtil.getColorStyle(255));

                index++;
            }
        }
        RenderUtil.SmartScissor.unset();
        RenderUtil.SmartScissor.pop();
        activeModules = index;

        keyBinds.setWidth(width);
        keyBinds.setHeight(activeModules * offset + headerHeight);
    }





    private int activeStaff = 0;
    private float hDynam = 0;
    private float widthDynamic = 0;
    private float nameWidth = 0;
    List<HUD2.StaffPlayer> staffPlayers = new ArrayList<>();
    private void onStaffListRender(MatrixStack matrixStack, EventRender render) {
        float posX = staffList.getX();
        float posY = staffList.getY();

        int roundDegree = 4;
        int headerHeight = 14;
        float width = Math.max(nameWidth + 40, 100);
        int padding = 5;
        int offset = 10;

        int headerColor = new Color(30, 30, 30, 200).getRGB();
        int backgroundColor = new Color(35, 35, 35, 230).getRGB();

        int firstColor = ColorUtil.getColorStyle(0);
        int secondColor = ColorUtil.getColorStyle(90);
        float height = activeStaff * offset;

        this.hDynam = AnimationMath.fast(this.hDynam, height, 10);
        this.widthDynamic = AnimationMath.fast(this.widthDynamic, width, 10);
        RenderUtil.Render2D.drawShadow(posX, posY, widthDynamic, headerHeight + hDynam + padding / 2f, 10, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawGradientRound(posX, posY, widthDynamic, hDynam + headerHeight + 2.5f, roundDegree - 1, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawRoundedCorner(posX, posY, widthDynamic, headerHeight, new Vector4f(roundDegree, 0, roundDegree, 0), headerColor);
        Fonts.gilroyBold[18].drawCenteredString(matrixStack, ClientUtil.gradient("staff list", firstColor, secondColor), posX + widthDynamic / 2f, posY + 5.5f, ColorUtil.getColorStyle(255));

        RenderUtil.Render2D.drawRoundedCorner(posX, posY + headerHeight, widthDynamic, hDynam + padding / 2f, new Vector4f(0, roundDegree, 0, roundDegree), backgroundColor);

        int index = 0;

        SmartScissor.push();
        SmartScissor.setFromComponentCoordinates(posX, posY, widthDynamic, headerHeight + hDynam + padding / 2f);
        if (!staffPlayers.isEmpty()) {
            for (HUD2.StaffPlayer staff : staffPlayers) {
                String name = staff.getName();
                ITextComponent prefix = staff.getPrefix();
                String status = staff.getStatus().getString();

                Fonts.gilroyBold[12].drawString(matrixStack, prefix, posX + padding, posY + headerHeight + padding + (index * offset), -1);
                Fonts.gilroyBold[12].drawString(matrixStack, name + status, posX + padding + Fonts.gilroyBold[12].getWidth(prefix.getString()), posY + headerHeight + padding + (index * offset), -1);
                nameWidth = Fonts.gilroyBold[12].getWidth(prefix.getString() + name + status);
                index++;
            }
        } else {
            nameWidth = 0;
        }
        SmartScissor.unset();
        SmartScissor.pop();

        activeStaff = index;
        staffList.setWidth(widthDynamic);
        staffList.setHeight(hDynam + headerHeight);
    }
    private class StaffPlayer {

        @Getter
        String name;
        @Getter
        ITextComponent prefix;
        @Getter
        HudFunction.Status status;

        private StaffPlayer(String name, ITextComponent prefix) {
            this.name = name;
            this.prefix = prefix;

            updateStatus();
        }

        private void updateStatus() {
            for (AbstractClientPlayerEntity player : mc.world.getPlayers()) {
                if (player.getNameClear().equals(name)) {
                    status = NEAR;
                    return;
                }
            }

            for (NetworkPlayerInfo info : mc.getConnection().getPlayerInfoMap()) {
                if (info.getGameProfile().getName().equals(name)) {
                    if (info.getGameType() == GameType.SPECTATOR) {
                        status = SPEC;
                        return;
                    }

                    status = NONE;
                    return;
                }
            }

            status = VANISHED;
        }
    }
    public final Dragging targetHUD = Initilization.createDrag(this, "TargetHUD", 500, 50);
    private float health = 0;
    private double scale = 0.0D;

    private void onRenderTargetHUD(final MatrixStack stack) {
        this.target = getTarget(this.target);
        this.targetHudAnimation.setDuration(300);
        this.scale = targetHudAnimation.getOutput();
        if (scale == 0.0F) {
            target = null;
        }
        if (target == null) {
            return;
        }
        final String targetName = this.target.getName().getString();

        String substring = targetName.substring(0, Math.min(targetName.length(), 10));//Нужная залупа
        final float nameWidth = Fonts.gilroyBold[18].getWidth(substring);//Нужная залупа
        final float xPosition = this.targetHUD.getX();//Нужная залупа
        final float yPosition = this.targetHUD.getY();//Нужная залупа
        final float maxWidth = Math.max(nameWidth + 50, 120);//Нужная залупа
        final float maxHeight = 30;//Нужная залупа

        this.health = AnimationMath.fast(health, target.getHealth() / target.getMaxHealth(), 5);//Типо должна быть анимация
        this.health = MathHelper.clamp(this.health, 0, 1);//Типо должна быть анимация

        GlStateManager.pushMatrix();
        AnimationMath.sizeAnimation(xPosition + (maxWidth / 2), yPosition + (maxHeight / 2), scale);

        Vector2i colorVec = new Vector2i(ColorUtil.getColorStyle(0), ColorUtil.getColorStyle(90));

        RenderUtil.Render2D.drawShadow(xPosition, yPosition, maxWidth, maxHeight, 10, colorVec.x, colorVec.y, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawGradientRound(xPosition, yPosition, maxWidth, maxHeight, 3, colorVec.x, colorVec.y, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));

        RenderUtil.Render2D.drawRoundedRect(xPosition, yPosition, maxWidth, maxHeight, 2.5f, rgba(21, 21, 21, 200));
        drawFace(xPosition + 4, yPosition + 3.25f, 8F, 8F, 8F, 8F, 24, 24, 64F, 64F, (AbstractClientPlayerEntity) target);//Ебло чела
        drawCircle(
                xPosition + maxWidth - 15, // X-координата
                yPosition + maxHeight / 2, // Y-координата
                12.0f,                     // Радиус круга
                4.0f,                      // Ширина линии
                false,                     // Не заполненный круг
                ColorUtil.getColorStyle(255), // Цвет
                360                        // Количество сегментов
        );



        drawItemStack(xPosition + 32, yPosition + 22 - 5.5f, 10);

        Fonts.gilroyBold[18].drawString(stack, substring, xPosition + maxWidth - 90, yPosition + 6, -1);//Ник

        String healthValue = (int) MathUtil.round(this.health * 20 + target.getAbsorptionAmount(), 0.5f) + "";
        Fonts.gilroyBold[18].drawCenteredString(stack, healthValue, xPosition + maxWidth - 15, yPosition + maxHeight / 2 - 2.2f, ColorUtil.rgba(255, 255, 255, 255));//Hp
        GlStateManager.popMatrix();
        this.targetHUD.setWidth(maxWidth);
        this.targetHUD.setHeight(maxHeight);
    }




    private void drawItemStack(float x, float y, float offset) {
        List<ItemStack> stackList = new ArrayList<>(Arrays.asList(target.getHeldItemMainhand(), target.getHeldItemOffhand()));
        stackList.addAll((Collection<? extends ItemStack>) target.getArmorInventoryList());

        final AtomicReference<Float> posX = new AtomicReference<>(x);

        stackList.stream()
                .filter(stack -> !stack.isEmpty())
                .forEach(stack -> HudUtil.drawItemStack(stack,
                        posX.getAndAccumulate(offset, Float::sum),
                        y,
                        true,
                        true, 0.6f));
    }

    private float perc;

    private void renderTimer(MatrixStack matrixStack) {
        float posX = timerHUD.getX();
        float posY = timerHUD.getY();
        int firstColor = ColorUtil.getColorStyle(0);
        int secondColor = ColorUtil.getColorStyle(90);

        float quotient = Managment.FUNCTION_MANAGER.timerFunction.maxViolation / Managment.FUNCTION_MANAGER.timerFunction.timerAmount.getValue().floatValue();
        float minimumValue = Math.min(Managment.FUNCTION_MANAGER.timerFunction.getViolation(), quotient);
        perc = AnimationMath.lerp(perc, ((quotient - minimumValue) / quotient), 10);

        String text = (int) (perc * 100) + "%";
        float width = 80;
        int width2 = 70;
        timerHUD.setWidth(width);
        timerHUD.setHeight(20);
        RenderUtil.Render2D.drawShadow(posX, posY, width, 27, 10, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));
        RenderUtil.Render2D.drawGradientRound(posX - 0.25f, posY - 0.25f, width + 0.25f, 27 + 0.25f, 3, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));
        RenderUtil.Render2D.drawRoundedRect(posX, posY, width, 27,3, RenderUtil.reAlphaInt(ColorUtil.rgba(15, 15, 15, 255), 170));

        medium.drawString(matrixStack, "Timer", posX + 27.5, posY + 6, ColorUtil.getColorStyle(255));

        RenderUtil.Render2D.drawGradientRound(posX + 5f, posY + 24 - 8, width2 * perc, 7,1, firstColor, secondColor, ColorUtil.getColorStyle(180), ColorUtil.getColorStyle(270));
        medium.drawString(matrixStack, text, posX + width - medium.getWidth(text) - 3 - 27, posY + 17.5, t_color);
    }

    private PlayerEntity getTarget(PlayerEntity nullTarget) {
        PlayerEntity target = nullTarget;

        if (Managment.FUNCTION_MANAGER.auraFunction.getTarget() instanceof PlayerEntity) {
            target = (PlayerEntity) Managment.FUNCTION_MANAGER.auraFunction.getTarget();
            tHudAnimation.setDirection(Direction.FORWARDS);
        } else if (mc.currentScreen instanceof ChatScreen) {
            target = mc.player;
            tHudAnimation.setDirection(Direction.FORWARDS);
        } else {
            tHudAnimation.setDirection(Direction.BACKWARDS);
        }

        return target;
    }

    private void updateFunctions() {
        for (Function function : Managment.FUNCTION_MANAGER.getFunctions()) {
            if (function.category == Category.Render) continue;

            functions.add(function);
        }

        functions.sort((f1, f2) -> Float.compare(small.getWidth(f2.name), small.getWidth(f1.name)));
    }

    private int getColor(int index) {
        return colors[index % colors.length];
    }
}
Слей уже сурсы нахуй, по одному постишь
 
Начинающий
Статус
Оффлайн
Регистрация
22 Сен 2023
Сообщения
43
Реакции[?]
0
Поинты[?]
0
Сверху Снизу