Исходник HUD Estynett 2.0

Начинающий
Статус
Оффлайн
Регистрация
23 Июн 2023
Сообщения
103
Реакции[?]
0
Поинты[?]
0

Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:

  • бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
  • маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
  • приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
  • обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.

Спасибо!

Чит закрылся.
1735060846434.pngъ

Java:
package dev.estynett.modules.impl.render;

import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import dev.estynett.Estynett;
import dev.estynett.command.staffs.StaffStorage;
import dev.estynett.events.EventRender;
import dev.estynett.events.EventUpdate;
import dev.estynett.modules.api.Category;
import dev.estynett.modules.api.Module;
import dev.estynett.modules.api.ModuleRegister;
import dev.estynett.modules.impl.combat.KillAura;
import dev.estynett.modules.settings.impl.BooleanSetting;
import dev.estynett.modules.settings.impl.ModeListSetting;
import dev.estynett.modules.settings.impl.ModeSetting;
import dev.estynett.ui.styles.Style;
import dev.estynett.utils.animations.Animation;
import dev.estynett.utils.animations.Direction;
import dev.estynett.utils.animations.impl.DecelerateAnimation;
import dev.estynett.utils.animations.impl.EaseBackIn;
import dev.estynett.utils.client.ClientUtil;
import dev.estynett.utils.client.KeyStorage;
import dev.estynett.utils.client.ThemeManager;
import dev.estynett.utils.drag.Dragging;
import dev.estynett.utils.font.FontManager;
import dev.estynett.utils.math.MathUtil;
import dev.estynett.utils.math.StopWatch;
import dev.estynett.utils.math.Vector4i;
import dev.estynett.utils.render.*;
import dev.estynett.utils.render.font.Fonts;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.experimental.FieldDefaults;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.network.play.NetworkPlayerInfo;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.LivingEntity;
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.Vector4f;
import net.minecraft.util.text.ITextComponent;

import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.regex.Pattern;

@FieldDefaults(level = AccessLevel.PRIVATE)
@ModuleRegister(name = "HUD", category = Category.Render)
public class HUD extends Module {

    public static final ModeSetting vibor = new ModeSetting(
            "Тема","Первый", "Первый", "Второй", "Третий"
    );

    private final BooleanSetting elementsShadow = new BooleanSetting("Свечение", false);

    Animation animation = new EaseBackIn(250, 1f, 1f);
    Animation alpha = new EaseBackIn(220, 1f, 1f);

    private final ModeListSetting elements = new ModeListSetting("Элементы",
            new BooleanSetting("Кейбинды", true),
            new BooleanSetting("Администрации", true),
            new BooleanSetting("Поушены", true),
            new BooleanSetting("Лого", true),
            new BooleanSetting("Координаты", true),
            new BooleanSetting("Таргет-Худ", true));

    @Subscribe
    private void onDisplay(EventRender e) {
        if (e.isRender2D()) {
            if (mc.gameSettings.showDebugInfo) {
                return;
            }

            boolean shadowValue = elementsShadow.get();

            if (elements.getValueByName("Лого").get()) logoMethod(e, shadowValue);
            if (elements.getValueByName("Кейбинды").get()) keyBinds(e, shadowValue);
            if (elements.getValueByName("Администрации").get()) staffList(e, shadowValue);
            if (elements.getValueByName("Поушены").get()) potionList(e, shadowValue);
            if (elements.getValueByName("Координаты").get()) coordinates(e);
            if (elements.getValueByName("Таргет-Худ").get()) targetInfo(e, shadowValue);
//            KawaseBlur.blur.updateBlur(3, 2);
//            KawaseBlur.blur.BLURRED.draw();
        }
    }

    private final List<Staff> staffPlayers = new ArrayList<>();
    private final Pattern namePattern = Pattern.compile("^\\w{3,16}$");
    private final Pattern prefixMatches = Pattern.compile(".*(mod|der|adm|help|wne|хелп|адм|поддержка|кура|own|taf|curat|dev|supp|yt|сотруд).*");

    @Subscribe
    private void onUpdate(EventUpdate eventUpdate) {
        staffPlayers.clear();

        for (ScorePlayerTeam team : mc.world.getScoreboard().getTeams().stream().sorted(Comparator.comparing(Team::getName)).toList()) {
            String name = team.getMembershipCollection().toString().replaceAll("[\\[\\]]", "");
            boolean vanish = true;
            for (NetworkPlayerInfo info : mc.getConnection().getPlayerInfoMap()) {
                if (info.getGameProfile().getName().equals(name)) {
                    vanish = false;
                }
            }
            if (namePattern.matcher(name).matches() && !name.equals(mc.player.getName().getString())) {
                if (!vanish) {
                    if (prefixMatches.matcher(team.getPrefix().getString().toLowerCase(Locale.ROOT)).matches() || StaffStorage.isStaff(name)) {
                        Staff staff = new Staff(team.getPrefix(), name, false, Status.NONE, true);
                        staffPlayers.add(staff);
                    }
                }
                if (vanish && !team.getPrefix().getString().isEmpty()) {
                    Staff staff = new Staff(team.getPrefix(), name, true, Status.VANISHED, true);
                    staffPlayers.add(staff);
                }
            }
        }
    }

    private final float fontSize = 7;
    private final float padding = 5;

    Dragging logoXY = Estynett.INSTANCE.createDrag(this, "watermark", 10, 10);
    Dragging keyBinds = Estynett.INSTANCE.createDrag(this, "keybinds", 100, 10);
    Dragging staffList = Estynett.INSTANCE.createDrag(this, "stafflist", 200, 10);
    Dragging potions = Estynett.INSTANCE.createDrag(this, "potions", 300, 10);



    private void logoMethod(EventRender eventDisplay, boolean shadow) {
        MatrixStack matrixStack = eventDisplay.matrixStack;
        float x = 5;
        float y = 5;

        int fps = mc.debugFPS;
        String serverIp = mc.getCurrentServerData() != null ? mc.getCurrentServerData().serverIP : "server is nothing:(";

        float width = 15;
        float height = 14;
        float allWidth = FontManager.sfMedium[18].getWidth("Estynett") + width + FontManager.sfMedium[18].getWidth(" - " + fps + " Fps") + FontManager.sfMedium[18].getWidth(" - " + serverIp) + 5;

        RenderUtil.Render2D.drawRoundedRect(x, y, allWidth, height, 2.5f, ThemeManager.getStartColor());
        if (shadow) {
            RenderUtil.Render2D.drawShadow(x + 15, y + 3, FontManager.sfMedium[18].getWidth("Estynett"), 9, 10, RenderUtil.reAlphaInt(ThemeManager.getEndColor(), 100));
        }
        if (shadow) {
            RenderUtil.Render2D.drawShadow(x + 2.5f, y + 2.5f, 10, 10, 10, RenderUtil.reAlphaInt(ThemeManager.getEndColor(), 100));
        }
        FontManager.sfMedium[18].drawString(matrixStack, "Estynett", x + 15, y + 4,ThemeManager.getEndColor());
        RenderUtil.Render2D.drawImage(matrixStack, new ResourceLocation("expensive/images/WATERMARK.png"), x + 2.5f, y + 2.5f,0, 10, 10, ThemeManager.getEndColor(), ThemeManager.getEndColor(),ThemeManager.getEndColor(),ThemeManager.getEndColor());

        FontManager.sfMedium[18].drawString(matrixStack, " - " + fps + " Fps", x + 52, y + 4, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0,0));
        FontManager.sfMedium[18].drawString(matrixStack, " - " + serverIp, x + FontManager.sfMedium[18].getWidth(" - " + fps + " Fps") + FontManager.sfMedium[18].getWidth("Estynett") + 17, y + 4, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0,0));
    }

    float kbWidth, kbWidthAnim = 0;
    float kbHeght, kbHeightAnim = 0;
    private void keyBinds(EventRender eventRender, boolean glow) {
        MatrixStack ms = eventRender.matrixStack;
        float xPosition = keyBinds.getX();
        float yPosition = keyBinds.getY();

        if(glow) {
            RenderUtil.Render2D.drawShadow(xPosition, yPosition, kbWidthAnim, kbHeightAnim, 5, ThemeManager.getStartColor());
        }
        RenderUtil.Render2D.drawRoundedRect(xPosition, yPosition, kbWidthAnim, kbHeightAnim, 4, ThemeManager.getStartColor());


        FontManager.sfMedium[16].drawCenteredString(ms, "Hotkeys", xPosition + kbWidthAnim / 2f, yPosition + 6, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0, 0));
        Fonts.icon.drawCenteredText(ms, "C", xPosition + kbWidthAnim / 2f - 24, yPosition + 4.5f, ThemeManager.getEndColor(), 10);

        kbHeightAnim = MathUtil.fast(kbHeightAnim, kbHeght, 15);
        kbWidthAnim = MathUtil.fast(kbWidthAnim, kbWidth, 15);

        float maxWidth = FontManager.sfMedium[16].getWidth("Hotkeys") + padding * 2;

        Scissor.push();
        Scissor.setFromComponentCoordinates(xPosition, yPosition, kbWidth, kbHeght);
        int i = 0;
        for (Module f : Estynett.INSTANCE.getModuleManager().getModules()) {
            f.getAnimation().update();
            if (!f.isState() || f.getBind() == 0) continue;

            String nameText = f.getName();
            float nameWidth = FontManager.sfMedium[14].getWidth(nameText);

            String bindText = KeyStorage.getKey(f.getBind());
            float bindWidth = FontManager.sfMedium[14].getWidth(bindText);

            float localWidth = nameWidth + bindWidth + padding * 3.0F + 4.0F;

            FontManager.sfMedium[14].drawString(ms, nameText, xPosition + padding - 1, yPosition + 19.5f + (i * 10),!vibor.is("Третий") ?
                    ColorUtils.rgba(255, 255, 255, (int) (255 * f.getAnimation().getValue())) : ColorUtils.rgba(0, 0, 0, (int) (255 * f.getAnimation().getValue())));
            RenderUtil.Render2D.drawRoundedRect(xPosition + kbWidth - bindWidth - 6, yPosition + 17f + (i * 10), bindWidth + 3.5f, 8.5f, 1.5f,!vibor.is("Третий") ? ColorUtils.rgb(41, 41, 41) : ColorUtils.rgb(210, 210, 210));
            FontManager.sfMedium[14].drawString(ms, bindText, xPosition + kbWidth - bindWidth - 4, yPosition + 19.5f + (i * 10), RenderUtil.reAlphaInt(ThemeManager.getEndColor(), (int) (255 * f.getAnimation().getValue())));

            if (localWidth > maxWidth) {
                maxWidth = localWidth;
            }
            i++;
        }
        if (i > 0) {
            animation.setDirection(Direction.FORWARDS);
            alpha.setDirection(Direction.FORWARDS);
        } else {
            animation.setDirection(Direction.BACKWARDS);
            alpha.setDirection(Direction.BACKWARDS);
        }
        Scissor.unset();
        Scissor.pop();
        kbWidth = Math.max(maxWidth, 75);
        kbHeght = 19 + (i * 10);
        keyBinds.setWidth(kbWidth);
        keyBinds.setHeight(kbHeght);
    }


    float slWidth, slAnimateWidth = 0;
    float slHeight, slAnimateHeight = 0;
    private void staffList(EventRender eventRender, boolean glow) {
        MatrixStack ms = eventRender.matrixStack;
        float xPosition = staffList.getX();
        float yPosition = staffList.getY();

        if(glow) {
            RenderUtil.Render2D.drawShadow(xPosition, yPosition, slAnimateWidth, slAnimateHeight, 5, ThemeManager.getStartColor());
        }
        RenderUtil.Render2D.drawRoundedRect(xPosition, yPosition, slAnimateWidth, slAnimateHeight, 4, ThemeManager.getStartColor());

        FontManager.sfMedium[16].drawCenteredString(ms, "Stafflist", xPosition + slAnimateWidth / 2f, yPosition + 6, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0, 0));
        Fonts.icon.drawCenteredText(ms, "O", xPosition + slAnimateWidth / 2f - 24, yPosition + 4.5f, ThemeManager.getEndColor(), 10);

        slAnimateWidth = MathUtil.fast(slAnimateWidth, slWidth, 15);
        slAnimateHeight = MathUtil.fast(slAnimateHeight, slHeight, 15);

        float maxWidth = FontManager.sfMedium[14].getWidth("Stafflist") + padding * 2;

        int i = 0;
        for (Staff f : staffPlayers) {
            if (!(f.getAnimation().getOutput() > 0)) continue;
            ITextComponent prefix = f.getPrefix();
            float prefixWidth = FontManager.sfMedium[14].getWidth(prefix.getString());
            String staff = (prefix.getString().isEmpty() ? "  " : " ") + f.getName();
            float nameWidth = FontManager.sfMedium[14].getWidth(staff);

            float localWidth = prefixWidth + nameWidth + Fonts.montserrat.getWidth(f.getStatus().string, fontSize) + padding * 3;

            FontManager.sfMedium[14].drawString(ms, prefix, xPosition + 1, yPosition + 19.5f + (i * 10), (int) (f.animation.getOutput() * 255));
            FontManager.sfMedium[14].drawString(ms, staff, xPosition + padding + prefixWidth - 5, yPosition + 19.5f + (i * 10), -1);
            FontManager.sfMedium[14].drawString(ms, f.getStatus().string, xPosition + slWidth - padding - FontManager.sfMedium[14].getWidth(f.getStatus().string) + 2, yPosition + 19.5f + (i * 10), ColorUtils.setAlpha(f.getStatus().color, (int) (f.animation.getOutput() * 255)));

            if (localWidth > maxWidth) {
                maxWidth = localWidth;
            }
            i++;
        }
        if (i > 0) {
            animation.setDirection(Direction.FORWARDS);
            alpha.setDirection(Direction.FORWARDS);
        } else {
            animation.setDirection(Direction.BACKWARDS);
            alpha.setDirection(Direction.BACKWARDS);
        }
        slHeight = 19 + (i * 10);
        slWidth = Math.max(maxWidth, 75);
        staffList.setWidth(slWidth);
        staffList.setHeight(slHeight);
    }

    //

    private Map<String, DecelerateAnimation> animations = new HashMap<>();

    float potWidth, potWidthAnim = 0;
    float potHeight, potHeigthAnim = 0;
    private void potionList(EventRender eventRender, boolean glow) {
        MatrixStack ms = eventRender.matrixStack;
        float xPosition = potions.getX();
        float yPosition = potions.getY();

        if(glow) {
            RenderUtil.Render2D.drawShadow(xPosition, yPosition, potWidthAnim, potHeigthAnim, 5, ThemeManager.getStartColor());
        }
        RenderUtil.Render2D.drawRoundedRect(xPosition, yPosition, potWidthAnim, potHeigthAnim, 4, ThemeManager.getStartColor());

        FontManager.sfMedium[16].drawCenteredString(ms, "Potions", xPosition + potWidthAnim / 2f, yPosition + 6, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0, 0));
        Fonts.icon.drawCenteredText(ms, "E", xPosition + potWidthAnim / 2f - 24, yPosition + 4.5f, ThemeManager.getEndColor(), 10);
        potWidthAnim = MathUtil.fast(potWidthAnim, potWidth, 15);
        potHeigthAnim = MathUtil.fast(potHeigthAnim, potHeight, 15);

        float maxWidth = FontManager.sfMedium[16].getWidth("Potions") + padding * 2;
        int i = 0;

        for (EffectInstance ef : mc.player.getActivePotionEffects()) {
            int amp = ef.getAmplifier();

            String ampStr = "";

            if (amp >= 1 && amp <= 9) {
                ampStr = " " + (amp + 1);
            }

            DecelerateAnimation efAnimation = animations.getOrDefault(ef.getEffectName(), null);
            if (efAnimation == null) {
                efAnimation = new DecelerateAnimation(250, 1, Direction.FORWARDS);
                animations.put(ef.getEffectName(), efAnimation);
            }

            boolean potionActive = ef.getDuration() > 5;
            efAnimation.setDirection(potionActive ? Direction.FORWARDS : Direction.BACKWARDS);

            String nameText = I18n.format(ef.getEffectName()) + ampStr;
            float nameWidth = FontManager.sfMedium[14].getWidth(nameText);

            String bindText = EffectUtils.getPotionDurationString(ef, 1);
            float bindWidth = FontManager.sfMedium[14].getWidth(bindText);

            float localWidth = nameWidth + bindWidth + padding * 3;

            FontManager.sfMedium[14].drawString(ms, nameText, xPosition + padding - 1, yPosition + 19.5f + (i * 10), !vibor.is("Третий") ?
                    ColorUtils.rgba(255, 255, 255, (int) (255 * efAnimation.getOutput())) : ColorUtils.rgba(0, 0, 0, (int) (255 * efAnimation.getOutput())));
            RenderUtil.Render2D.drawRoundedRect(xPosition + potWidth - bindWidth - 7, yPosition + 17f + (i * 10), bindWidth + 3.5f, 8.5f, 1.5f,!vibor.is("Третий") ? ColorUtils.rgb(41, 41, 41) : ColorUtils.rgb(210, 210, 210));
            FontManager.sfMedium[14].drawString(ms, bindText, xPosition + potWidth - padding - bindWidth, yPosition + 19.5f + (i * 10), !vibor.is("Третий") ?
                    ColorUtils.rgba(255, 255, 255, (int) (255 * efAnimation.getOutput())) : ColorUtils.rgba(0, 0, 0, (int) (255 * efAnimation.getOutput())));
            i++;

            if (localWidth > maxWidth) {
                maxWidth = localWidth;
            }

        }
        if (animations != null) animations.keySet().removeIf((type) -> mc.player.getActivePotionEffects().stream().map((effect) -> effect.getPotion().getName()).noneMatch((type2) -> type2.equals(type)));
        if (i > 0) {
            animation.setDirection(Direction.FORWARDS);
            alpha.setDirection(Direction.FORWARDS);
        } else {
            animation.setDirection(Direction.BACKWARDS);
            alpha.setDirection(Direction.BACKWARDS);
        }
        potHeight = 19 + (i * 10);
        potWidth = Math.max(maxWidth, 75);
        potions.setWidth(potWidth);
        potions.setHeight(potHeight);
    }

    private void coordinates(EventRender eventRender) {

    }

    StopWatch stopWatch = new StopWatch();

    Dragging drag = Estynett.INSTANCE.createDrag(this, "th",100, 100);

    final Animation animation2 = new EaseBackIn(200, 1, 1);

    LivingEntity entity = null;

    boolean allow;

    float healthAnimation = 0.0f;
    float absorptionAnimation = 0.0f;

    private void targetInfo(EventRender eventRender, boolean shadow) {
        entity = getTarget(entity);
        boolean out = !allow;
        animation.setDuration(out ? 400 : 300);
        animation2.setDuration(350);
        animation.setDirection(out ? Direction.BACKWARDS : Direction.FORWARDS);
        animation2.setDirection(out ? Direction.BACKWARDS : Direction.FORWARDS);


        if (entity != null) {
            float posX = drag.getX();
            float posY = drag.getY();

            float headSize = 28;

            float width = 89;
            float height = 33;
            drag.setWidth(width);
            drag.setHeight(height);

            float hp = ClientUtil.isConnectedToServer("reallyworld") ? getHealthFromScoreboard(entity)[0] : entity.getHealth();
            float maxHp = entity.getMaxHealth();

            healthAnimation = MathHelper.clamp(hp / maxHp, 0, 1);
            absorptionAnimation = MathHelper.clamp(entity.getAbsorptionAmount() / maxHp, 0, 1);

            int alpha = MathHelper.clamp((int) (animation2.getOutput() * 255), 0, 255);

            RenderUtil.Render2D.drawRoundedRect(posX, posY, width, height, 2.5f, RenderUtil.reAlphaInt(ThemeManager.getStartColor(), alpha));
            RenderUtil.Render2D.drawRoundedRect(posX + headSize + 3.5f, posY + 22.5f, (width - 35), 5, 1.5f, ColorUtils.rgba(14, 14, 14, alpha));
            RenderUtil.Render2D.drawRoundedRect(posX + headSize + 3.5f, posY + 22.5f, (width - 35) * healthAnimation, 5, 1.5f, RenderUtil.reAlphaInt(ThemeManager.getEndColor(), alpha));
            if (alpha > 0) {
                RenderUtil.Render2D.drawTargetHead(entity, posX + 2.5f, posY + 2.5f, headSize, headSize);
            }

            Scissor.push();
            Scissor.setFromComponentCoordinates(posX, posY, width - 6, height);
            FontManager.sfRegular[16].drawString(eventRender.matrixStack,entity.getName().getString(), posX + headSize + 3.5f, posY + 3.5f,!vibor.is("Третий") ? ColorUtils.rgba(255, 255, 255, alpha) : ColorUtils.rgba(0, 0, 0, alpha));
            Scissor.unset();
            Scissor.pop();

            FontManager.sfRegular[14].drawString(eventRender.matrixStack,"HP: " + (ClientUtil.isConnectedToServer("reallyworld") ? String.valueOf(getHealthFromScoreboard(entity)[0]) : ((int) entity.getHealth() + (int) mc.player.getAbsorptionAmount())),posX + headSize + 3.5f, posY + 14.5f, !vibor.is("Третий") ? ColorUtils.rgba(255, 255, 255, alpha) : ColorUtils.rgba(0, 0, 0, alpha));
        }
    }


    public HUD() {
        addSettings(elements, vibor, elementsShadow);
    }
    @AllArgsConstructor
    @Data
    public static class Staff {
        ITextComponent prefix;
        String name;
        boolean isSpec;
        Status status;
        final Animation animation = new DecelerateAnimation(status == Status.NONE ? 450 : 250, 1f, Direction.FORWARDS);
        boolean onServer;
    }

    public enum Status {
        NONE("", -1),
        VANISHED("V", ColorUtils.rgb(254, 68, 68));
        public final String string;
        public final int color;

        Status(String string, int color) {
            this.string = string;
            this.color = color;
        }
    }

    public float[] getHealthFromScoreboard(LivingEntity target) {
        var ref = new Object() {
            float hp = target.getHealth();
            float maxHp = target.getMaxHealth();
        };
        if (mc.world.getScoreboard().getObjectiveInDisplaySlot(2) != null) {
            mc.world.getScoreboard().getObjectivesForEntity(target.getScoreboardName()).entrySet().stream().findAny().ifPresent(x -> {
                ref.hp = x.getValue().getScorePoints();
                ref.maxHp = 20;
            });
        }
        return new float[]{ref.hp, ref.maxHp};
    }

    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity auraTarget = Estynett.INSTANCE.getModuleManager().getKillAura().getTarget();
        LivingEntity target = nullTarget;
        if (auraTarget != null) {
            stopWatch.reset();
            allow = true;
            target = auraTarget;
        } else if (mc.currentScreen instanceof ChatScreen) {
            stopWatch.reset();
            allow = true;
            target = mc.player;
        } else {
            allow = false;
        }
        return target;
    }
}
 
Начинающий
Статус
Оффлайн
Регистрация
5 Июн 2024
Сообщения
35
Реакции[?]
0
Поинты[?]
0
Чит закрылся.
Посмотреть вложение 293591ъ

Java:
package dev.estynett.modules.impl.render;

import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import dev.estynett.Estynett;
import dev.estynett.command.staffs.StaffStorage;
import dev.estynett.events.EventRender;
import dev.estynett.events.EventUpdate;
import dev.estynett.modules.api.Category;
import dev.estynett.modules.api.Module;
import dev.estynett.modules.api.ModuleRegister;
import dev.estynett.modules.impl.combat.KillAura;
import dev.estynett.modules.settings.impl.BooleanSetting;
import dev.estynett.modules.settings.impl.ModeListSetting;
import dev.estynett.modules.settings.impl.ModeSetting;
import dev.estynett.ui.styles.Style;
import dev.estynett.utils.animations.Animation;
import dev.estynett.utils.animations.Direction;
import dev.estynett.utils.animations.impl.DecelerateAnimation;
import dev.estynett.utils.animations.impl.EaseBackIn;
import dev.estynett.utils.client.ClientUtil;
import dev.estynett.utils.client.KeyStorage;
import dev.estynett.utils.client.ThemeManager;
import dev.estynett.utils.drag.Dragging;
import dev.estynett.utils.font.FontManager;
import dev.estynett.utils.math.MathUtil;
import dev.estynett.utils.math.StopWatch;
import dev.estynett.utils.math.Vector4i;
import dev.estynett.utils.render.*;
import dev.estynett.utils.render.font.Fonts;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.experimental.FieldDefaults;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.network.play.NetworkPlayerInfo;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.LivingEntity;
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.Vector4f;
import net.minecraft.util.text.ITextComponent;

import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.regex.Pattern;

@FieldDefaults(level = AccessLevel.PRIVATE)
@ModuleRegister(name = "HUD", category = Category.Render)
public class HUD extends Module {

    public static final ModeSetting vibor = new ModeSetting(
            "Тема","Первый", "Первый", "Второй", "Третий"
    );

    private final BooleanSetting elementsShadow = new BooleanSetting("Свечение", false);

    Animation animation = new EaseBackIn(250, 1f, 1f);
    Animation alpha = new EaseBackIn(220, 1f, 1f);

    private final ModeListSetting elements = new ModeListSetting("Элементы",
            new BooleanSetting("Кейбинды", true),
            new BooleanSetting("Администрации", true),
            new BooleanSetting("Поушены", true),
            new BooleanSetting("Лого", true),
            new BooleanSetting("Координаты", true),
            new BooleanSetting("Таргет-Худ", true));

    @Subscribe
    private void onDisplay(EventRender e) {
        if (e.isRender2D()) {
            if (mc.gameSettings.showDebugInfo) {
                return;
            }

            boolean shadowValue = elementsShadow.get();

            if (elements.getValueByName("Лого").get()) logoMethod(e, shadowValue);
            if (elements.getValueByName("Кейбинды").get()) keyBinds(e, shadowValue);
            if (elements.getValueByName("Администрации").get()) staffList(e, shadowValue);
            if (elements.getValueByName("Поушены").get()) potionList(e, shadowValue);
            if (elements.getValueByName("Координаты").get()) coordinates(e);
            if (elements.getValueByName("Таргет-Худ").get()) targetInfo(e, shadowValue);
//            KawaseBlur.blur.updateBlur(3, 2);
//            KawaseBlur.blur.BLURRED.draw();
        }
    }

    private final List<Staff> staffPlayers = new ArrayList<>();
    private final Pattern namePattern = Pattern.compile("^\\w{3,16}$");
    private final Pattern prefixMatches = Pattern.compile(".*(mod|der|adm|help|wne|хелп|адм|поддержка|кура|own|taf|curat|dev|supp|yt|сотруд).*");

    @Subscribe
    private void onUpdate(EventUpdate eventUpdate) {
        staffPlayers.clear();

        for (ScorePlayerTeam team : mc.world.getScoreboard().getTeams().stream().sorted(Comparator.comparing(Team::getName)).toList()) {
            String name = team.getMembershipCollection().toString().replaceAll("[\\[\\]]", "");
            boolean vanish = true;
            for (NetworkPlayerInfo info : mc.getConnection().getPlayerInfoMap()) {
                if (info.getGameProfile().getName().equals(name)) {
                    vanish = false;
                }
            }
            if (namePattern.matcher(name).matches() && !name.equals(mc.player.getName().getString())) {
                if (!vanish) {
                    if (prefixMatches.matcher(team.getPrefix().getString().toLowerCase(Locale.ROOT)).matches() || StaffStorage.isStaff(name)) {
                        Staff staff = new Staff(team.getPrefix(), name, false, Status.NONE, true);
                        staffPlayers.add(staff);
                    }
                }
                if (vanish && !team.getPrefix().getString().isEmpty()) {
                    Staff staff = new Staff(team.getPrefix(), name, true, Status.VANISHED, true);
                    staffPlayers.add(staff);
                }
            }
        }
    }

    private final float fontSize = 7;
    private final float padding = 5;

    Dragging logoXY = Estynett.INSTANCE.createDrag(this, "watermark", 10, 10);
    Dragging keyBinds = Estynett.INSTANCE.createDrag(this, "keybinds", 100, 10);
    Dragging staffList = Estynett.INSTANCE.createDrag(this, "stafflist", 200, 10);
    Dragging potions = Estynett.INSTANCE.createDrag(this, "potions", 300, 10);



    private void logoMethod(EventRender eventDisplay, boolean shadow) {
        MatrixStack matrixStack = eventDisplay.matrixStack;
        float x = 5;
        float y = 5;

        int fps = mc.debugFPS;
        String serverIp = mc.getCurrentServerData() != null ? mc.getCurrentServerData().serverIP : "server is nothing:(";

        float width = 15;
        float height = 14;
        float allWidth = FontManager.sfMedium[18].getWidth("Estynett") + width + FontManager.sfMedium[18].getWidth(" - " + fps + " Fps") + FontManager.sfMedium[18].getWidth(" - " + serverIp) + 5;

        RenderUtil.Render2D.drawRoundedRect(x, y, allWidth, height, 2.5f, ThemeManager.getStartColor());
        if (shadow) {
            RenderUtil.Render2D.drawShadow(x + 15, y + 3, FontManager.sfMedium[18].getWidth("Estynett"), 9, 10, RenderUtil.reAlphaInt(ThemeManager.getEndColor(), 100));
        }
        if (shadow) {
            RenderUtil.Render2D.drawShadow(x + 2.5f, y + 2.5f, 10, 10, 10, RenderUtil.reAlphaInt(ThemeManager.getEndColor(), 100));
        }
        FontManager.sfMedium[18].drawString(matrixStack, "Estynett", x + 15, y + 4,ThemeManager.getEndColor());
        RenderUtil.Render2D.drawImage(matrixStack, new ResourceLocation("expensive/images/WATERMARK.png"), x + 2.5f, y + 2.5f,0, 10, 10, ThemeManager.getEndColor(), ThemeManager.getEndColor(),ThemeManager.getEndColor(),ThemeManager.getEndColor());

        FontManager.sfMedium[18].drawString(matrixStack, " - " + fps + " Fps", x + 52, y + 4, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0,0));
        FontManager.sfMedium[18].drawString(matrixStack, " - " + serverIp, x + FontManager.sfMedium[18].getWidth(" - " + fps + " Fps") + FontManager.sfMedium[18].getWidth("Estynett") + 17, y + 4, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0,0));
    }

    float kbWidth, kbWidthAnim = 0;
    float kbHeght, kbHeightAnim = 0;
    private void keyBinds(EventRender eventRender, boolean glow) {
        MatrixStack ms = eventRender.matrixStack;
        float xPosition = keyBinds.getX();
        float yPosition = keyBinds.getY();

        if(glow) {
            RenderUtil.Render2D.drawShadow(xPosition, yPosition, kbWidthAnim, kbHeightAnim, 5, ThemeManager.getStartColor());
        }
        RenderUtil.Render2D.drawRoundedRect(xPosition, yPosition, kbWidthAnim, kbHeightAnim, 4, ThemeManager.getStartColor());


        FontManager.sfMedium[16].drawCenteredString(ms, "Hotkeys", xPosition + kbWidthAnim / 2f, yPosition + 6, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0, 0));
        Fonts.icon.drawCenteredText(ms, "C", xPosition + kbWidthAnim / 2f - 24, yPosition + 4.5f, ThemeManager.getEndColor(), 10);

        kbHeightAnim = MathUtil.fast(kbHeightAnim, kbHeght, 15);
        kbWidthAnim = MathUtil.fast(kbWidthAnim, kbWidth, 15);

        float maxWidth = FontManager.sfMedium[16].getWidth("Hotkeys") + padding * 2;

        Scissor.push();
        Scissor.setFromComponentCoordinates(xPosition, yPosition, kbWidth, kbHeght);
        int i = 0;
        for (Module f : Estynett.INSTANCE.getModuleManager().getModules()) {
            f.getAnimation().update();
            if (!f.isState() || f.getBind() == 0) continue;

            String nameText = f.getName();
            float nameWidth = FontManager.sfMedium[14].getWidth(nameText);

            String bindText = KeyStorage.getKey(f.getBind());
            float bindWidth = FontManager.sfMedium[14].getWidth(bindText);

            float localWidth = nameWidth + bindWidth + padding * 3.0F + 4.0F;

            FontManager.sfMedium[14].drawString(ms, nameText, xPosition + padding - 1, yPosition + 19.5f + (i * 10),!vibor.is("Третий") ?
                    ColorUtils.rgba(255, 255, 255, (int) (255 * f.getAnimation().getValue())) : ColorUtils.rgba(0, 0, 0, (int) (255 * f.getAnimation().getValue())));
            RenderUtil.Render2D.drawRoundedRect(xPosition + kbWidth - bindWidth - 6, yPosition + 17f + (i * 10), bindWidth + 3.5f, 8.5f, 1.5f,!vibor.is("Третий") ? ColorUtils.rgb(41, 41, 41) : ColorUtils.rgb(210, 210, 210));
            FontManager.sfMedium[14].drawString(ms, bindText, xPosition + kbWidth - bindWidth - 4, yPosition + 19.5f + (i * 10), RenderUtil.reAlphaInt(ThemeManager.getEndColor(), (int) (255 * f.getAnimation().getValue())));

            if (localWidth > maxWidth) {
                maxWidth = localWidth;
            }
            i++;
        }
        if (i > 0) {
            animation.setDirection(Direction.FORWARDS);
            alpha.setDirection(Direction.FORWARDS);
        } else {
            animation.setDirection(Direction.BACKWARDS);
            alpha.setDirection(Direction.BACKWARDS);
        }
        Scissor.unset();
        Scissor.pop();
        kbWidth = Math.max(maxWidth, 75);
        kbHeght = 19 + (i * 10);
        keyBinds.setWidth(kbWidth);
        keyBinds.setHeight(kbHeght);
    }


    float slWidth, slAnimateWidth = 0;
    float slHeight, slAnimateHeight = 0;
    private void staffList(EventRender eventRender, boolean glow) {
        MatrixStack ms = eventRender.matrixStack;
        float xPosition = staffList.getX();
        float yPosition = staffList.getY();

        if(glow) {
            RenderUtil.Render2D.drawShadow(xPosition, yPosition, slAnimateWidth, slAnimateHeight, 5, ThemeManager.getStartColor());
        }
        RenderUtil.Render2D.drawRoundedRect(xPosition, yPosition, slAnimateWidth, slAnimateHeight, 4, ThemeManager.getStartColor());

        FontManager.sfMedium[16].drawCenteredString(ms, "Stafflist", xPosition + slAnimateWidth / 2f, yPosition + 6, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0, 0));
        Fonts.icon.drawCenteredText(ms, "O", xPosition + slAnimateWidth / 2f - 24, yPosition + 4.5f, ThemeManager.getEndColor(), 10);

        slAnimateWidth = MathUtil.fast(slAnimateWidth, slWidth, 15);
        slAnimateHeight = MathUtil.fast(slAnimateHeight, slHeight, 15);

        float maxWidth = FontManager.sfMedium[14].getWidth("Stafflist") + padding * 2;

        int i = 0;
        for (Staff f : staffPlayers) {
            if (!(f.getAnimation().getOutput() > 0)) continue;
            ITextComponent prefix = f.getPrefix();
            float prefixWidth = FontManager.sfMedium[14].getWidth(prefix.getString());
            String staff = (prefix.getString().isEmpty() ? "  " : " ") + f.getName();
            float nameWidth = FontManager.sfMedium[14].getWidth(staff);

            float localWidth = prefixWidth + nameWidth + Fonts.montserrat.getWidth(f.getStatus().string, fontSize) + padding * 3;

            FontManager.sfMedium[14].drawString(ms, prefix, xPosition + 1, yPosition + 19.5f + (i * 10), (int) (f.animation.getOutput() * 255));
            FontManager.sfMedium[14].drawString(ms, staff, xPosition + padding + prefixWidth - 5, yPosition + 19.5f + (i * 10), -1);
            FontManager.sfMedium[14].drawString(ms, f.getStatus().string, xPosition + slWidth - padding - FontManager.sfMedium[14].getWidth(f.getStatus().string) + 2, yPosition + 19.5f + (i * 10), ColorUtils.setAlpha(f.getStatus().color, (int) (f.animation.getOutput() * 255)));

            if (localWidth > maxWidth) {
                maxWidth = localWidth;
            }
            i++;
        }
        if (i > 0) {
            animation.setDirection(Direction.FORWARDS);
            alpha.setDirection(Direction.FORWARDS);
        } else {
            animation.setDirection(Direction.BACKWARDS);
            alpha.setDirection(Direction.BACKWARDS);
        }
        slHeight = 19 + (i * 10);
        slWidth = Math.max(maxWidth, 75);
        staffList.setWidth(slWidth);
        staffList.setHeight(slHeight);
    }

    //

    private Map<String, DecelerateAnimation> animations = new HashMap<>();

    float potWidth, potWidthAnim = 0;
    float potHeight, potHeigthAnim = 0;
    private void potionList(EventRender eventRender, boolean glow) {
        MatrixStack ms = eventRender.matrixStack;
        float xPosition = potions.getX();
        float yPosition = potions.getY();

        if(glow) {
            RenderUtil.Render2D.drawShadow(xPosition, yPosition, potWidthAnim, potHeigthAnim, 5, ThemeManager.getStartColor());
        }
        RenderUtil.Render2D.drawRoundedRect(xPosition, yPosition, potWidthAnim, potHeigthAnim, 4, ThemeManager.getStartColor());

        FontManager.sfMedium[16].drawCenteredString(ms, "Potions", xPosition + potWidthAnim / 2f, yPosition + 6, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0, 0));
        Fonts.icon.drawCenteredText(ms, "E", xPosition + potWidthAnim / 2f - 24, yPosition + 4.5f, ThemeManager.getEndColor(), 10);
        potWidthAnim = MathUtil.fast(potWidthAnim, potWidth, 15);
        potHeigthAnim = MathUtil.fast(potHeigthAnim, potHeight, 15);

        float maxWidth = FontManager.sfMedium[16].getWidth("Potions") + padding * 2;
        int i = 0;

        for (EffectInstance ef : mc.player.getActivePotionEffects()) {
            int amp = ef.getAmplifier();

            String ampStr = "";

            if (amp >= 1 && amp <= 9) {
                ampStr = " " + (amp + 1);
            }

            DecelerateAnimation efAnimation = animations.getOrDefault(ef.getEffectName(), null);
            if (efAnimation == null) {
                efAnimation = new DecelerateAnimation(250, 1, Direction.FORWARDS);
                animations.put(ef.getEffectName(), efAnimation);
            }

            boolean potionActive = ef.getDuration() > 5;
            efAnimation.setDirection(potionActive ? Direction.FORWARDS : Direction.BACKWARDS);

            String nameText = I18n.format(ef.getEffectName()) + ampStr;
            float nameWidth = FontManager.sfMedium[14].getWidth(nameText);

            String bindText = EffectUtils.getPotionDurationString(ef, 1);
            float bindWidth = FontManager.sfMedium[14].getWidth(bindText);

            float localWidth = nameWidth + bindWidth + padding * 3;

            FontManager.sfMedium[14].drawString(ms, nameText, xPosition + padding - 1, yPosition + 19.5f + (i * 10), !vibor.is("Третий") ?
                    ColorUtils.rgba(255, 255, 255, (int) (255 * efAnimation.getOutput())) : ColorUtils.rgba(0, 0, 0, (int) (255 * efAnimation.getOutput())));
            RenderUtil.Render2D.drawRoundedRect(xPosition + potWidth - bindWidth - 7, yPosition + 17f + (i * 10), bindWidth + 3.5f, 8.5f, 1.5f,!vibor.is("Третий") ? ColorUtils.rgb(41, 41, 41) : ColorUtils.rgb(210, 210, 210));
            FontManager.sfMedium[14].drawString(ms, bindText, xPosition + potWidth - padding - bindWidth, yPosition + 19.5f + (i * 10), !vibor.is("Третий") ?
                    ColorUtils.rgba(255, 255, 255, (int) (255 * efAnimation.getOutput())) : ColorUtils.rgba(0, 0, 0, (int) (255 * efAnimation.getOutput())));
            i++;

            if (localWidth > maxWidth) {
                maxWidth = localWidth;
            }

        }
        if (animations != null) animations.keySet().removeIf((type) -> mc.player.getActivePotionEffects().stream().map((effect) -> effect.getPotion().getName()).noneMatch((type2) -> type2.equals(type)));
        if (i > 0) {
            animation.setDirection(Direction.FORWARDS);
            alpha.setDirection(Direction.FORWARDS);
        } else {
            animation.setDirection(Direction.BACKWARDS);
            alpha.setDirection(Direction.BACKWARDS);
        }
        potHeight = 19 + (i * 10);
        potWidth = Math.max(maxWidth, 75);
        potions.setWidth(potWidth);
        potions.setHeight(potHeight);
    }

    private void coordinates(EventRender eventRender) {

    }

    StopWatch stopWatch = new StopWatch();

    Dragging drag = Estynett.INSTANCE.createDrag(this, "th",100, 100);

    final Animation animation2 = new EaseBackIn(200, 1, 1);

    LivingEntity entity = null;

    boolean allow;

    float healthAnimation = 0.0f;
    float absorptionAnimation = 0.0f;

    private void targetInfo(EventRender eventRender, boolean shadow) {
        entity = getTarget(entity);
        boolean out = !allow;
        animation.setDuration(out ? 400 : 300);
        animation2.setDuration(350);
        animation.setDirection(out ? Direction.BACKWARDS : Direction.FORWARDS);
        animation2.setDirection(out ? Direction.BACKWARDS : Direction.FORWARDS);


        if (entity != null) {
            float posX = drag.getX();
            float posY = drag.getY();

            float headSize = 28;

            float width = 89;
            float height = 33;
            drag.setWidth(width);
            drag.setHeight(height);

            float hp = ClientUtil.isConnectedToServer("reallyworld") ? getHealthFromScoreboard(entity)[0] : entity.getHealth();
            float maxHp = entity.getMaxHealth();

            healthAnimation = MathHelper.clamp(hp / maxHp, 0, 1);
            absorptionAnimation = MathHelper.clamp(entity.getAbsorptionAmount() / maxHp, 0, 1);

            int alpha = MathHelper.clamp((int) (animation2.getOutput() * 255), 0, 255);

            RenderUtil.Render2D.drawRoundedRect(posX, posY, width, height, 2.5f, RenderUtil.reAlphaInt(ThemeManager.getStartColor(), alpha));
            RenderUtil.Render2D.drawRoundedRect(posX + headSize + 3.5f, posY + 22.5f, (width - 35), 5, 1.5f, ColorUtils.rgba(14, 14, 14, alpha));
            RenderUtil.Render2D.drawRoundedRect(posX + headSize + 3.5f, posY + 22.5f, (width - 35) * healthAnimation, 5, 1.5f, RenderUtil.reAlphaInt(ThemeManager.getEndColor(), alpha));
            if (alpha > 0) {
                RenderUtil.Render2D.drawTargetHead(entity, posX + 2.5f, posY + 2.5f, headSize, headSize);
            }

            Scissor.push();
            Scissor.setFromComponentCoordinates(posX, posY, width - 6, height);
            FontManager.sfRegular[16].drawString(eventRender.matrixStack,entity.getName().getString(), posX + headSize + 3.5f, posY + 3.5f,!vibor.is("Третий") ? ColorUtils.rgba(255, 255, 255, alpha) : ColorUtils.rgba(0, 0, 0, alpha));
            Scissor.unset();
            Scissor.pop();

            FontManager.sfRegular[14].drawString(eventRender.matrixStack,"HP: " + (ClientUtil.isConnectedToServer("reallyworld") ? String.valueOf(getHealthFromScoreboard(entity)[0]) : ((int) entity.getHealth() + (int) mc.player.getAbsorptionAmount())),posX + headSize + 3.5f, posY + 14.5f, !vibor.is("Третий") ? ColorUtils.rgba(255, 255, 255, alpha) : ColorUtils.rgba(0, 0, 0, alpha));
        }
    }


    public HUD() {
        addSettings(elements, vibor, elementsShadow);
    }
    @AllArgsConstructor
    @Data
    public static class Staff {
        ITextComponent prefix;
        String name;
        boolean isSpec;
        Status status;
        final Animation animation = new DecelerateAnimation(status == Status.NONE ? 450 : 250, 1f, Direction.FORWARDS);
        boolean onServer;
    }

    public enum Status {
        NONE("", -1),
        VANISHED("V", ColorUtils.rgb(254, 68, 68));
        public final String string;
        public final int color;

        Status(String string, int color) {
            this.string = string;
            this.color = color;
        }
    }

    public float[] getHealthFromScoreboard(LivingEntity target) {
        var ref = new Object() {
            float hp = target.getHealth();
            float maxHp = target.getMaxHealth();
        };
        if (mc.world.getScoreboard().getObjectiveInDisplaySlot(2) != null) {
            mc.world.getScoreboard().getObjectivesForEntity(target.getScoreboardName()).entrySet().stream().findAny().ifPresent(x -> {
                ref.hp = x.getValue().getScorePoints();
                ref.maxHp = 20;
            });
        }
        return new float[]{ref.hp, ref.maxHp};
    }

    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity auraTarget = Estynett.INSTANCE.getModuleManager().getKillAura().getTarget();
        LivingEntity target = nullTarget;
        if (auraTarget != null) {
            stopWatch.reset();
            allow = true;
            target = auraTarget;
        } else if (mc.currentScreen instanceof ChatScreen) {
            stopWatch.reset();
            allow = true;
            target = mc.player;
        } else {
            allow = false;
        }
        return target;
    }
}
Ничего не потеряли с его закрытием
 
Начинающий
Статус
Оффлайн
Регистрация
2 Окт 2024
Сообщения
35
Реакции[?]
0
Поинты[?]
0
Чит закрылся.
Посмотреть вложение 293591ъ

Java:
package dev.estynett.modules.impl.render;

import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import dev.estynett.Estynett;
import dev.estynett.command.staffs.StaffStorage;
import dev.estynett.events.EventRender;
import dev.estynett.events.EventUpdate;
import dev.estynett.modules.api.Category;
import dev.estynett.modules.api.Module;
import dev.estynett.modules.api.ModuleRegister;
import dev.estynett.modules.impl.combat.KillAura;
import dev.estynett.modules.settings.impl.BooleanSetting;
import dev.estynett.modules.settings.impl.ModeListSetting;
import dev.estynett.modules.settings.impl.ModeSetting;
import dev.estynett.ui.styles.Style;
import dev.estynett.utils.animations.Animation;
import dev.estynett.utils.animations.Direction;
import dev.estynett.utils.animations.impl.DecelerateAnimation;
import dev.estynett.utils.animations.impl.EaseBackIn;
import dev.estynett.utils.client.ClientUtil;
import dev.estynett.utils.client.KeyStorage;
import dev.estynett.utils.client.ThemeManager;
import dev.estynett.utils.drag.Dragging;
import dev.estynett.utils.font.FontManager;
import dev.estynett.utils.math.MathUtil;
import dev.estynett.utils.math.StopWatch;
import dev.estynett.utils.math.Vector4i;
import dev.estynett.utils.render.*;
import dev.estynett.utils.render.font.Fonts;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.experimental.FieldDefaults;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.network.play.NetworkPlayerInfo;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.LivingEntity;
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.Vector4f;
import net.minecraft.util.text.ITextComponent;

import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.regex.Pattern;

@FieldDefaults(level = AccessLevel.PRIVATE)
@ModuleRegister(name = "HUD", category = Category.Render)
public class HUD extends Module {

    public static final ModeSetting vibor = new ModeSetting(
            "Тема","Первый", "Первый", "Второй", "Третий"
    );

    private final BooleanSetting elementsShadow = new BooleanSetting("Свечение", false);

    Animation animation = new EaseBackIn(250, 1f, 1f);
    Animation alpha = new EaseBackIn(220, 1f, 1f);

    private final ModeListSetting elements = new ModeListSetting("Элементы",
            new BooleanSetting("Кейбинды", true),
            new BooleanSetting("Администрации", true),
            new BooleanSetting("Поушены", true),
            new BooleanSetting("Лого", true),
            new BooleanSetting("Координаты", true),
            new BooleanSetting("Таргет-Худ", true));

    @Subscribe
    private void onDisplay(EventRender e) {
        if (e.isRender2D()) {
            if (mc.gameSettings.showDebugInfo) {
                return;
            }

            boolean shadowValue = elementsShadow.get();

            if (elements.getValueByName("Лого").get()) logoMethod(e, shadowValue);
            if (elements.getValueByName("Кейбинды").get()) keyBinds(e, shadowValue);
            if (elements.getValueByName("Администрации").get()) staffList(e, shadowValue);
            if (elements.getValueByName("Поушены").get()) potionList(e, shadowValue);
            if (elements.getValueByName("Координаты").get()) coordinates(e);
            if (elements.getValueByName("Таргет-Худ").get()) targetInfo(e, shadowValue);
//            KawaseBlur.blur.updateBlur(3, 2);
//            KawaseBlur.blur.BLURRED.draw();
        }
    }

    private final List<Staff> staffPlayers = new ArrayList<>();
    private final Pattern namePattern = Pattern.compile("^\\w{3,16}$");
    private final Pattern prefixMatches = Pattern.compile(".*(mod|der|adm|help|wne|хелп|адм|поддержка|кура|own|taf|curat|dev|supp|yt|сотруд).*");

    @Subscribe
    private void onUpdate(EventUpdate eventUpdate) {
        staffPlayers.clear();

        for (ScorePlayerTeam team : mc.world.getScoreboard().getTeams().stream().sorted(Comparator.comparing(Team::getName)).toList()) {
            String name = team.getMembershipCollection().toString().replaceAll("[\\[\\]]", "");
            boolean vanish = true;
            for (NetworkPlayerInfo info : mc.getConnection().getPlayerInfoMap()) {
                if (info.getGameProfile().getName().equals(name)) {
                    vanish = false;
                }
            }
            if (namePattern.matcher(name).matches() && !name.equals(mc.player.getName().getString())) {
                if (!vanish) {
                    if (prefixMatches.matcher(team.getPrefix().getString().toLowerCase(Locale.ROOT)).matches() || StaffStorage.isStaff(name)) {
                        Staff staff = new Staff(team.getPrefix(), name, false, Status.NONE, true);
                        staffPlayers.add(staff);
                    }
                }
                if (vanish && !team.getPrefix().getString().isEmpty()) {
                    Staff staff = new Staff(team.getPrefix(), name, true, Status.VANISHED, true);
                    staffPlayers.add(staff);
                }
            }
        }
    }

    private final float fontSize = 7;
    private final float padding = 5;

    Dragging logoXY = Estynett.INSTANCE.createDrag(this, "watermark", 10, 10);
    Dragging keyBinds = Estynett.INSTANCE.createDrag(this, "keybinds", 100, 10);
    Dragging staffList = Estynett.INSTANCE.createDrag(this, "stafflist", 200, 10);
    Dragging potions = Estynett.INSTANCE.createDrag(this, "potions", 300, 10);



    private void logoMethod(EventRender eventDisplay, boolean shadow) {
        MatrixStack matrixStack = eventDisplay.matrixStack;
        float x = 5;
        float y = 5;

        int fps = mc.debugFPS;
        String serverIp = mc.getCurrentServerData() != null ? mc.getCurrentServerData().serverIP : "server is nothing:(";

        float width = 15;
        float height = 14;
        float allWidth = FontManager.sfMedium[18].getWidth("Estynett") + width + FontManager.sfMedium[18].getWidth(" - " + fps + " Fps") + FontManager.sfMedium[18].getWidth(" - " + serverIp) + 5;

        RenderUtil.Render2D.drawRoundedRect(x, y, allWidth, height, 2.5f, ThemeManager.getStartColor());
        if (shadow) {
            RenderUtil.Render2D.drawShadow(x + 15, y + 3, FontManager.sfMedium[18].getWidth("Estynett"), 9, 10, RenderUtil.reAlphaInt(ThemeManager.getEndColor(), 100));
        }
        if (shadow) {
            RenderUtil.Render2D.drawShadow(x + 2.5f, y + 2.5f, 10, 10, 10, RenderUtil.reAlphaInt(ThemeManager.getEndColor(), 100));
        }
        FontManager.sfMedium[18].drawString(matrixStack, "Estynett", x + 15, y + 4,ThemeManager.getEndColor());
        RenderUtil.Render2D.drawImage(matrixStack, new ResourceLocation("expensive/images/WATERMARK.png"), x + 2.5f, y + 2.5f,0, 10, 10, ThemeManager.getEndColor(), ThemeManager.getEndColor(),ThemeManager.getEndColor(),ThemeManager.getEndColor());

        FontManager.sfMedium[18].drawString(matrixStack, " - " + fps + " Fps", x + 52, y + 4, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0,0));
        FontManager.sfMedium[18].drawString(matrixStack, " - " + serverIp, x + FontManager.sfMedium[18].getWidth(" - " + fps + " Fps") + FontManager.sfMedium[18].getWidth("Estynett") + 17, y + 4, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0,0));
    }

    float kbWidth, kbWidthAnim = 0;
    float kbHeght, kbHeightAnim = 0;
    private void keyBinds(EventRender eventRender, boolean glow) {
        MatrixStack ms = eventRender.matrixStack;
        float xPosition = keyBinds.getX();
        float yPosition = keyBinds.getY();

        if(glow) {
            RenderUtil.Render2D.drawShadow(xPosition, yPosition, kbWidthAnim, kbHeightAnim, 5, ThemeManager.getStartColor());
        }
        RenderUtil.Render2D.drawRoundedRect(xPosition, yPosition, kbWidthAnim, kbHeightAnim, 4, ThemeManager.getStartColor());


        FontManager.sfMedium[16].drawCenteredString(ms, "Hotkeys", xPosition + kbWidthAnim / 2f, yPosition + 6, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0, 0));
        Fonts.icon.drawCenteredText(ms, "C", xPosition + kbWidthAnim / 2f - 24, yPosition + 4.5f, ThemeManager.getEndColor(), 10);

        kbHeightAnim = MathUtil.fast(kbHeightAnim, kbHeght, 15);
        kbWidthAnim = MathUtil.fast(kbWidthAnim, kbWidth, 15);

        float maxWidth = FontManager.sfMedium[16].getWidth("Hotkeys") + padding * 2;

        Scissor.push();
        Scissor.setFromComponentCoordinates(xPosition, yPosition, kbWidth, kbHeght);
        int i = 0;
        for (Module f : Estynett.INSTANCE.getModuleManager().getModules()) {
            f.getAnimation().update();
            if (!f.isState() || f.getBind() == 0) continue;

            String nameText = f.getName();
            float nameWidth = FontManager.sfMedium[14].getWidth(nameText);

            String bindText = KeyStorage.getKey(f.getBind());
            float bindWidth = FontManager.sfMedium[14].getWidth(bindText);

            float localWidth = nameWidth + bindWidth + padding * 3.0F + 4.0F;

            FontManager.sfMedium[14].drawString(ms, nameText, xPosition + padding - 1, yPosition + 19.5f + (i * 10),!vibor.is("Третий") ?
                    ColorUtils.rgba(255, 255, 255, (int) (255 * f.getAnimation().getValue())) : ColorUtils.rgba(0, 0, 0, (int) (255 * f.getAnimation().getValue())));
            RenderUtil.Render2D.drawRoundedRect(xPosition + kbWidth - bindWidth - 6, yPosition + 17f + (i * 10), bindWidth + 3.5f, 8.5f, 1.5f,!vibor.is("Третий") ? ColorUtils.rgb(41, 41, 41) : ColorUtils.rgb(210, 210, 210));
            FontManager.sfMedium[14].drawString(ms, bindText, xPosition + kbWidth - bindWidth - 4, yPosition + 19.5f + (i * 10), RenderUtil.reAlphaInt(ThemeManager.getEndColor(), (int) (255 * f.getAnimation().getValue())));

            if (localWidth > maxWidth) {
                maxWidth = localWidth;
            }
            i++;
        }
        if (i > 0) {
            animation.setDirection(Direction.FORWARDS);
            alpha.setDirection(Direction.FORWARDS);
        } else {
            animation.setDirection(Direction.BACKWARDS);
            alpha.setDirection(Direction.BACKWARDS);
        }
        Scissor.unset();
        Scissor.pop();
        kbWidth = Math.max(maxWidth, 75);
        kbHeght = 19 + (i * 10);
        keyBinds.setWidth(kbWidth);
        keyBinds.setHeight(kbHeght);
    }


    float slWidth, slAnimateWidth = 0;
    float slHeight, slAnimateHeight = 0;
    private void staffList(EventRender eventRender, boolean glow) {
        MatrixStack ms = eventRender.matrixStack;
        float xPosition = staffList.getX();
        float yPosition = staffList.getY();

        if(glow) {
            RenderUtil.Render2D.drawShadow(xPosition, yPosition, slAnimateWidth, slAnimateHeight, 5, ThemeManager.getStartColor());
        }
        RenderUtil.Render2D.drawRoundedRect(xPosition, yPosition, slAnimateWidth, slAnimateHeight, 4, ThemeManager.getStartColor());

        FontManager.sfMedium[16].drawCenteredString(ms, "Stafflist", xPosition + slAnimateWidth / 2f, yPosition + 6, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0, 0));
        Fonts.icon.drawCenteredText(ms, "O", xPosition + slAnimateWidth / 2f - 24, yPosition + 4.5f, ThemeManager.getEndColor(), 10);

        slAnimateWidth = MathUtil.fast(slAnimateWidth, slWidth, 15);
        slAnimateHeight = MathUtil.fast(slAnimateHeight, slHeight, 15);

        float maxWidth = FontManager.sfMedium[14].getWidth("Stafflist") + padding * 2;

        int i = 0;
        for (Staff f : staffPlayers) {
            if (!(f.getAnimation().getOutput() > 0)) continue;
            ITextComponent prefix = f.getPrefix();
            float prefixWidth = FontManager.sfMedium[14].getWidth(prefix.getString());
            String staff = (prefix.getString().isEmpty() ? "  " : " ") + f.getName();
            float nameWidth = FontManager.sfMedium[14].getWidth(staff);

            float localWidth = prefixWidth + nameWidth + Fonts.montserrat.getWidth(f.getStatus().string, fontSize) + padding * 3;

            FontManager.sfMedium[14].drawString(ms, prefix, xPosition + 1, yPosition + 19.5f + (i * 10), (int) (f.animation.getOutput() * 255));
            FontManager.sfMedium[14].drawString(ms, staff, xPosition + padding + prefixWidth - 5, yPosition + 19.5f + (i * 10), -1);
            FontManager.sfMedium[14].drawString(ms, f.getStatus().string, xPosition + slWidth - padding - FontManager.sfMedium[14].getWidth(f.getStatus().string) + 2, yPosition + 19.5f + (i * 10), ColorUtils.setAlpha(f.getStatus().color, (int) (f.animation.getOutput() * 255)));

            if (localWidth > maxWidth) {
                maxWidth = localWidth;
            }
            i++;
        }
        if (i > 0) {
            animation.setDirection(Direction.FORWARDS);
            alpha.setDirection(Direction.FORWARDS);
        } else {
            animation.setDirection(Direction.BACKWARDS);
            alpha.setDirection(Direction.BACKWARDS);
        }
        slHeight = 19 + (i * 10);
        slWidth = Math.max(maxWidth, 75);
        staffList.setWidth(slWidth);
        staffList.setHeight(slHeight);
    }

    //

    private Map<String, DecelerateAnimation> animations = new HashMap<>();

    float potWidth, potWidthAnim = 0;
    float potHeight, potHeigthAnim = 0;
    private void potionList(EventRender eventRender, boolean glow) {
        MatrixStack ms = eventRender.matrixStack;
        float xPosition = potions.getX();
        float yPosition = potions.getY();

        if(glow) {
            RenderUtil.Render2D.drawShadow(xPosition, yPosition, potWidthAnim, potHeigthAnim, 5, ThemeManager.getStartColor());
        }
        RenderUtil.Render2D.drawRoundedRect(xPosition, yPosition, potWidthAnim, potHeigthAnim, 4, ThemeManager.getStartColor());

        FontManager.sfMedium[16].drawCenteredString(ms, "Potions", xPosition + potWidthAnim / 2f, yPosition + 6, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0, 0));
        Fonts.icon.drawCenteredText(ms, "E", xPosition + potWidthAnim / 2f - 24, yPosition + 4.5f, ThemeManager.getEndColor(), 10);
        potWidthAnim = MathUtil.fast(potWidthAnim, potWidth, 15);
        potHeigthAnim = MathUtil.fast(potHeigthAnim, potHeight, 15);

        float maxWidth = FontManager.sfMedium[16].getWidth("Potions") + padding * 2;
        int i = 0;

        for (EffectInstance ef : mc.player.getActivePotionEffects()) {
            int amp = ef.getAmplifier();

            String ampStr = "";

            if (amp >= 1 && amp <= 9) {
                ampStr = " " + (amp + 1);
            }

            DecelerateAnimation efAnimation = animations.getOrDefault(ef.getEffectName(), null);
            if (efAnimation == null) {
                efAnimation = new DecelerateAnimation(250, 1, Direction.FORWARDS);
                animations.put(ef.getEffectName(), efAnimation);
            }

            boolean potionActive = ef.getDuration() > 5;
            efAnimation.setDirection(potionActive ? Direction.FORWARDS : Direction.BACKWARDS);

            String nameText = I18n.format(ef.getEffectName()) + ampStr;
            float nameWidth = FontManager.sfMedium[14].getWidth(nameText);

            String bindText = EffectUtils.getPotionDurationString(ef, 1);
            float bindWidth = FontManager.sfMedium[14].getWidth(bindText);

            float localWidth = nameWidth + bindWidth + padding * 3;

            FontManager.sfMedium[14].drawString(ms, nameText, xPosition + padding - 1, yPosition + 19.5f + (i * 10), !vibor.is("Третий") ?
                    ColorUtils.rgba(255, 255, 255, (int) (255 * efAnimation.getOutput())) : ColorUtils.rgba(0, 0, 0, (int) (255 * efAnimation.getOutput())));
            RenderUtil.Render2D.drawRoundedRect(xPosition + potWidth - bindWidth - 7, yPosition + 17f + (i * 10), bindWidth + 3.5f, 8.5f, 1.5f,!vibor.is("Третий") ? ColorUtils.rgb(41, 41, 41) : ColorUtils.rgb(210, 210, 210));
            FontManager.sfMedium[14].drawString(ms, bindText, xPosition + potWidth - padding - bindWidth, yPosition + 19.5f + (i * 10), !vibor.is("Третий") ?
                    ColorUtils.rgba(255, 255, 255, (int) (255 * efAnimation.getOutput())) : ColorUtils.rgba(0, 0, 0, (int) (255 * efAnimation.getOutput())));
            i++;

            if (localWidth > maxWidth) {
                maxWidth = localWidth;
            }

        }
        if (animations != null) animations.keySet().removeIf((type) -> mc.player.getActivePotionEffects().stream().map((effect) -> effect.getPotion().getName()).noneMatch((type2) -> type2.equals(type)));
        if (i > 0) {
            animation.setDirection(Direction.FORWARDS);
            alpha.setDirection(Direction.FORWARDS);
        } else {
            animation.setDirection(Direction.BACKWARDS);
            alpha.setDirection(Direction.BACKWARDS);
        }
        potHeight = 19 + (i * 10);
        potWidth = Math.max(maxWidth, 75);
        potions.setWidth(potWidth);
        potions.setHeight(potHeight);
    }

    private void coordinates(EventRender eventRender) {

    }

    StopWatch stopWatch = new StopWatch();

    Dragging drag = Estynett.INSTANCE.createDrag(this, "th",100, 100);

    final Animation animation2 = new EaseBackIn(200, 1, 1);

    LivingEntity entity = null;

    boolean allow;

    float healthAnimation = 0.0f;
    float absorptionAnimation = 0.0f;

    private void targetInfo(EventRender eventRender, boolean shadow) {
        entity = getTarget(entity);
        boolean out = !allow;
        animation.setDuration(out ? 400 : 300);
        animation2.setDuration(350);
        animation.setDirection(out ? Direction.BACKWARDS : Direction.FORWARDS);
        animation2.setDirection(out ? Direction.BACKWARDS : Direction.FORWARDS);


        if (entity != null) {
            float posX = drag.getX();
            float posY = drag.getY();

            float headSize = 28;

            float width = 89;
            float height = 33;
            drag.setWidth(width);
            drag.setHeight(height);

            float hp = ClientUtil.isConnectedToServer("reallyworld") ? getHealthFromScoreboard(entity)[0] : entity.getHealth();
            float maxHp = entity.getMaxHealth();

            healthAnimation = MathHelper.clamp(hp / maxHp, 0, 1);
            absorptionAnimation = MathHelper.clamp(entity.getAbsorptionAmount() / maxHp, 0, 1);

            int alpha = MathHelper.clamp((int) (animation2.getOutput() * 255), 0, 255);

            RenderUtil.Render2D.drawRoundedRect(posX, posY, width, height, 2.5f, RenderUtil.reAlphaInt(ThemeManager.getStartColor(), alpha));
            RenderUtil.Render2D.drawRoundedRect(posX + headSize + 3.5f, posY + 22.5f, (width - 35), 5, 1.5f, ColorUtils.rgba(14, 14, 14, alpha));
            RenderUtil.Render2D.drawRoundedRect(posX + headSize + 3.5f, posY + 22.5f, (width - 35) * healthAnimation, 5, 1.5f, RenderUtil.reAlphaInt(ThemeManager.getEndColor(), alpha));
            if (alpha > 0) {
                RenderUtil.Render2D.drawTargetHead(entity, posX + 2.5f, posY + 2.5f, headSize, headSize);
            }

            Scissor.push();
            Scissor.setFromComponentCoordinates(posX, posY, width - 6, height);
            FontManager.sfRegular[16].drawString(eventRender.matrixStack,entity.getName().getString(), posX + headSize + 3.5f, posY + 3.5f,!vibor.is("Третий") ? ColorUtils.rgba(255, 255, 255, alpha) : ColorUtils.rgba(0, 0, 0, alpha));
            Scissor.unset();
            Scissor.pop();

            FontManager.sfRegular[14].drawString(eventRender.matrixStack,"HP: " + (ClientUtil.isConnectedToServer("reallyworld") ? String.valueOf(getHealthFromScoreboard(entity)[0]) : ((int) entity.getHealth() + (int) mc.player.getAbsorptionAmount())),posX + headSize + 3.5f, posY + 14.5f, !vibor.is("Третий") ? ColorUtils.rgba(255, 255, 255, alpha) : ColorUtils.rgba(0, 0, 0, alpha));
        }
    }


    public HUD() {
        addSettings(elements, vibor, elementsShadow);
    }
    @AllArgsConstructor
    @Data
    public static class Staff {
        ITextComponent prefix;
        String name;
        boolean isSpec;
        Status status;
        final Animation animation = new DecelerateAnimation(status == Status.NONE ? 450 : 250, 1f, Direction.FORWARDS);
        boolean onServer;
    }

    public enum Status {
        NONE("", -1),
        VANISHED("V", ColorUtils.rgb(254, 68, 68));
        public final String string;
        public final int color;

        Status(String string, int color) {
            this.string = string;
            this.color = color;
        }
    }

    public float[] getHealthFromScoreboard(LivingEntity target) {
        var ref = new Object() {
            float hp = target.getHealth();
            float maxHp = target.getMaxHealth();
        };
        if (mc.world.getScoreboard().getObjectiveInDisplaySlot(2) != null) {
            mc.world.getScoreboard().getObjectivesForEntity(target.getScoreboardName()).entrySet().stream().findAny().ifPresent(x -> {
                ref.hp = x.getValue().getScorePoints();
                ref.maxHp = 20;
            });
        }
        return new float[]{ref.hp, ref.maxHp};
    }

    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity auraTarget = Estynett.INSTANCE.getModuleManager().getKillAura().getTarget();
        LivingEntity target = nullTarget;
        if (auraTarget != null) {
            stopWatch.reset();
            allow = true;
            target = auraTarget;
        } else if (mc.currentScreen instanceof ChatScreen) {
            stopWatch.reset();
            allow = true;
            target = mc.player;
        } else {
            allow = false;
        }
        return target;
    }
}
чем то похоже на старый худ дельты
 
Начинающий
Статус
Оффлайн
Регистрация
26 Окт 2024
Сообщения
101
Реакции[?]
0
Поинты[?]
0
Начинающий
Статус
Оффлайн
Регистрация
15 Июн 2024
Сообщения
746
Реакции[?]
7
Поинты[?]
4K
Начинающий
Статус
Оффлайн
Регистрация
14 Окт 2024
Сообщения
20
Реакции[?]
0
Поинты[?]
0
Чит закрылся.
Посмотреть вложение 293591ъ

Java:
package dev.estynett.modules.impl.render;

import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import dev.estynett.Estynett;
import dev.estynett.command.staffs.StaffStorage;
import dev.estynett.events.EventRender;
import dev.estynett.events.EventUpdate;
import dev.estynett.modules.api.Category;
import dev.estynett.modules.api.Module;
import dev.estynett.modules.api.ModuleRegister;
import dev.estynett.modules.impl.combat.KillAura;
import dev.estynett.modules.settings.impl.BooleanSetting;
import dev.estynett.modules.settings.impl.ModeListSetting;
import dev.estynett.modules.settings.impl.ModeSetting;
import dev.estynett.ui.styles.Style;
import dev.estynett.utils.animations.Animation;
import dev.estynett.utils.animations.Direction;
import dev.estynett.utils.animations.impl.DecelerateAnimation;
import dev.estynett.utils.animations.impl.EaseBackIn;
import dev.estynett.utils.client.ClientUtil;
import dev.estynett.utils.client.KeyStorage;
import dev.estynett.utils.client.ThemeManager;
import dev.estynett.utils.drag.Dragging;
import dev.estynett.utils.font.FontManager;
import dev.estynett.utils.math.MathUtil;
import dev.estynett.utils.math.StopWatch;
import dev.estynett.utils.math.Vector4i;
import dev.estynett.utils.render.*;
import dev.estynett.utils.render.font.Fonts;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.experimental.FieldDefaults;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.network.play.NetworkPlayerInfo;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.LivingEntity;
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.Vector4f;
import net.minecraft.util.text.ITextComponent;

import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.regex.Pattern;

@FieldDefaults(level = AccessLevel.PRIVATE)
@ModuleRegister(name = "HUD", category = Category.Render)
public class HUD extends Module {

    public static final ModeSetting vibor = new ModeSetting(
            "Тема","Первый", "Первый", "Второй", "Третий"
    );

    private final BooleanSetting elementsShadow = new BooleanSetting("Свечение", false);

    Animation animation = new EaseBackIn(250, 1f, 1f);
    Animation alpha = new EaseBackIn(220, 1f, 1f);

    private final ModeListSetting elements = new ModeListSetting("Элементы",
            new BooleanSetting("Кейбинды", true),
            new BooleanSetting("Администрации", true),
            new BooleanSetting("Поушены", true),
            new BooleanSetting("Лого", true),
            new BooleanSetting("Координаты", true),
            new BooleanSetting("Таргет-Худ", true));

    @Subscribe
    private void onDisplay(EventRender e) {
        if (e.isRender2D()) {
            if (mc.gameSettings.showDebugInfo) {
                return;
            }

            boolean shadowValue = elementsShadow.get();

            if (elements.getValueByName("Лого").get()) logoMethod(e, shadowValue);
            if (elements.getValueByName("Кейбинды").get()) keyBinds(e, shadowValue);
            if (elements.getValueByName("Администрации").get()) staffList(e, shadowValue);
            if (elements.getValueByName("Поушены").get()) potionList(e, shadowValue);
            if (elements.getValueByName("Координаты").get()) coordinates(e);
            if (elements.getValueByName("Таргет-Худ").get()) targetInfo(e, shadowValue);
//            KawaseBlur.blur.updateBlur(3, 2);
//            KawaseBlur.blur.BLURRED.draw();
        }
    }

    private final List<Staff> staffPlayers = new ArrayList<>();
    private final Pattern namePattern = Pattern.compile("^\\w{3,16}$");
    private final Pattern prefixMatches = Pattern.compile(".*(mod|der|adm|help|wne|хелп|адм|поддержка|кура|own|taf|curat|dev|supp|yt|сотруд).*");

    @Subscribe
    private void onUpdate(EventUpdate eventUpdate) {
        staffPlayers.clear();

        for (ScorePlayerTeam team : mc.world.getScoreboard().getTeams().stream().sorted(Comparator.comparing(Team::getName)).toList()) {
            String name = team.getMembershipCollection().toString().replaceAll("[\\[\\]]", "");
            boolean vanish = true;
            for (NetworkPlayerInfo info : mc.getConnection().getPlayerInfoMap()) {
                if (info.getGameProfile().getName().equals(name)) {
                    vanish = false;
                }
            }
            if (namePattern.matcher(name).matches() && !name.equals(mc.player.getName().getString())) {
                if (!vanish) {
                    if (prefixMatches.matcher(team.getPrefix().getString().toLowerCase(Locale.ROOT)).matches() || StaffStorage.isStaff(name)) {
                        Staff staff = new Staff(team.getPrefix(), name, false, Status.NONE, true);
                        staffPlayers.add(staff);
                    }
                }
                if (vanish && !team.getPrefix().getString().isEmpty()) {
                    Staff staff = new Staff(team.getPrefix(), name, true, Status.VANISHED, true);
                    staffPlayers.add(staff);
                }
            }
        }
    }

    private final float fontSize = 7;
    private final float padding = 5;

    Dragging logoXY = Estynett.INSTANCE.createDrag(this, "watermark", 10, 10);
    Dragging keyBinds = Estynett.INSTANCE.createDrag(this, "keybinds", 100, 10);
    Dragging staffList = Estynett.INSTANCE.createDrag(this, "stafflist", 200, 10);
    Dragging potions = Estynett.INSTANCE.createDrag(this, "potions", 300, 10);



    private void logoMethod(EventRender eventDisplay, boolean shadow) {
        MatrixStack matrixStack = eventDisplay.matrixStack;
        float x = 5;
        float y = 5;

        int fps = mc.debugFPS;
        String serverIp = mc.getCurrentServerData() != null ? mc.getCurrentServerData().serverIP : "server is nothing:(";

        float width = 15;
        float height = 14;
        float allWidth = FontManager.sfMedium[18].getWidth("Estynett") + width + FontManager.sfMedium[18].getWidth(" - " + fps + " Fps") + FontManager.sfMedium[18].getWidth(" - " + serverIp) + 5;

        RenderUtil.Render2D.drawRoundedRect(x, y, allWidth, height, 2.5f, ThemeManager.getStartColor());
        if (shadow) {
            RenderUtil.Render2D.drawShadow(x + 15, y + 3, FontManager.sfMedium[18].getWidth("Estynett"), 9, 10, RenderUtil.reAlphaInt(ThemeManager.getEndColor(), 100));
        }
        if (shadow) {
            RenderUtil.Render2D.drawShadow(x + 2.5f, y + 2.5f, 10, 10, 10, RenderUtil.reAlphaInt(ThemeManager.getEndColor(), 100));
        }
        FontManager.sfMedium[18].drawString(matrixStack, "Estynett", x + 15, y + 4,ThemeManager.getEndColor());
        RenderUtil.Render2D.drawImage(matrixStack, new ResourceLocation("expensive/images/WATERMARK.png"), x + 2.5f, y + 2.5f,0, 10, 10, ThemeManager.getEndColor(), ThemeManager.getEndColor(),ThemeManager.getEndColor(),ThemeManager.getEndColor());

        FontManager.sfMedium[18].drawString(matrixStack, " - " + fps + " Fps", x + 52, y + 4, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0,0));
        FontManager.sfMedium[18].drawString(matrixStack, " - " + serverIp, x + FontManager.sfMedium[18].getWidth(" - " + fps + " Fps") + FontManager.sfMedium[18].getWidth("Estynett") + 17, y + 4, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0,0));
    }

    float kbWidth, kbWidthAnim = 0;
    float kbHeght, kbHeightAnim = 0;
    private void keyBinds(EventRender eventRender, boolean glow) {
        MatrixStack ms = eventRender.matrixStack;
        float xPosition = keyBinds.getX();
        float yPosition = keyBinds.getY();

        if(glow) {
            RenderUtil.Render2D.drawShadow(xPosition, yPosition, kbWidthAnim, kbHeightAnim, 5, ThemeManager.getStartColor());
        }
        RenderUtil.Render2D.drawRoundedRect(xPosition, yPosition, kbWidthAnim, kbHeightAnim, 4, ThemeManager.getStartColor());


        FontManager.sfMedium[16].drawCenteredString(ms, "Hotkeys", xPosition + kbWidthAnim / 2f, yPosition + 6, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0, 0));
        Fonts.icon.drawCenteredText(ms, "C", xPosition + kbWidthAnim / 2f - 24, yPosition + 4.5f, ThemeManager.getEndColor(), 10);

        kbHeightAnim = MathUtil.fast(kbHeightAnim, kbHeght, 15);
        kbWidthAnim = MathUtil.fast(kbWidthAnim, kbWidth, 15);

        float maxWidth = FontManager.sfMedium[16].getWidth("Hotkeys") + padding * 2;

        Scissor.push();
        Scissor.setFromComponentCoordinates(xPosition, yPosition, kbWidth, kbHeght);
        int i = 0;
        for (Module f : Estynett.INSTANCE.getModuleManager().getModules()) {
            f.getAnimation().update();
            if (!f.isState() || f.getBind() == 0) continue;

            String nameText = f.getName();
            float nameWidth = FontManager.sfMedium[14].getWidth(nameText);

            String bindText = KeyStorage.getKey(f.getBind());
            float bindWidth = FontManager.sfMedium[14].getWidth(bindText);

            float localWidth = nameWidth + bindWidth + padding * 3.0F + 4.0F;

            FontManager.sfMedium[14].drawString(ms, nameText, xPosition + padding - 1, yPosition + 19.5f + (i * 10),!vibor.is("Третий") ?
                    ColorUtils.rgba(255, 255, 255, (int) (255 * f.getAnimation().getValue())) : ColorUtils.rgba(0, 0, 0, (int) (255 * f.getAnimation().getValue())));
            RenderUtil.Render2D.drawRoundedRect(xPosition + kbWidth - bindWidth - 6, yPosition + 17f + (i * 10), bindWidth + 3.5f, 8.5f, 1.5f,!vibor.is("Третий") ? ColorUtils.rgb(41, 41, 41) : ColorUtils.rgb(210, 210, 210));
            FontManager.sfMedium[14].drawString(ms, bindText, xPosition + kbWidth - bindWidth - 4, yPosition + 19.5f + (i * 10), RenderUtil.reAlphaInt(ThemeManager.getEndColor(), (int) (255 * f.getAnimation().getValue())));

            if (localWidth > maxWidth) {
                maxWidth = localWidth;
            }
            i++;
        }
        if (i > 0) {
            animation.setDirection(Direction.FORWARDS);
            alpha.setDirection(Direction.FORWARDS);
        } else {
            animation.setDirection(Direction.BACKWARDS);
            alpha.setDirection(Direction.BACKWARDS);
        }
        Scissor.unset();
        Scissor.pop();
        kbWidth = Math.max(maxWidth, 75);
        kbHeght = 19 + (i * 10);
        keyBinds.setWidth(kbWidth);
        keyBinds.setHeight(kbHeght);
    }


    float slWidth, slAnimateWidth = 0;
    float slHeight, slAnimateHeight = 0;
    private void staffList(EventRender eventRender, boolean glow) {
        MatrixStack ms = eventRender.matrixStack;
        float xPosition = staffList.getX();
        float yPosition = staffList.getY();

        if(glow) {
            RenderUtil.Render2D.drawShadow(xPosition, yPosition, slAnimateWidth, slAnimateHeight, 5, ThemeManager.getStartColor());
        }
        RenderUtil.Render2D.drawRoundedRect(xPosition, yPosition, slAnimateWidth, slAnimateHeight, 4, ThemeManager.getStartColor());

        FontManager.sfMedium[16].drawCenteredString(ms, "Stafflist", xPosition + slAnimateWidth / 2f, yPosition + 6, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0, 0));
        Fonts.icon.drawCenteredText(ms, "O", xPosition + slAnimateWidth / 2f - 24, yPosition + 4.5f, ThemeManager.getEndColor(), 10);

        slAnimateWidth = MathUtil.fast(slAnimateWidth, slWidth, 15);
        slAnimateHeight = MathUtil.fast(slAnimateHeight, slHeight, 15);

        float maxWidth = FontManager.sfMedium[14].getWidth("Stafflist") + padding * 2;

        int i = 0;
        for (Staff f : staffPlayers) {
            if (!(f.getAnimation().getOutput() > 0)) continue;
            ITextComponent prefix = f.getPrefix();
            float prefixWidth = FontManager.sfMedium[14].getWidth(prefix.getString());
            String staff = (prefix.getString().isEmpty() ? "  " : " ") + f.getName();
            float nameWidth = FontManager.sfMedium[14].getWidth(staff);

            float localWidth = prefixWidth + nameWidth + Fonts.montserrat.getWidth(f.getStatus().string, fontSize) + padding * 3;

            FontManager.sfMedium[14].drawString(ms, prefix, xPosition + 1, yPosition + 19.5f + (i * 10), (int) (f.animation.getOutput() * 255));
            FontManager.sfMedium[14].drawString(ms, staff, xPosition + padding + prefixWidth - 5, yPosition + 19.5f + (i * 10), -1);
            FontManager.sfMedium[14].drawString(ms, f.getStatus().string, xPosition + slWidth - padding - FontManager.sfMedium[14].getWidth(f.getStatus().string) + 2, yPosition + 19.5f + (i * 10), ColorUtils.setAlpha(f.getStatus().color, (int) (f.animation.getOutput() * 255)));

            if (localWidth > maxWidth) {
                maxWidth = localWidth;
            }
            i++;
        }
        if (i > 0) {
            animation.setDirection(Direction.FORWARDS);
            alpha.setDirection(Direction.FORWARDS);
        } else {
            animation.setDirection(Direction.BACKWARDS);
            alpha.setDirection(Direction.BACKWARDS);
        }
        slHeight = 19 + (i * 10);
        slWidth = Math.max(maxWidth, 75);
        staffList.setWidth(slWidth);
        staffList.setHeight(slHeight);
    }

    //

    private Map<String, DecelerateAnimation> animations = new HashMap<>();

    float potWidth, potWidthAnim = 0;
    float potHeight, potHeigthAnim = 0;
    private void potionList(EventRender eventRender, boolean glow) {
        MatrixStack ms = eventRender.matrixStack;
        float xPosition = potions.getX();
        float yPosition = potions.getY();

        if(glow) {
            RenderUtil.Render2D.drawShadow(xPosition, yPosition, potWidthAnim, potHeigthAnim, 5, ThemeManager.getStartColor());
        }
        RenderUtil.Render2D.drawRoundedRect(xPosition, yPosition, potWidthAnim, potHeigthAnim, 4, ThemeManager.getStartColor());

        FontManager.sfMedium[16].drawCenteredString(ms, "Potions", xPosition + potWidthAnim / 2f, yPosition + 6, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0, 0));
        Fonts.icon.drawCenteredText(ms, "E", xPosition + potWidthAnim / 2f - 24, yPosition + 4.5f, ThemeManager.getEndColor(), 10);
        potWidthAnim = MathUtil.fast(potWidthAnim, potWidth, 15);
        potHeigthAnim = MathUtil.fast(potHeigthAnim, potHeight, 15);

        float maxWidth = FontManager.sfMedium[16].getWidth("Potions") + padding * 2;
        int i = 0;

        for (EffectInstance ef : mc.player.getActivePotionEffects()) {
            int amp = ef.getAmplifier();

            String ampStr = "";

            if (amp >= 1 && amp <= 9) {
                ampStr = " " + (amp + 1);
            }

            DecelerateAnimation efAnimation = animations.getOrDefault(ef.getEffectName(), null);
            if (efAnimation == null) {
                efAnimation = new DecelerateAnimation(250, 1, Direction.FORWARDS);
                animations.put(ef.getEffectName(), efAnimation);
            }

            boolean potionActive = ef.getDuration() > 5;
            efAnimation.setDirection(potionActive ? Direction.FORWARDS : Direction.BACKWARDS);

            String nameText = I18n.format(ef.getEffectName()) + ampStr;
            float nameWidth = FontManager.sfMedium[14].getWidth(nameText);

            String bindText = EffectUtils.getPotionDurationString(ef, 1);
            float bindWidth = FontManager.sfMedium[14].getWidth(bindText);

            float localWidth = nameWidth + bindWidth + padding * 3;

            FontManager.sfMedium[14].drawString(ms, nameText, xPosition + padding - 1, yPosition + 19.5f + (i * 10), !vibor.is("Третий") ?
                    ColorUtils.rgba(255, 255, 255, (int) (255 * efAnimation.getOutput())) : ColorUtils.rgba(0, 0, 0, (int) (255 * efAnimation.getOutput())));
            RenderUtil.Render2D.drawRoundedRect(xPosition + potWidth - bindWidth - 7, yPosition + 17f + (i * 10), bindWidth + 3.5f, 8.5f, 1.5f,!vibor.is("Третий") ? ColorUtils.rgb(41, 41, 41) : ColorUtils.rgb(210, 210, 210));
            FontManager.sfMedium[14].drawString(ms, bindText, xPosition + potWidth - padding - bindWidth, yPosition + 19.5f + (i * 10), !vibor.is("Третий") ?
                    ColorUtils.rgba(255, 255, 255, (int) (255 * efAnimation.getOutput())) : ColorUtils.rgba(0, 0, 0, (int) (255 * efAnimation.getOutput())));
            i++;

            if (localWidth > maxWidth) {
                maxWidth = localWidth;
            }

        }
        if (animations != null) animations.keySet().removeIf((type) -> mc.player.getActivePotionEffects().stream().map((effect) -> effect.getPotion().getName()).noneMatch((type2) -> type2.equals(type)));
        if (i > 0) {
            animation.setDirection(Direction.FORWARDS);
            alpha.setDirection(Direction.FORWARDS);
        } else {
            animation.setDirection(Direction.BACKWARDS);
            alpha.setDirection(Direction.BACKWARDS);
        }
        potHeight = 19 + (i * 10);
        potWidth = Math.max(maxWidth, 75);
        potions.setWidth(potWidth);
        potions.setHeight(potHeight);
    }

    private void coordinates(EventRender eventRender) {

    }

    StopWatch stopWatch = new StopWatch();

    Dragging drag = Estynett.INSTANCE.createDrag(this, "th",100, 100);

    final Animation animation2 = new EaseBackIn(200, 1, 1);

    LivingEntity entity = null;

    boolean allow;

    float healthAnimation = 0.0f;
    float absorptionAnimation = 0.0f;

    private void targetInfo(EventRender eventRender, boolean shadow) {
        entity = getTarget(entity);
        boolean out = !allow;
        animation.setDuration(out ? 400 : 300);
        animation2.setDuration(350);
        animation.setDirection(out ? Direction.BACKWARDS : Direction.FORWARDS);
        animation2.setDirection(out ? Direction.BACKWARDS : Direction.FORWARDS);


        if (entity != null) {
            float posX = drag.getX();
            float posY = drag.getY();

            float headSize = 28;

            float width = 89;
            float height = 33;
            drag.setWidth(width);
            drag.setHeight(height);

            float hp = ClientUtil.isConnectedToServer("reallyworld") ? getHealthFromScoreboard(entity)[0] : entity.getHealth();
            float maxHp = entity.getMaxHealth();

            healthAnimation = MathHelper.clamp(hp / maxHp, 0, 1);
            absorptionAnimation = MathHelper.clamp(entity.getAbsorptionAmount() / maxHp, 0, 1);

            int alpha = MathHelper.clamp((int) (animation2.getOutput() * 255), 0, 255);

            RenderUtil.Render2D.drawRoundedRect(posX, posY, width, height, 2.5f, RenderUtil.reAlphaInt(ThemeManager.getStartColor(), alpha));
            RenderUtil.Render2D.drawRoundedRect(posX + headSize + 3.5f, posY + 22.5f, (width - 35), 5, 1.5f, ColorUtils.rgba(14, 14, 14, alpha));
            RenderUtil.Render2D.drawRoundedRect(posX + headSize + 3.5f, posY + 22.5f, (width - 35) * healthAnimation, 5, 1.5f, RenderUtil.reAlphaInt(ThemeManager.getEndColor(), alpha));
            if (alpha > 0) {
                RenderUtil.Render2D.drawTargetHead(entity, posX + 2.5f, posY + 2.5f, headSize, headSize);
            }

            Scissor.push();
            Scissor.setFromComponentCoordinates(posX, posY, width - 6, height);
            FontManager.sfRegular[16].drawString(eventRender.matrixStack,entity.getName().getString(), posX + headSize + 3.5f, posY + 3.5f,!vibor.is("Третий") ? ColorUtils.rgba(255, 255, 255, alpha) : ColorUtils.rgba(0, 0, 0, alpha));
            Scissor.unset();
            Scissor.pop();

            FontManager.sfRegular[14].drawString(eventRender.matrixStack,"HP: " + (ClientUtil.isConnectedToServer("reallyworld") ? String.valueOf(getHealthFromScoreboard(entity)[0]) : ((int) entity.getHealth() + (int) mc.player.getAbsorptionAmount())),posX + headSize + 3.5f, posY + 14.5f, !vibor.is("Третий") ? ColorUtils.rgba(255, 255, 255, alpha) : ColorUtils.rgba(0, 0, 0, alpha));
        }
    }


    public HUD() {
        addSettings(elements, vibor, elementsShadow);
    }
    @AllArgsConstructor
    @Data
    public static class Staff {
        ITextComponent prefix;
        String name;
        boolean isSpec;
        Status status;
        final Animation animation = new DecelerateAnimation(status == Status.NONE ? 450 : 250, 1f, Direction.FORWARDS);
        boolean onServer;
    }

    public enum Status {
        NONE("", -1),
        VANISHED("V", ColorUtils.rgb(254, 68, 68));
        public final String string;
        public final int color;

        Status(String string, int color) {
            this.string = string;
            this.color = color;
        }
    }

    public float[] getHealthFromScoreboard(LivingEntity target) {
        var ref = new Object() {
            float hp = target.getHealth();
            float maxHp = target.getMaxHealth();
        };
        if (mc.world.getScoreboard().getObjectiveInDisplaySlot(2) != null) {
            mc.world.getScoreboard().getObjectivesForEntity(target.getScoreboardName()).entrySet().stream().findAny().ifPresent(x -> {
                ref.hp = x.getValue().getScorePoints();
                ref.maxHp = 20;
            });
        }
        return new float[]{ref.hp, ref.maxHp};
    }

    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity auraTarget = Estynett.INSTANCE.getModuleManager().getKillAura().getTarget();
        LivingEntity target = nullTarget;
        if (auraTarget != null) {
            stopWatch.reset();
            allow = true;
            target = auraTarget;
        } else if (mc.currentScreen instanceof ChatScreen) {
            stopWatch.reset();
            allow = true;
            target = mc.player;
        } else {
            allow = false;
        }
        return target;
    }
}
бляяяя мои глааазазазазаза
 
Начинающий
Статус
Оффлайн
Регистрация
23 Июн 2023
Сообщения
103
Реакции[?]
0
Поинты[?]
0
Начинающий
Статус
Оффлайн
Регистрация
19 Фев 2024
Сообщения
83
Реакции[?]
0
Поинты[?]
0
ватермарка и таргет худ - это пиздец, хотя бинды норм и зельки, можно взять под основу и допилить
 
Начинающий
Статус
Оффлайн
Регистрация
3 Ноя 2023
Сообщения
26
Реакции[?]
0
Поинты[?]
0
Чит закрылся.
Посмотреть вложение 293591ъ

Java:
package dev.estynett.modules.impl.render;

import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import dev.estynett.Estynett;
import dev.estynett.command.staffs.StaffStorage;
import dev.estynett.events.EventRender;
import dev.estynett.events.EventUpdate;
import dev.estynett.modules.api.Category;
import dev.estynett.modules.api.Module;
import dev.estynett.modules.api.ModuleRegister;
import dev.estynett.modules.impl.combat.KillAura;
import dev.estynett.modules.settings.impl.BooleanSetting;
import dev.estynett.modules.settings.impl.ModeListSetting;
import dev.estynett.modules.settings.impl.ModeSetting;
import dev.estynett.ui.styles.Style;
import dev.estynett.utils.animations.Animation;
import dev.estynett.utils.animations.Direction;
import dev.estynett.utils.animations.impl.DecelerateAnimation;
import dev.estynett.utils.animations.impl.EaseBackIn;
import dev.estynett.utils.client.ClientUtil;
import dev.estynett.utils.client.KeyStorage;
import dev.estynett.utils.client.ThemeManager;
import dev.estynett.utils.drag.Dragging;
import dev.estynett.utils.font.FontManager;
import dev.estynett.utils.math.MathUtil;
import dev.estynett.utils.math.StopWatch;
import dev.estynett.utils.math.Vector4i;
import dev.estynett.utils.render.*;
import dev.estynett.utils.render.font.Fonts;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.experimental.FieldDefaults;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.network.play.NetworkPlayerInfo;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.LivingEntity;
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.Vector4f;
import net.minecraft.util.text.ITextComponent;

import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.regex.Pattern;

@FieldDefaults(level = AccessLevel.PRIVATE)
@ModuleRegister(name = "HUD", category = Category.Render)
public class HUD extends Module {

    public static final ModeSetting vibor = new ModeSetting(
            "Тема","Первый", "Первый", "Второй", "Третий"
    );

    private final BooleanSetting elementsShadow = new BooleanSetting("Свечение", false);

    Animation animation = new EaseBackIn(250, 1f, 1f);
    Animation alpha = new EaseBackIn(220, 1f, 1f);

    private final ModeListSetting elements = new ModeListSetting("Элементы",
            new BooleanSetting("Кейбинды", true),
            new BooleanSetting("Администрации", true),
            new BooleanSetting("Поушены", true),
            new BooleanSetting("Лого", true),
            new BooleanSetting("Координаты", true),
            new BooleanSetting("Таргет-Худ", true));

    @Subscribe
    private void onDisplay(EventRender e) {
        if (e.isRender2D()) {
            if (mc.gameSettings.showDebugInfo) {
                return;
            }

            boolean shadowValue = elementsShadow.get();

            if (elements.getValueByName("Лого").get()) logoMethod(e, shadowValue);
            if (elements.getValueByName("Кейбинды").get()) keyBinds(e, shadowValue);
            if (elements.getValueByName("Администрации").get()) staffList(e, shadowValue);
            if (elements.getValueByName("Поушены").get()) potionList(e, shadowValue);
            if (elements.getValueByName("Координаты").get()) coordinates(e);
            if (elements.getValueByName("Таргет-Худ").get()) targetInfo(e, shadowValue);
//            KawaseBlur.blur.updateBlur(3, 2);
//            KawaseBlur.blur.BLURRED.draw();
        }
    }

    private final List<Staff> staffPlayers = new ArrayList<>();
    private final Pattern namePattern = Pattern.compile("^\\w{3,16}$");
    private final Pattern prefixMatches = Pattern.compile(".*(mod|der|adm|help|wne|хелп|адм|поддержка|кура|own|taf|curat|dev|supp|yt|сотруд).*");

    @Subscribe
    private void onUpdate(EventUpdate eventUpdate) {
        staffPlayers.clear();

        for (ScorePlayerTeam team : mc.world.getScoreboard().getTeams().stream().sorted(Comparator.comparing(Team::getName)).toList()) {
            String name = team.getMembershipCollection().toString().replaceAll("[\\[\\]]", "");
            boolean vanish = true;
            for (NetworkPlayerInfo info : mc.getConnection().getPlayerInfoMap()) {
                if (info.getGameProfile().getName().equals(name)) {
                    vanish = false;
                }
            }
            if (namePattern.matcher(name).matches() && !name.equals(mc.player.getName().getString())) {
                if (!vanish) {
                    if (prefixMatches.matcher(team.getPrefix().getString().toLowerCase(Locale.ROOT)).matches() || StaffStorage.isStaff(name)) {
                        Staff staff = new Staff(team.getPrefix(), name, false, Status.NONE, true);
                        staffPlayers.add(staff);
                    }
                }
                if (vanish && !team.getPrefix().getString().isEmpty()) {
                    Staff staff = new Staff(team.getPrefix(), name, true, Status.VANISHED, true);
                    staffPlayers.add(staff);
                }
            }
        }
    }

    private final float fontSize = 7;
    private final float padding = 5;

    Dragging logoXY = Estynett.INSTANCE.createDrag(this, "watermark", 10, 10);
    Dragging keyBinds = Estynett.INSTANCE.createDrag(this, "keybinds", 100, 10);
    Dragging staffList = Estynett.INSTANCE.createDrag(this, "stafflist", 200, 10);
    Dragging potions = Estynett.INSTANCE.createDrag(this, "potions", 300, 10);



    private void logoMethod(EventRender eventDisplay, boolean shadow) {
        MatrixStack matrixStack = eventDisplay.matrixStack;
        float x = 5;
        float y = 5;

        int fps = mc.debugFPS;
        String serverIp = mc.getCurrentServerData() != null ? mc.getCurrentServerData().serverIP : "server is nothing:(";

        float width = 15;
        float height = 14;
        float allWidth = FontManager.sfMedium[18].getWidth("Estynett") + width + FontManager.sfMedium[18].getWidth(" - " + fps + " Fps") + FontManager.sfMedium[18].getWidth(" - " + serverIp) + 5;

        RenderUtil.Render2D.drawRoundedRect(x, y, allWidth, height, 2.5f, ThemeManager.getStartColor());
        if (shadow) {
            RenderUtil.Render2D.drawShadow(x + 15, y + 3, FontManager.sfMedium[18].getWidth("Estynett"), 9, 10, RenderUtil.reAlphaInt(ThemeManager.getEndColor(), 100));
        }
        if (shadow) {
            RenderUtil.Render2D.drawShadow(x + 2.5f, y + 2.5f, 10, 10, 10, RenderUtil.reAlphaInt(ThemeManager.getEndColor(), 100));
        }
        FontManager.sfMedium[18].drawString(matrixStack, "Estynett", x + 15, y + 4,ThemeManager.getEndColor());
        RenderUtil.Render2D.drawImage(matrixStack, new ResourceLocation("expensive/images/WATERMARK.png"), x + 2.5f, y + 2.5f,0, 10, 10, ThemeManager.getEndColor(), ThemeManager.getEndColor(),ThemeManager.getEndColor(),ThemeManager.getEndColor());

        FontManager.sfMedium[18].drawString(matrixStack, " - " + fps + " Fps", x + 52, y + 4, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0,0));
        FontManager.sfMedium[18].drawString(matrixStack, " - " + serverIp, x + FontManager.sfMedium[18].getWidth(" - " + fps + " Fps") + FontManager.sfMedium[18].getWidth("Estynett") + 17, y + 4, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0,0));
    }

    float kbWidth, kbWidthAnim = 0;
    float kbHeght, kbHeightAnim = 0;
    private void keyBinds(EventRender eventRender, boolean glow) {
        MatrixStack ms = eventRender.matrixStack;
        float xPosition = keyBinds.getX();
        float yPosition = keyBinds.getY();

        if(glow) {
            RenderUtil.Render2D.drawShadow(xPosition, yPosition, kbWidthAnim, kbHeightAnim, 5, ThemeManager.getStartColor());
        }
        RenderUtil.Render2D.drawRoundedRect(xPosition, yPosition, kbWidthAnim, kbHeightAnim, 4, ThemeManager.getStartColor());


        FontManager.sfMedium[16].drawCenteredString(ms, "Hotkeys", xPosition + kbWidthAnim / 2f, yPosition + 6, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0, 0));
        Fonts.icon.drawCenteredText(ms, "C", xPosition + kbWidthAnim / 2f - 24, yPosition + 4.5f, ThemeManager.getEndColor(), 10);

        kbHeightAnim = MathUtil.fast(kbHeightAnim, kbHeght, 15);
        kbWidthAnim = MathUtil.fast(kbWidthAnim, kbWidth, 15);

        float maxWidth = FontManager.sfMedium[16].getWidth("Hotkeys") + padding * 2;

        Scissor.push();
        Scissor.setFromComponentCoordinates(xPosition, yPosition, kbWidth, kbHeght);
        int i = 0;
        for (Module f : Estynett.INSTANCE.getModuleManager().getModules()) {
            f.getAnimation().update();
            if (!f.isState() || f.getBind() == 0) continue;

            String nameText = f.getName();
            float nameWidth = FontManager.sfMedium[14].getWidth(nameText);

            String bindText = KeyStorage.getKey(f.getBind());
            float bindWidth = FontManager.sfMedium[14].getWidth(bindText);

            float localWidth = nameWidth + bindWidth + padding * 3.0F + 4.0F;

            FontManager.sfMedium[14].drawString(ms, nameText, xPosition + padding - 1, yPosition + 19.5f + (i * 10),!vibor.is("Третий") ?
                    ColorUtils.rgba(255, 255, 255, (int) (255 * f.getAnimation().getValue())) : ColorUtils.rgba(0, 0, 0, (int) (255 * f.getAnimation().getValue())));
            RenderUtil.Render2D.drawRoundedRect(xPosition + kbWidth - bindWidth - 6, yPosition + 17f + (i * 10), bindWidth + 3.5f, 8.5f, 1.5f,!vibor.is("Третий") ? ColorUtils.rgb(41, 41, 41) : ColorUtils.rgb(210, 210, 210));
            FontManager.sfMedium[14].drawString(ms, bindText, xPosition + kbWidth - bindWidth - 4, yPosition + 19.5f + (i * 10), RenderUtil.reAlphaInt(ThemeManager.getEndColor(), (int) (255 * f.getAnimation().getValue())));

            if (localWidth > maxWidth) {
                maxWidth = localWidth;
            }
            i++;
        }
        if (i > 0) {
            animation.setDirection(Direction.FORWARDS);
            alpha.setDirection(Direction.FORWARDS);
        } else {
            animation.setDirection(Direction.BACKWARDS);
            alpha.setDirection(Direction.BACKWARDS);
        }
        Scissor.unset();
        Scissor.pop();
        kbWidth = Math.max(maxWidth, 75);
        kbHeght = 19 + (i * 10);
        keyBinds.setWidth(kbWidth);
        keyBinds.setHeight(kbHeght);
    }


    float slWidth, slAnimateWidth = 0;
    float slHeight, slAnimateHeight = 0;
    private void staffList(EventRender eventRender, boolean glow) {
        MatrixStack ms = eventRender.matrixStack;
        float xPosition = staffList.getX();
        float yPosition = staffList.getY();

        if(glow) {
            RenderUtil.Render2D.drawShadow(xPosition, yPosition, slAnimateWidth, slAnimateHeight, 5, ThemeManager.getStartColor());
        }
        RenderUtil.Render2D.drawRoundedRect(xPosition, yPosition, slAnimateWidth, slAnimateHeight, 4, ThemeManager.getStartColor());

        FontManager.sfMedium[16].drawCenteredString(ms, "Stafflist", xPosition + slAnimateWidth / 2f, yPosition + 6, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0, 0));
        Fonts.icon.drawCenteredText(ms, "O", xPosition + slAnimateWidth / 2f - 24, yPosition + 4.5f, ThemeManager.getEndColor(), 10);

        slAnimateWidth = MathUtil.fast(slAnimateWidth, slWidth, 15);
        slAnimateHeight = MathUtil.fast(slAnimateHeight, slHeight, 15);

        float maxWidth = FontManager.sfMedium[14].getWidth("Stafflist") + padding * 2;

        int i = 0;
        for (Staff f : staffPlayers) {
            if (!(f.getAnimation().getOutput() > 0)) continue;
            ITextComponent prefix = f.getPrefix();
            float prefixWidth = FontManager.sfMedium[14].getWidth(prefix.getString());
            String staff = (prefix.getString().isEmpty() ? "  " : " ") + f.getName();
            float nameWidth = FontManager.sfMedium[14].getWidth(staff);

            float localWidth = prefixWidth + nameWidth + Fonts.montserrat.getWidth(f.getStatus().string, fontSize) + padding * 3;

            FontManager.sfMedium[14].drawString(ms, prefix, xPosition + 1, yPosition + 19.5f + (i * 10), (int) (f.animation.getOutput() * 255));
            FontManager.sfMedium[14].drawString(ms, staff, xPosition + padding + prefixWidth - 5, yPosition + 19.5f + (i * 10), -1);
            FontManager.sfMedium[14].drawString(ms, f.getStatus().string, xPosition + slWidth - padding - FontManager.sfMedium[14].getWidth(f.getStatus().string) + 2, yPosition + 19.5f + (i * 10), ColorUtils.setAlpha(f.getStatus().color, (int) (f.animation.getOutput() * 255)));

            if (localWidth > maxWidth) {
                maxWidth = localWidth;
            }
            i++;
        }
        if (i > 0) {
            animation.setDirection(Direction.FORWARDS);
            alpha.setDirection(Direction.FORWARDS);
        } else {
            animation.setDirection(Direction.BACKWARDS);
            alpha.setDirection(Direction.BACKWARDS);
        }
        slHeight = 19 + (i * 10);
        slWidth = Math.max(maxWidth, 75);
        staffList.setWidth(slWidth);
        staffList.setHeight(slHeight);
    }

    //

    private Map<String, DecelerateAnimation> animations = new HashMap<>();

    float potWidth, potWidthAnim = 0;
    float potHeight, potHeigthAnim = 0;
    private void potionList(EventRender eventRender, boolean glow) {
        MatrixStack ms = eventRender.matrixStack;
        float xPosition = potions.getX();
        float yPosition = potions.getY();

        if(glow) {
            RenderUtil.Render2D.drawShadow(xPosition, yPosition, potWidthAnim, potHeigthAnim, 5, ThemeManager.getStartColor());
        }
        RenderUtil.Render2D.drawRoundedRect(xPosition, yPosition, potWidthAnim, potHeigthAnim, 4, ThemeManager.getStartColor());

        FontManager.sfMedium[16].drawCenteredString(ms, "Potions", xPosition + potWidthAnim / 2f, yPosition + 6, !vibor.is("Третий") ? -1 : ColorUtils.rgb(0, 0, 0));
        Fonts.icon.drawCenteredText(ms, "E", xPosition + potWidthAnim / 2f - 24, yPosition + 4.5f, ThemeManager.getEndColor(), 10);
        potWidthAnim = MathUtil.fast(potWidthAnim, potWidth, 15);
        potHeigthAnim = MathUtil.fast(potHeigthAnim, potHeight, 15);

        float maxWidth = FontManager.sfMedium[16].getWidth("Potions") + padding * 2;
        int i = 0;

        for (EffectInstance ef : mc.player.getActivePotionEffects()) {
            int amp = ef.getAmplifier();

            String ampStr = "";

            if (amp >= 1 && amp <= 9) {
                ampStr = " " + (amp + 1);
            }

            DecelerateAnimation efAnimation = animations.getOrDefault(ef.getEffectName(), null);
            if (efAnimation == null) {
                efAnimation = new DecelerateAnimation(250, 1, Direction.FORWARDS);
                animations.put(ef.getEffectName(), efAnimation);
            }

            boolean potionActive = ef.getDuration() > 5;
            efAnimation.setDirection(potionActive ? Direction.FORWARDS : Direction.BACKWARDS);

            String nameText = I18n.format(ef.getEffectName()) + ampStr;
            float nameWidth = FontManager.sfMedium[14].getWidth(nameText);

            String bindText = EffectUtils.getPotionDurationString(ef, 1);
            float bindWidth = FontManager.sfMedium[14].getWidth(bindText);

            float localWidth = nameWidth + bindWidth + padding * 3;

            FontManager.sfMedium[14].drawString(ms, nameText, xPosition + padding - 1, yPosition + 19.5f + (i * 10), !vibor.is("Третий") ?
                    ColorUtils.rgba(255, 255, 255, (int) (255 * efAnimation.getOutput())) : ColorUtils.rgba(0, 0, 0, (int) (255 * efAnimation.getOutput())));
            RenderUtil.Render2D.drawRoundedRect(xPosition + potWidth - bindWidth - 7, yPosition + 17f + (i * 10), bindWidth + 3.5f, 8.5f, 1.5f,!vibor.is("Третий") ? ColorUtils.rgb(41, 41, 41) : ColorUtils.rgb(210, 210, 210));
            FontManager.sfMedium[14].drawString(ms, bindText, xPosition + potWidth - padding - bindWidth, yPosition + 19.5f + (i * 10), !vibor.is("Третий") ?
                    ColorUtils.rgba(255, 255, 255, (int) (255 * efAnimation.getOutput())) : ColorUtils.rgba(0, 0, 0, (int) (255 * efAnimation.getOutput())));
            i++;

            if (localWidth > maxWidth) {
                maxWidth = localWidth;
            }

        }
        if (animations != null) animations.keySet().removeIf((type) -> mc.player.getActivePotionEffects().stream().map((effect) -> effect.getPotion().getName()).noneMatch((type2) -> type2.equals(type)));
        if (i > 0) {
            animation.setDirection(Direction.FORWARDS);
            alpha.setDirection(Direction.FORWARDS);
        } else {
            animation.setDirection(Direction.BACKWARDS);
            alpha.setDirection(Direction.BACKWARDS);
        }
        potHeight = 19 + (i * 10);
        potWidth = Math.max(maxWidth, 75);
        potions.setWidth(potWidth);
        potions.setHeight(potHeight);
    }

    private void coordinates(EventRender eventRender) {

    }

    StopWatch stopWatch = new StopWatch();

    Dragging drag = Estynett.INSTANCE.createDrag(this, "th",100, 100);

    final Animation animation2 = new EaseBackIn(200, 1, 1);

    LivingEntity entity = null;

    boolean allow;

    float healthAnimation = 0.0f;
    float absorptionAnimation = 0.0f;

    private void targetInfo(EventRender eventRender, boolean shadow) {
        entity = getTarget(entity);
        boolean out = !allow;
        animation.setDuration(out ? 400 : 300);
        animation2.setDuration(350);
        animation.setDirection(out ? Direction.BACKWARDS : Direction.FORWARDS);
        animation2.setDirection(out ? Direction.BACKWARDS : Direction.FORWARDS);


        if (entity != null) {
            float posX = drag.getX();
            float posY = drag.getY();

            float headSize = 28;

            float width = 89;
            float height = 33;
            drag.setWidth(width);
            drag.setHeight(height);

            float hp = ClientUtil.isConnectedToServer("reallyworld") ? getHealthFromScoreboard(entity)[0] : entity.getHealth();
            float maxHp = entity.getMaxHealth();

            healthAnimation = MathHelper.clamp(hp / maxHp, 0, 1);
            absorptionAnimation = MathHelper.clamp(entity.getAbsorptionAmount() / maxHp, 0, 1);

            int alpha = MathHelper.clamp((int) (animation2.getOutput() * 255), 0, 255);

            RenderUtil.Render2D.drawRoundedRect(posX, posY, width, height, 2.5f, RenderUtil.reAlphaInt(ThemeManager.getStartColor(), alpha));
            RenderUtil.Render2D.drawRoundedRect(posX + headSize + 3.5f, posY + 22.5f, (width - 35), 5, 1.5f, ColorUtils.rgba(14, 14, 14, alpha));
            RenderUtil.Render2D.drawRoundedRect(posX + headSize + 3.5f, posY + 22.5f, (width - 35) * healthAnimation, 5, 1.5f, RenderUtil.reAlphaInt(ThemeManager.getEndColor(), alpha));
            if (alpha > 0) {
                RenderUtil.Render2D.drawTargetHead(entity, posX + 2.5f, posY + 2.5f, headSize, headSize);
            }

            Scissor.push();
            Scissor.setFromComponentCoordinates(posX, posY, width - 6, height);
            FontManager.sfRegular[16].drawString(eventRender.matrixStack,entity.getName().getString(), posX + headSize + 3.5f, posY + 3.5f,!vibor.is("Третий") ? ColorUtils.rgba(255, 255, 255, alpha) : ColorUtils.rgba(0, 0, 0, alpha));
            Scissor.unset();
            Scissor.pop();

            FontManager.sfRegular[14].drawString(eventRender.matrixStack,"HP: " + (ClientUtil.isConnectedToServer("reallyworld") ? String.valueOf(getHealthFromScoreboard(entity)[0]) : ((int) entity.getHealth() + (int) mc.player.getAbsorptionAmount())),posX + headSize + 3.5f, posY + 14.5f, !vibor.is("Третий") ? ColorUtils.rgba(255, 255, 255, alpha) : ColorUtils.rgba(0, 0, 0, alpha));
        }
    }


    public HUD() {
        addSettings(elements, vibor, elementsShadow);
    }
    @AllArgsConstructor
    @Data
    public static class Staff {
        ITextComponent prefix;
        String name;
        boolean isSpec;
        Status status;
        final Animation animation = new DecelerateAnimation(status == Status.NONE ? 450 : 250, 1f, Direction.FORWARDS);
        boolean onServer;
    }

    public enum Status {
        NONE("", -1),
        VANISHED("V", ColorUtils.rgb(254, 68, 68));
        public final String string;
        public final int color;

        Status(String string, int color) {
            this.string = string;
            this.color = color;
        }
    }

    public float[] getHealthFromScoreboard(LivingEntity target) {
        var ref = new Object() {
            float hp = target.getHealth();
            float maxHp = target.getMaxHealth();
        };
        if (mc.world.getScoreboard().getObjectiveInDisplaySlot(2) != null) {
            mc.world.getScoreboard().getObjectivesForEntity(target.getScoreboardName()).entrySet().stream().findAny().ifPresent(x -> {
                ref.hp = x.getValue().getScorePoints();
                ref.maxHp = 20;
            });
        }
        return new float[]{ref.hp, ref.maxHp};
    }

    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity auraTarget = Estynett.INSTANCE.getModuleManager().getKillAura().getTarget();
        LivingEntity target = nullTarget;
        if (auraTarget != null) {
            stopWatch.reset();
            allow = true;
            target = auraTarget;
        } else if (mc.currentScreen instanceof ChatScreen) {
            stopWatch.reset();
            allow = true;
            target = mc.player;
        } else {
            allow = false;
        }
        return target;
    }
}
Когда люди научатся симетрии? почему у вас то лого сдвинуто неправильно, то еще что то, неужели нельзя вымерять идеальные пиксели? или слишком сложно ввести к примеру 3.3f
 
Сверху Снизу