Исходник Catlavan-Катлаван Худ

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

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

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

Спасибо!

Короче вот
Пожалуйста, авторизуйтесь для просмотра ссылки.

ДА ПОНИМАЮ ГОВНО КРИВО И Т.Д Я НАПИСАЛ НА СКОРУЮ РУКУ! ПОТОМУ ЧТО СКУЧНО
Вот сам код
САМ КОД:
package intensity.cc.modules.impl.render;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.DisplayEffectsScreen;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.network.play.NetworkPlayerInfo;
import net.minecraft.client.renderer.texture.PotionSpriteUploader;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Team;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.TextFormatting;
import intensity.cc.Initilization;
import intensity.cc.events.Event;
import intensity.cc.events.impl.render.EventRender;
import intensity.cc.managment.Managment;
import intensity.cc.modules.Function;
import intensity.cc.modules.FunctionAnnotation;
import intensity.cc.modules.Type;
import intensity.cc.modules.impl.combat.AttackAura;
import intensity.cc.modules.settings.Setting;
import intensity.cc.modules.settings.imp.BooleanOption;
import intensity.cc.modules.settings.imp.MultiBoxSetting;
import intensity.cc.modules.settings.imp.SliderSetting;
import intensity.cc.managment.StyleManager;
import intensity.cc.util.ClientUtil;
import intensity.cc.util.IMinecraft;
import intensity.cc.util.animations.Animation;
import intensity.cc.util.animations.Direction;
import intensity.cc.util.animations.impl.EaseBackIn;
import intensity.cc.util.drag.Dragging;
import intensity.cc.util.font.Fonts;
import intensity.cc.util.font.styled.StyledFont;
import intensity.cc.util.misc.HudUtil;
import intensity.cc.util.misc.TimerUtil;
import intensity.cc.util.render.ColorUtil;
import intensity.cc.util.render.RenderUtil.Render2D;
import intensity.cc.util.render.RenderUtil.SmartScissor;
import intensity.cc.util.render.animation.AnimationMath;

@FunctionAnnotation(
        name = "CatlavanHUD",
        type = Type.Render
)
public class HUD extends Function {
    public static MultiBoxSetting elements = new MultiBoxSetting("Элементы", new BooleanOption[]{new BooleanOption("ТХШКА", true), new BooleanOption("ВТШКА", true), new BooleanOption("Корды", true), new BooleanOption("БПС", true), new BooleanOption("Потионс", true), new BooleanOption("Хоткеи", true), new BooleanOption("Стафф", true), new BooleanOption("Бронь", true)});
    private final SliderSetting offsetEffects = (new SliderSetting("Расстояние эффектов", 24.0F, 23.0F, 26.0F, 0.1F)).setVisible(() -> {
        return elements.get(5);
    });

    final Dragging TargetHUD;
    final Dragging TimerHUD;
    final Dragging WT;
    final Dragging Coords;
    final Dragging BPS;
    final Dragging Effects;
    final Dragging KeyBinds;
    final Dragging StaffActive;
    int activeStaff;
    private final Pattern namePattern;
    int activeBind;
    float heightAnimation;
    private float perc;
    private final Animation targetHudAnimation;
    private double scale;
    private LivingEntity target;
    float health;
    float absorpation;

    public HUD() {
        this.TargetHUD = Initilization.createDrag(this, "TargetHUD", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.TimerHUD = Initilization.createDrag(this, "TimerHUD", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.WT = Initilization.createDrag(this, "WT", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.Coords = Initilization.createDrag(this, "Coords", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.BPS = Initilization.createDrag(this, "BPS", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.Effects = Initilization.createDrag(this, "Effects", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.KeyBinds = Initilization.createDrag(this, "KeyBinds", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.StaffActive = Initilization.createDrag(this, "StaffActive", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.activeStaff = 0;
        this.namePattern = Pattern.compile("^\\w{3,16}$");
        this.activeBind = 0;
        this.heightAnimation = 0.0F;
        this.targetHudAnimation = new EaseBackIn(270, 1.0, 1.5F);
        this.scale = 0.0;
        this.target = null;
        this.health = 0.0F;
        this.absorpation = 0.0F;
        this.addSettings(new Setting[]{elements, this.offsetEffects});
    }

    public void onEvent(Event event) {
        if (event instanceof EventRender eventRender) {
            MatrixStack stack = eventRender.matrixStack;
            if (elements.get(0)) {
                this.TargetHUD(stack);
            }

            if (elements.get(1)) {
                this.WT(stack);
            }

            if (elements.get(2)) {
                this.Coords(stack);
            }

            if (elements.get(3)) {
                this.BPS(stack);
            }

            if (elements.get(4)) {
                this.Effects(stack);
            }

            if (elements.get(5)) {
                this.KeyBinds(stack);
            }

            if (elements.get(6)) {
                this.StaffActive(stack);
            }

            if (elements.get(7)) {
                this.ArmorHUD(stack, eventRender);
            }
        }

    }

    public void ArmorHUD(MatrixStack stack, EventRender eventRender) {
        int count = 0;

        for(int i = 0; i < mc.player.inventory.getSizeInventory(); ++i) {
            ItemStack s = mc.player.inventory.getStackInSlot(i);
            if (s.getItem() == Items.TOTEM_OF_UNDYING) {
                ++count;
            }
        }

        float xPos = (float)eventRender.scaledResolution.scaledWidth() / 2.0F;
        float yPos = (float)eventRender.scaledResolution.scaledHeight();
        boolean totemInInv = mc.player.inventory.mainInventory.stream().map(ItemStack::getItem).toList().contains(Items.TOTEM_OF_UNDYING);
        int off = totemInInv ? 5 : 0;
        if (mc.player.isCreative()) {
            yPos += 17.0F;
        }

        for(Iterator var8 = mc.player.inventory.armorInventory.iterator(); var8.hasNext(); off += 15) {
            ItemStack s = (ItemStack)var8.next();
            ESP.drawItemStack(s, (double)(xPos - (float)off + 74.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (double)(yPos - 56.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (String)null, false);
        }

        if (totemInInv) {
            ESP.drawItemStack(new ItemStack(Items.TOTEM_OF_UNDYING), (double)(xPos - (float)off + 73.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (double)(yPos - 56.0F * ((float)mc.gameSettings.guiScale / 2.0F)), String.valueOf(count), false);
        }

    }

    public void StaffActive(MatrixStack stack) {
        float x = this.StaffActive.getX();
        float y = this.StaffActive.getY();
        float offset = 9.0F;
        float height = 20.5F;
        float width = 106.0F;
        height += offset * (float)this.activeStaff - 4.0F;
        float xStaff = x + 26.0F;
        if (this.activeStaff == 0) {
            --height;
            width -= 25.0F;
            xStaff -= 12.5F;
        }

        Render2D.drawRoundedRect(x, y, width, height, 2.5F, (new Color(4, 4, 4, 215)).getRGB());
        StyledFont small1 = Fonts.msSemiBold[14];
        small1.drawString(stack, "   Staff Active", (double)xStaff, (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());
        int i = 0;
        Iterator var10 = mc.world.getScoreboard().getTeams().stream().sorted(Comparator.comparing(Team::getName)).toList().iterator();

        while(true) {
            String name;
            boolean vanish;
            boolean near;
            boolean active;
            do {
                do {
                    if (!var10.hasNext()) {
                        this.activeStaff = i;
                        this.StaffActive.setWidth(width);
                        this.StaffActive.setHeight(height);
                        return;
                    }

                    ScorePlayerTeam team = (ScorePlayerTeam)var10.next();
                    name = team.getMembershipCollection().toString();
                    name = name.substring(1, name.length() - 1);
                } while(!this.namePattern.matcher(name).matches());

                vanish = true;
                near = false;
                active = false;
                Iterator var16 = mc.world.getPlayers().iterator();

                while(var16.hasNext()) {
                    AbstractClientPlayerEntity player = (AbstractClientPlayerEntity)var16.next();
                    if (player.getNameClear().equals(name)) {
                        near = true;
                    }
                }

                var16 = mc.getConnection().getPlayerInfoMap().iterator();

                while(var16.hasNext()) {
                    NetworkPlayerInfo info = (NetworkPlayerInfo)var16.next();
                    if (info.getGameProfile().getName().equals(name)) {
                        vanish = false;
                        if (!near) {
                            active = true;
                        }
                    }
                }
            } while(!vanish && !Managment.STAFF_MANAGER.isStaff(name));

            String Name = name.substring(0, Math.min(name.length(), 13));
            StyledFont small = Fonts.msSemiBold[13];
            StyledFont small2 = Fonts.msMedium[13];
            float yText = y + 17.0F;
            small2.drawString(stack, Name, (double)(x + 4.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
            if (vanish) {
                small.drawString(stack, "Spectator", (double)(x + 68.5F), (double)yText, (new Color(231, 52, 52, 255)).getRGB());
            } else if (active) {
                small.drawString(stack, "Active", (double)(x + 63.5F), (double)yText, (new Color(21, 238, 15, 255)).getRGB());
            } else if (near) {
                small.drawString(stack, "Near", (double)(x + 68.8F), (double)yText, (new Color(229, 188, 23, 255)).getRGB());
            }

            y += offset;
            ++i;
        }
    }

    public void KeyBinds(MatrixStack stack) {
        float x = this.KeyBinds.getX();
        float y = this.KeyBinds.getY();
        float offset = 9.5F;
        float height = 21.0F;
        float width = 75.0F;
        int activeKeyBinds = 0;

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

        height += offset * activeKeyBinds - 5.0F;

        Render2D.drawRoundedRect(x, y, width, height, 2.5F, (new Color(4, 4, 4, 215)).getRGB());
        StyledFont small1 = Fonts.msSemiBold[14];
        small1.drawString(stack, "KeyBinds", (double)(x + 20.0F), (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());

        int index = 0;
        SmartScissor.push();
        SmartScissor.setFromComponentCoordinates((double)x, (double)y, (double)width, (double)height);
        for (Function f : Managment.FUNCTION_MANAGER.getFunctions()) {
            if (f.bind != 0 && f.state) {
                String bindText = "[" + ClientUtil.getKey(f.bind).toUpperCase() + "]";
                float yText = y + 17.0F + index * offset;
                StyledFont small = Fonts.msMedium[13];
                small.drawString(stack, f.name, (double)(x + 4.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
                small.drawString(stack, bindText, (double)(x + 57.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
                index++;
            }
        }
        SmartScissor.unset();
        SmartScissor.pop();

        this.KeyBinds.setWidth(width);
        this.KeyBinds.setHeight(height);
    }


    public void Effects(MatrixStack stack) {
        float x = this.Effects.getX();
        float y = this.Effects.getY();
        float offset = this.offsetEffects.getValue().floatValue();
        float height = 21.3F;
        StyledFont small = Fonts.msSemiBold[13];
        int counterEffect = 0;
        Iterator var8 = mc.player.getActivePotionEffects().iterator();

        while(var8.hasNext()) {
            EffectInstance effectInstance = (EffectInstance)var8.next();
            String levelpotion = String.valueOf(effectInstance.getAmplifier() + 1);
            float textWidthBonus = 27.3F;
            if (levelpotion.contains("1")) {
                levelpotion = "";
                textWidthBonus -= 5.0F;
            }

            String durationText = EffectUtils.getPotionDurationString(effectInstance, 1.0F);
            String text = I18n.format(effectInstance.getEffectName(), new Object[0]);
            float textWidth = small.getWidth(text + effectInstance.getAmplifier() + levelpotion) + textWidthBonus - 0.6F;
            Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
            small.drawString(stack, text + " " + levelpotion, (double)(x + 22.3F), (double)(y + 5.5F), (new Color(255, 255, 255, 255)).getRGB());
            small.drawString(stack, durationText, (double)(x + 22.3F), (double)(y + 13.5F), (new Color(255, 255, 255, 255)).getRGB());
            PotionSpriteUploader potionspriteuploader = mc.getPotionSpriteUploader();
            Effect effect = effectInstance.getPotion();
            TextureAtlasSprite textureatlassprite = potionspriteuploader.getSprite(effect);
            mc.getTextureManager().bindTexture(textureatlassprite.getAtlasTexture().getTextureLocation());
            DisplayEffectsScreen.blit(stack, (int)(x + 2.0F), (int)y + 2, 0, 18, 18, textureatlassprite);
            y += offset;
            ++counterEffect;
            this.Effects.setWidth(textWidth);
        }

        float setHeight = offset / 8.0F * (float)counterEffect;
        this.Effects.setHeight(height * (float)counterEffect + setHeight);
    }

    public void BPS(MatrixStack stack) {
        float x = this.BPS.getX();
        float y = this.BPS.getY();
        float height = 15.0F;
        StyledFont small = Fonts.msSemiBold[14];
        int X = (int)mc.player.getPosX();
        int Y = (int)mc.player.getPosY();
        int Z = (int)mc.player.getPosZ();
        Object[] var10001 = new Object[]{Math.hypot(mc.player.getPosX() - mc.player.prevPosX, mc.player.getPosZ() - mc.player.prevPosZ) * 20.0};
        String text = "Speed: " + String.format("%.2f", var10001);
        float textWidth = small.getWidth(text) + 8.5F;
        Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        small.drawString(stack, text, (double)(x + 4.5F), (double)y + 6.3, (new Color(255, 255, 255, 255)).getRGB());
        this.BPS.setWidth(textWidth);
        this.BPS.setHeight(height);
    }

    public void Coords(MatrixStack stack) {
        float x = this.Coords.getX();
        float y = this.Coords.getY();
        float height = 15.0F;
        StyledFont small = Fonts.msSemiBold[14];
        int X = (int)mc.player.getPosX();
        int Y = (int)mc.player.getPosY();
        int Z = (int)mc.player.getPosZ();
        String text = "Coords: x: " + X + ", y: " + Y + ", z: " + Z;
        float textWidth = small.getWidth(text) + 8.5F;
        Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        small.drawString(stack, text, (double)(x + 4.5F), (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());
        this.Coords.setWidth(textWidth);
        this.Coords.setHeight(height);
    }

    public void WT(MatrixStack stack) {
        float x = this.WT.getX();
        float y = this.WT.getY();
        float height = 17.0F;
        StyledFont small1 = Fonts.msSemiBold[14];
        StyledFont small = Fonts.msSemiBold[15];
        String playerName = mc.player.getName().getString();

        float offsetX = 1.0F;
        float offsetY = 1.5F;
        float fpsOffsetX = 50.0F;
        float fpsOffsetY = 1.5F;

        Minecraft var10000 = mc;
        String FPS = Minecraft.debugFPS + " FPS";
        String text = "Catlavan";
        float textWidth = small1.getWidth(text) + 13.0F;
        Render2D.drawRoundedRect(x + offsetX, y + offsetY, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        float var100000 = x + fpsOffsetX;
        Minecraft var10003 = mc;
        int var12 = Minecraft.debugFPS;
        Render2D.drawRoundedRect(var100000, y + fpsOffsetY, small1.getWidth("  " + var12 + "fps") + 14.0F, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());

        small.drawString(stack, "Catlavan", (double)(x + offsetX + 5.0F), (double)(y + offsetY + 7.0F), (new Color(255, 255, 255, 255)).getRGB());

        Minecraft var10002 = mc;
        small.drawString(stack, "  " + Minecraft.debugFPS + "fps" + TextFormatting.GRAY, (double)(x + fpsOffsetX + 4.0F), (double)(y + fpsOffsetY + 7.0F), (new Color(255, 255, 255, 255)).getRGB());

        this.WT.setWidth(textWidth);
        this.WT.setHeight(height);
    }




    public void TargetHUD(MatrixStack stack) {
        float x = this.TargetHUD.getX();
        float y = this.TargetHUD.getY();
        float width = 91.0F;
        float height = 34.0F;
        float widthFace = 34.0F;
        this.target = this.getTarget(this.target);
        this.targetHudAnimation.setDuration(280);
        this.scale = this.targetHudAnimation.getOutput();
        if (this.scale == 0.0) {
            this.target = null;
        }

        if (this.target != null) {
            GlStateManager.pushMatrix();
            AnimationMath.sizeAnimation((double)(x + width / 2.0F), (double)(y + 15.0F), this.scale);
            Render2D.drawRoundedRect(x + 3.0F, y, width, height, 2.0F, (new Color(4, 4, 4, 215)).getRGB());
            if (this.target instanceof PlayerEntity) {
                Render2D.drawFace(x + 6.5F, y + 4.0F, 8.0F, 8.0F, 8.0F, 8.0F, 27.0F, 26.0F, 64.0F, 64.0F, (AbstractClientPlayerEntity)this.target);
            }

            int count = 0;

            for(int i = 0; i < mc.player.inventory.getSizeInventory(); ++i) {
                ItemStack s = mc.player.inventory.getStackInSlot(i);
                if (s.getItem() == Items.TOTEM_OF_UNDYING) {
                    ++count;
                }
            }

            float xHP = x + widthFace + 3.8F;
            float yHP = y + 21.5F;
            float widthHP = 52.0F;
            this.health = AnimationMath.fast(this.health, this.target.getHealth() / this.target.getMaxHealth(), 6.0F);
            this.health = MathHelper.clamp(this.health, 0.0F, 1.0F);
            this.absorpation = AnimationMath.fast(this.absorpation, this.target.getAbsorptionAmount() / this.target.getMaxHealth(), 6.0F);
            this.absorpation = MathHelper.clamp(this.absorpation, 0.0F, 1.0F);
            int green_color;
            int blackgreen_color;
            if (this.target.getHealth() > 5.0F) {
                if (this.target.getHealth() > 12.0F) {
                    green_color = (new Color(85, 201, 21, 255)).getRGB();
                    blackgreen_color = (new Color(44, 141, 24, 255)).getRGB();
                    Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
                } else {
                    green_color = (new Color(255, 101, 5, 255)).getRGB();
                    blackgreen_color = (new Color(150, 87, 21, 255)).getRGB();
                    Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
                }
            } else {
                green_color = (new Color(238, 35, 35, 255)).getRGB();
                blackgreen_color = (new Color(185, 22, 22, 255)).getRGB();
                Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
            }

            Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.absorpation, 5.6F, 1.0F, (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB());
            String targetName = this.target.getName().getString();
            StyledFont small = Fonts.gilroyBold[13];
            SmartScissor.push();
            SmartScissor.setFromComponentCoordinates((double)x, (double)y, (double)(width - 6.0F), (double)height);
            small.drawString(stack, targetName, (double)xHP, (double)(yHP - 14.3F), (new Color(255, 255, 255, 255)).getRGB());
            SmartScissor.unset();
            SmartScissor.pop();
            String HP = String.valueOf(this.target.getHealth() + this.target.getAbsorptionAmount());
            String StringHP = HP.substring(0, Math.min(HP.length(), 4));
            if (this.target.getHealth() + this.target.getAbsorptionAmount() < 10.0F) {
                StringHP = HP.substring(0, Math.min(HP.length(), 3));
            }

            StyledFont small1 = Fonts.gilroyBold[11];
            small1.drawString(stack, "HP: " + StringHP, (double)xHP, (double)(yHP - 5.7F), (new Color(255, 255, 255, 255)).getRGB());
            this.drawItemStack(x, y - 12.0F, 10.5F, 0.7F);
            GlStateManager.popMatrix();
            this.TargetHUD.setWidth(width);
            this.TargetHUD.setHeight(height);
        }

    }

    private void drawItemStack(float x, float y, float offset, float scaleValue) {
        ArrayList<ItemStack> stackList = new ArrayList(Arrays.asList(this.target.getHeldItemMainhand(), this.target.getHeldItemOffhand()));
        stackList.addAll((Collection)this.target.getArmorInventoryList());
        AtomicReference<Float> posX = new AtomicReference(x);
        stackList.stream().filter((stack) -> {
            return !stack.isEmpty();
        }).forEach((stack) -> {
            HudUtil.drawItemStack(stack, (Float)posX.getAndAccumulate(offset, Float::sum), y, true, true, scaleValue);
        });
    }

    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity target = nullTarget;
        AttackAura var10000 = Managment.FUNCTION_MANAGER.attackAura;
        if (AttackAura.getTarget() instanceof LivingEntity) {
            var10000 = Managment.FUNCTION_MANAGER.attackAura;
            target = AttackAura.getTarget();
            this.targetHudAnimation.setDirection(Direction.FORWARDS);
        } else if (IMinecraft.mc.currentScreen instanceof ChatScreen) {
            target = IMinecraft.mc.player;
            this.targetHudAnimation.setDirection(Direction.FORWARDS);
        } else {
            this.targetHudAnimation.setDirection(Direction.BACKWARDS);
        }

        return (LivingEntity)target;
    }
}
 
Начинающий
Статус
Оффлайн
Регистрация
8 Июн 2023
Сообщения
329
Реакции[?]
3
Поинты[?]
3K
Короче вот
Пожалуйста, авторизуйтесь для просмотра ссылки.

ДА ПОНИМАЮ ГОВНО КРИВО И Т.Д Я НАПИСАЛ НА СКОРУЮ РУКУ! ПОТОМУ ЧТО СКУЧНО
Вот сам код
САМ КОД:
package intensity.cc.modules.impl.render;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.DisplayEffectsScreen;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.network.play.NetworkPlayerInfo;
import net.minecraft.client.renderer.texture.PotionSpriteUploader;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Team;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.TextFormatting;
import intensity.cc.Initilization;
import intensity.cc.events.Event;
import intensity.cc.events.impl.render.EventRender;
import intensity.cc.managment.Managment;
import intensity.cc.modules.Function;
import intensity.cc.modules.FunctionAnnotation;
import intensity.cc.modules.Type;
import intensity.cc.modules.impl.combat.AttackAura;
import intensity.cc.modules.settings.Setting;
import intensity.cc.modules.settings.imp.BooleanOption;
import intensity.cc.modules.settings.imp.MultiBoxSetting;
import intensity.cc.modules.settings.imp.SliderSetting;
import intensity.cc.managment.StyleManager;
import intensity.cc.util.ClientUtil;
import intensity.cc.util.IMinecraft;
import intensity.cc.util.animations.Animation;
import intensity.cc.util.animations.Direction;
import intensity.cc.util.animations.impl.EaseBackIn;
import intensity.cc.util.drag.Dragging;
import intensity.cc.util.font.Fonts;
import intensity.cc.util.font.styled.StyledFont;
import intensity.cc.util.misc.HudUtil;
import intensity.cc.util.misc.TimerUtil;
import intensity.cc.util.render.ColorUtil;
import intensity.cc.util.render.RenderUtil.Render2D;
import intensity.cc.util.render.RenderUtil.SmartScissor;
import intensity.cc.util.render.animation.AnimationMath;

@FunctionAnnotation(
        name = "CatlavanHUD",
        type = Type.Render
)
public class HUD extends Function {
    public static MultiBoxSetting elements = new MultiBoxSetting("Элементы", new BooleanOption[]{new BooleanOption("ТХШКА", true), new BooleanOption("ВТШКА", true), new BooleanOption("Корды", true), new BooleanOption("БПС", true), new BooleanOption("Потионс", true), new BooleanOption("Хоткеи", true), new BooleanOption("Стафф", true), new BooleanOption("Бронь", true)});
    private final SliderSetting offsetEffects = (new SliderSetting("Расстояние эффектов", 24.0F, 23.0F, 26.0F, 0.1F)).setVisible(() -> {
        return elements.get(5);
    });

    final Dragging TargetHUD;
    final Dragging TimerHUD;
    final Dragging WT;
    final Dragging Coords;
    final Dragging BPS;
    final Dragging Effects;
    final Dragging KeyBinds;
    final Dragging StaffActive;
    int activeStaff;
    private final Pattern namePattern;
    int activeBind;
    float heightAnimation;
    private float perc;
    private final Animation targetHudAnimation;
    private double scale;
    private LivingEntity target;
    float health;
    float absorpation;

    public HUD() {
        this.TargetHUD = Initilization.createDrag(this, "TargetHUD", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.TimerHUD = Initilization.createDrag(this, "TimerHUD", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.WT = Initilization.createDrag(this, "WT", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.Coords = Initilization.createDrag(this, "Coords", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.BPS = Initilization.createDrag(this, "BPS", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.Effects = Initilization.createDrag(this, "Effects", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.KeyBinds = Initilization.createDrag(this, "KeyBinds", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.StaffActive = Initilization.createDrag(this, "StaffActive", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.activeStaff = 0;
        this.namePattern = Pattern.compile("^\\w{3,16}$");
        this.activeBind = 0;
        this.heightAnimation = 0.0F;
        this.targetHudAnimation = new EaseBackIn(270, 1.0, 1.5F);
        this.scale = 0.0;
        this.target = null;
        this.health = 0.0F;
        this.absorpation = 0.0F;
        this.addSettings(new Setting[]{elements, this.offsetEffects});
    }

    public void onEvent(Event event) {
        if (event instanceof EventRender eventRender) {
            MatrixStack stack = eventRender.matrixStack;
            if (elements.get(0)) {
                this.TargetHUD(stack);
            }

            if (elements.get(1)) {
                this.WT(stack);
            }

            if (elements.get(2)) {
                this.Coords(stack);
            }

            if (elements.get(3)) {
                this.BPS(stack);
            }

            if (elements.get(4)) {
                this.Effects(stack);
            }

            if (elements.get(5)) {
                this.KeyBinds(stack);
            }

            if (elements.get(6)) {
                this.StaffActive(stack);
            }

            if (elements.get(7)) {
                this.ArmorHUD(stack, eventRender);
            }
        }

    }

    public void ArmorHUD(MatrixStack stack, EventRender eventRender) {
        int count = 0;

        for(int i = 0; i < mc.player.inventory.getSizeInventory(); ++i) {
            ItemStack s = mc.player.inventory.getStackInSlot(i);
            if (s.getItem() == Items.TOTEM_OF_UNDYING) {
                ++count;
            }
        }

        float xPos = (float)eventRender.scaledResolution.scaledWidth() / 2.0F;
        float yPos = (float)eventRender.scaledResolution.scaledHeight();
        boolean totemInInv = mc.player.inventory.mainInventory.stream().map(ItemStack::getItem).toList().contains(Items.TOTEM_OF_UNDYING);
        int off = totemInInv ? 5 : 0;
        if (mc.player.isCreative()) {
            yPos += 17.0F;
        }

        for(Iterator var8 = mc.player.inventory.armorInventory.iterator(); var8.hasNext(); off += 15) {
            ItemStack s = (ItemStack)var8.next();
            ESP.drawItemStack(s, (double)(xPos - (float)off + 74.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (double)(yPos - 56.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (String)null, false);
        }

        if (totemInInv) {
            ESP.drawItemStack(new ItemStack(Items.TOTEM_OF_UNDYING), (double)(xPos - (float)off + 73.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (double)(yPos - 56.0F * ((float)mc.gameSettings.guiScale / 2.0F)), String.valueOf(count), false);
        }

    }

    public void StaffActive(MatrixStack stack) {
        float x = this.StaffActive.getX();
        float y = this.StaffActive.getY();
        float offset = 9.0F;
        float height = 20.5F;
        float width = 106.0F;
        height += offset * (float)this.activeStaff - 4.0F;
        float xStaff = x + 26.0F;
        if (this.activeStaff == 0) {
            --height;
            width -= 25.0F;
            xStaff -= 12.5F;
        }

        Render2D.drawRoundedRect(x, y, width, height, 2.5F, (new Color(4, 4, 4, 215)).getRGB());
        StyledFont small1 = Fonts.msSemiBold[14];
        small1.drawString(stack, "   Staff Active", (double)xStaff, (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());
        int i = 0;
        Iterator var10 = mc.world.getScoreboard().getTeams().stream().sorted(Comparator.comparing(Team::getName)).toList().iterator();

        while(true) {
            String name;
            boolean vanish;
            boolean near;
            boolean active;
            do {
                do {
                    if (!var10.hasNext()) {
                        this.activeStaff = i;
                        this.StaffActive.setWidth(width);
                        this.StaffActive.setHeight(height);
                        return;
                    }

                    ScorePlayerTeam team = (ScorePlayerTeam)var10.next();
                    name = team.getMembershipCollection().toString();
                    name = name.substring(1, name.length() - 1);
                } while(!this.namePattern.matcher(name).matches());

                vanish = true;
                near = false;
                active = false;
                Iterator var16 = mc.world.getPlayers().iterator();

                while(var16.hasNext()) {
                    AbstractClientPlayerEntity player = (AbstractClientPlayerEntity)var16.next();
                    if (player.getNameClear().equals(name)) {
                        near = true;
                    }
                }

                var16 = mc.getConnection().getPlayerInfoMap().iterator();

                while(var16.hasNext()) {
                    NetworkPlayerInfo info = (NetworkPlayerInfo)var16.next();
                    if (info.getGameProfile().getName().equals(name)) {
                        vanish = false;
                        if (!near) {
                            active = true;
                        }
                    }
                }
            } while(!vanish && !Managment.STAFF_MANAGER.isStaff(name));

            String Name = name.substring(0, Math.min(name.length(), 13));
            StyledFont small = Fonts.msSemiBold[13];
            StyledFont small2 = Fonts.msMedium[13];
            float yText = y + 17.0F;
            small2.drawString(stack, Name, (double)(x + 4.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
            if (vanish) {
                small.drawString(stack, "Spectator", (double)(x + 68.5F), (double)yText, (new Color(231, 52, 52, 255)).getRGB());
            } else if (active) {
                small.drawString(stack, "Active", (double)(x + 63.5F), (double)yText, (new Color(21, 238, 15, 255)).getRGB());
            } else if (near) {
                small.drawString(stack, "Near", (double)(x + 68.8F), (double)yText, (new Color(229, 188, 23, 255)).getRGB());
            }

            y += offset;
            ++i;
        }
    }

    public void KeyBinds(MatrixStack stack) {
        float x = this.KeyBinds.getX();
        float y = this.KeyBinds.getY();
        float offset = 9.5F;
        float height = 21.0F;
        float width = 75.0F;
        int activeKeyBinds = 0;

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

        height += offset * activeKeyBinds - 5.0F;

        Render2D.drawRoundedRect(x, y, width, height, 2.5F, (new Color(4, 4, 4, 215)).getRGB());
        StyledFont small1 = Fonts.msSemiBold[14];
        small1.drawString(stack, "KeyBinds", (double)(x + 20.0F), (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());

        int index = 0;
        SmartScissor.push();
        SmartScissor.setFromComponentCoordinates((double)x, (double)y, (double)width, (double)height);
        for (Function f : Managment.FUNCTION_MANAGER.getFunctions()) {
            if (f.bind != 0 && f.state) {
                String bindText = "[" + ClientUtil.getKey(f.bind).toUpperCase() + "]";
                float yText = y + 17.0F + index * offset;
                StyledFont small = Fonts.msMedium[13];
                small.drawString(stack, f.name, (double)(x + 4.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
                small.drawString(stack, bindText, (double)(x + 57.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
                index++;
            }
        }
        SmartScissor.unset();
        SmartScissor.pop();

        this.KeyBinds.setWidth(width);
        this.KeyBinds.setHeight(height);
    }


    public void Effects(MatrixStack stack) {
        float x = this.Effects.getX();
        float y = this.Effects.getY();
        float offset = this.offsetEffects.getValue().floatValue();
        float height = 21.3F;
        StyledFont small = Fonts.msSemiBold[13];
        int counterEffect = 0;
        Iterator var8 = mc.player.getActivePotionEffects().iterator();

        while(var8.hasNext()) {
            EffectInstance effectInstance = (EffectInstance)var8.next();
            String levelpotion = String.valueOf(effectInstance.getAmplifier() + 1);
            float textWidthBonus = 27.3F;
            if (levelpotion.contains("1")) {
                levelpotion = "";
                textWidthBonus -= 5.0F;
            }

            String durationText = EffectUtils.getPotionDurationString(effectInstance, 1.0F);
            String text = I18n.format(effectInstance.getEffectName(), new Object[0]);
            float textWidth = small.getWidth(text + effectInstance.getAmplifier() + levelpotion) + textWidthBonus - 0.6F;
            Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
            small.drawString(stack, text + " " + levelpotion, (double)(x + 22.3F), (double)(y + 5.5F), (new Color(255, 255, 255, 255)).getRGB());
            small.drawString(stack, durationText, (double)(x + 22.3F), (double)(y + 13.5F), (new Color(255, 255, 255, 255)).getRGB());
            PotionSpriteUploader potionspriteuploader = mc.getPotionSpriteUploader();
            Effect effect = effectInstance.getPotion();
            TextureAtlasSprite textureatlassprite = potionspriteuploader.getSprite(effect);
            mc.getTextureManager().bindTexture(textureatlassprite.getAtlasTexture().getTextureLocation());
            DisplayEffectsScreen.blit(stack, (int)(x + 2.0F), (int)y + 2, 0, 18, 18, textureatlassprite);
            y += offset;
            ++counterEffect;
            this.Effects.setWidth(textWidth);
        }

        float setHeight = offset / 8.0F * (float)counterEffect;
        this.Effects.setHeight(height * (float)counterEffect + setHeight);
    }

    public void BPS(MatrixStack stack) {
        float x = this.BPS.getX();
        float y = this.BPS.getY();
        float height = 15.0F;
        StyledFont small = Fonts.msSemiBold[14];
        int X = (int)mc.player.getPosX();
        int Y = (int)mc.player.getPosY();
        int Z = (int)mc.player.getPosZ();
        Object[] var10001 = new Object[]{Math.hypot(mc.player.getPosX() - mc.player.prevPosX, mc.player.getPosZ() - mc.player.prevPosZ) * 20.0};
        String text = "Speed: " + String.format("%.2f", var10001);
        float textWidth = small.getWidth(text) + 8.5F;
        Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        small.drawString(stack, text, (double)(x + 4.5F), (double)y + 6.3, (new Color(255, 255, 255, 255)).getRGB());
        this.BPS.setWidth(textWidth);
        this.BPS.setHeight(height);
    }

    public void Coords(MatrixStack stack) {
        float x = this.Coords.getX();
        float y = this.Coords.getY();
        float height = 15.0F;
        StyledFont small = Fonts.msSemiBold[14];
        int X = (int)mc.player.getPosX();
        int Y = (int)mc.player.getPosY();
        int Z = (int)mc.player.getPosZ();
        String text = "Coords: x: " + X + ", y: " + Y + ", z: " + Z;
        float textWidth = small.getWidth(text) + 8.5F;
        Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        small.drawString(stack, text, (double)(x + 4.5F), (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());
        this.Coords.setWidth(textWidth);
        this.Coords.setHeight(height);
    }

    public void WT(MatrixStack stack) {
        float x = this.WT.getX();
        float y = this.WT.getY();
        float height = 17.0F;
        StyledFont small1 = Fonts.msSemiBold[14];
        StyledFont small = Fonts.msSemiBold[15];
        String playerName = mc.player.getName().getString();

        float offsetX = 1.0F;
        float offsetY = 1.5F;
        float fpsOffsetX = 50.0F;
        float fpsOffsetY = 1.5F;

        Minecraft var10000 = mc;
        String FPS = Minecraft.debugFPS + " FPS";
        String text = "Catlavan";
        float textWidth = small1.getWidth(text) + 13.0F;
        Render2D.drawRoundedRect(x + offsetX, y + offsetY, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        float var100000 = x + fpsOffsetX;
        Minecraft var10003 = mc;
        int var12 = Minecraft.debugFPS;
        Render2D.drawRoundedRect(var100000, y + fpsOffsetY, small1.getWidth("  " + var12 + "fps") + 14.0F, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());

        small.drawString(stack, "Catlavan", (double)(x + offsetX + 5.0F), (double)(y + offsetY + 7.0F), (new Color(255, 255, 255, 255)).getRGB());

        Minecraft var10002 = mc;
        small.drawString(stack, "  " + Minecraft.debugFPS + "fps" + TextFormatting.GRAY, (double)(x + fpsOffsetX + 4.0F), (double)(y + fpsOffsetY + 7.0F), (new Color(255, 255, 255, 255)).getRGB());

        this.WT.setWidth(textWidth);
        this.WT.setHeight(height);
    }




    public void TargetHUD(MatrixStack stack) {
        float x = this.TargetHUD.getX();
        float y = this.TargetHUD.getY();
        float width = 91.0F;
        float height = 34.0F;
        float widthFace = 34.0F;
        this.target = this.getTarget(this.target);
        this.targetHudAnimation.setDuration(280);
        this.scale = this.targetHudAnimation.getOutput();
        if (this.scale == 0.0) {
            this.target = null;
        }

        if (this.target != null) {
            GlStateManager.pushMatrix();
            AnimationMath.sizeAnimation((double)(x + width / 2.0F), (double)(y + 15.0F), this.scale);
            Render2D.drawRoundedRect(x + 3.0F, y, width, height, 2.0F, (new Color(4, 4, 4, 215)).getRGB());
            if (this.target instanceof PlayerEntity) {
                Render2D.drawFace(x + 6.5F, y + 4.0F, 8.0F, 8.0F, 8.0F, 8.0F, 27.0F, 26.0F, 64.0F, 64.0F, (AbstractClientPlayerEntity)this.target);
            }

            int count = 0;

            for(int i = 0; i < mc.player.inventory.getSizeInventory(); ++i) {
                ItemStack s = mc.player.inventory.getStackInSlot(i);
                if (s.getItem() == Items.TOTEM_OF_UNDYING) {
                    ++count;
                }
            }

            float xHP = x + widthFace + 3.8F;
            float yHP = y + 21.5F;
            float widthHP = 52.0F;
            this.health = AnimationMath.fast(this.health, this.target.getHealth() / this.target.getMaxHealth(), 6.0F);
            this.health = MathHelper.clamp(this.health, 0.0F, 1.0F);
            this.absorpation = AnimationMath.fast(this.absorpation, this.target.getAbsorptionAmount() / this.target.getMaxHealth(), 6.0F);
            this.absorpation = MathHelper.clamp(this.absorpation, 0.0F, 1.0F);
            int green_color;
            int blackgreen_color;
            if (this.target.getHealth() > 5.0F) {
                if (this.target.getHealth() > 12.0F) {
                    green_color = (new Color(85, 201, 21, 255)).getRGB();
                    blackgreen_color = (new Color(44, 141, 24, 255)).getRGB();
                    Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
                } else {
                    green_color = (new Color(255, 101, 5, 255)).getRGB();
                    blackgreen_color = (new Color(150, 87, 21, 255)).getRGB();
                    Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
                }
            } else {
                green_color = (new Color(238, 35, 35, 255)).getRGB();
                blackgreen_color = (new Color(185, 22, 22, 255)).getRGB();
                Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
            }

            Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.absorpation, 5.6F, 1.0F, (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB());
            String targetName = this.target.getName().getString();
            StyledFont small = Fonts.gilroyBold[13];
            SmartScissor.push();
            SmartScissor.setFromComponentCoordinates((double)x, (double)y, (double)(width - 6.0F), (double)height);
            small.drawString(stack, targetName, (double)xHP, (double)(yHP - 14.3F), (new Color(255, 255, 255, 255)).getRGB());
            SmartScissor.unset();
            SmartScissor.pop();
            String HP = String.valueOf(this.target.getHealth() + this.target.getAbsorptionAmount());
            String StringHP = HP.substring(0, Math.min(HP.length(), 4));
            if (this.target.getHealth() + this.target.getAbsorptionAmount() < 10.0F) {
                StringHP = HP.substring(0, Math.min(HP.length(), 3));
            }

            StyledFont small1 = Fonts.gilroyBold[11];
            small1.drawString(stack, "HP: " + StringHP, (double)xHP, (double)(yHP - 5.7F), (new Color(255, 255, 255, 255)).getRGB());
            this.drawItemStack(x, y - 12.0F, 10.5F, 0.7F);
            GlStateManager.popMatrix();
            this.TargetHUD.setWidth(width);
            this.TargetHUD.setHeight(height);
        }

    }

    private void drawItemStack(float x, float y, float offset, float scaleValue) {
        ArrayList<ItemStack> stackList = new ArrayList(Arrays.asList(this.target.getHeldItemMainhand(), this.target.getHeldItemOffhand()));
        stackList.addAll((Collection)this.target.getArmorInventoryList());
        AtomicReference<Float> posX = new AtomicReference(x);
        stackList.stream().filter((stack) -> {
            return !stack.isEmpty();
        }).forEach((stack) -> {
            HudUtil.drawItemStack(stack, (Float)posX.getAndAccumulate(offset, Float::sum), y, true, true, scaleValue);
        });
    }

    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity target = nullTarget;
        AttackAura var10000 = Managment.FUNCTION_MANAGER.attackAura;
        if (AttackAura.getTarget() instanceof LivingEntity) {
            var10000 = Managment.FUNCTION_MANAGER.attackAura;
            target = AttackAura.getTarget();
            this.targetHudAnimation.setDirection(Direction.FORWARDS);
        } else if (IMinecraft.mc.currentScreen instanceof ChatScreen) {
            target = IMinecraft.mc.player;
            this.targetHudAnimation.setDirection(Direction.FORWARDS);
        } else {
            this.targetHudAnimation.setDirection(Direction.BACKWARDS);
        }

        return (LivingEntity)target;
    }
}
сливали!!!
 
Начинающий
Статус
Онлайн
Регистрация
26 Дек 2023
Сообщения
798
Реакции[?]
10
Поинты[?]
4K
Короче вот
Пожалуйста, авторизуйтесь для просмотра ссылки.

ДА ПОНИМАЮ ГОВНО КРИВО И Т.Д Я НАПИСАЛ НА СКОРУЮ РУКУ! ПОТОМУ ЧТО СКУЧНО
Вот сам код
САМ КОД:
package intensity.cc.modules.impl.render;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.DisplayEffectsScreen;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.network.play.NetworkPlayerInfo;
import net.minecraft.client.renderer.texture.PotionSpriteUploader;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Team;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.TextFormatting;
import intensity.cc.Initilization;
import intensity.cc.events.Event;
import intensity.cc.events.impl.render.EventRender;
import intensity.cc.managment.Managment;
import intensity.cc.modules.Function;
import intensity.cc.modules.FunctionAnnotation;
import intensity.cc.modules.Type;
import intensity.cc.modules.impl.combat.AttackAura;
import intensity.cc.modules.settings.Setting;
import intensity.cc.modules.settings.imp.BooleanOption;
import intensity.cc.modules.settings.imp.MultiBoxSetting;
import intensity.cc.modules.settings.imp.SliderSetting;
import intensity.cc.managment.StyleManager;
import intensity.cc.util.ClientUtil;
import intensity.cc.util.IMinecraft;
import intensity.cc.util.animations.Animation;
import intensity.cc.util.animations.Direction;
import intensity.cc.util.animations.impl.EaseBackIn;
import intensity.cc.util.drag.Dragging;
import intensity.cc.util.font.Fonts;
import intensity.cc.util.font.styled.StyledFont;
import intensity.cc.util.misc.HudUtil;
import intensity.cc.util.misc.TimerUtil;
import intensity.cc.util.render.ColorUtil;
import intensity.cc.util.render.RenderUtil.Render2D;
import intensity.cc.util.render.RenderUtil.SmartScissor;
import intensity.cc.util.render.animation.AnimationMath;

@FunctionAnnotation(
        name = "CatlavanHUD",
        type = Type.Render
)
public class HUD extends Function {
    public static MultiBoxSetting elements = new MultiBoxSetting("Элементы", new BooleanOption[]{new BooleanOption("ТХШКА", true), new BooleanOption("ВТШКА", true), new BooleanOption("Корды", true), new BooleanOption("БПС", true), new BooleanOption("Потионс", true), new BooleanOption("Хоткеи", true), new BooleanOption("Стафф", true), new BooleanOption("Бронь", true)});
    private final SliderSetting offsetEffects = (new SliderSetting("Расстояние эффектов", 24.0F, 23.0F, 26.0F, 0.1F)).setVisible(() -> {
        return elements.get(5);
    });

    final Dragging TargetHUD;
    final Dragging TimerHUD;
    final Dragging WT;
    final Dragging Coords;
    final Dragging BPS;
    final Dragging Effects;
    final Dragging KeyBinds;
    final Dragging StaffActive;
    int activeStaff;
    private final Pattern namePattern;
    int activeBind;
    float heightAnimation;
    private float perc;
    private final Animation targetHudAnimation;
    private double scale;
    private LivingEntity target;
    float health;
    float absorpation;

    public HUD() {
        this.TargetHUD = Initilization.createDrag(this, "TargetHUD", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.TimerHUD = Initilization.createDrag(this, "TimerHUD", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.WT = Initilization.createDrag(this, "WT", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.Coords = Initilization.createDrag(this, "Coords", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.BPS = Initilization.createDrag(this, "BPS", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.Effects = Initilization.createDrag(this, "Effects", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.KeyBinds = Initilization.createDrag(this, "KeyBinds", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.StaffActive = Initilization.createDrag(this, "StaffActive", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.activeStaff = 0;
        this.namePattern = Pattern.compile("^\\w{3,16}$");
        this.activeBind = 0;
        this.heightAnimation = 0.0F;
        this.targetHudAnimation = new EaseBackIn(270, 1.0, 1.5F);
        this.scale = 0.0;
        this.target = null;
        this.health = 0.0F;
        this.absorpation = 0.0F;
        this.addSettings(new Setting[]{elements, this.offsetEffects});
    }

    public void onEvent(Event event) {
        if (event instanceof EventRender eventRender) {
            MatrixStack stack = eventRender.matrixStack;
            if (elements.get(0)) {
                this.TargetHUD(stack);
            }

            if (elements.get(1)) {
                this.WT(stack);
            }

            if (elements.get(2)) {
                this.Coords(stack);
            }

            if (elements.get(3)) {
                this.BPS(stack);
            }

            if (elements.get(4)) {
                this.Effects(stack);
            }

            if (elements.get(5)) {
                this.KeyBinds(stack);
            }

            if (elements.get(6)) {
                this.StaffActive(stack);
            }

            if (elements.get(7)) {
                this.ArmorHUD(stack, eventRender);
            }
        }

    }

    public void ArmorHUD(MatrixStack stack, EventRender eventRender) {
        int count = 0;

        for(int i = 0; i < mc.player.inventory.getSizeInventory(); ++i) {
            ItemStack s = mc.player.inventory.getStackInSlot(i);
            if (s.getItem() == Items.TOTEM_OF_UNDYING) {
                ++count;
            }
        }

        float xPos = (float)eventRender.scaledResolution.scaledWidth() / 2.0F;
        float yPos = (float)eventRender.scaledResolution.scaledHeight();
        boolean totemInInv = mc.player.inventory.mainInventory.stream().map(ItemStack::getItem).toList().contains(Items.TOTEM_OF_UNDYING);
        int off = totemInInv ? 5 : 0;
        if (mc.player.isCreative()) {
            yPos += 17.0F;
        }

        for(Iterator var8 = mc.player.inventory.armorInventory.iterator(); var8.hasNext(); off += 15) {
            ItemStack s = (ItemStack)var8.next();
            ESP.drawItemStack(s, (double)(xPos - (float)off + 74.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (double)(yPos - 56.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (String)null, false);
        }

        if (totemInInv) {
            ESP.drawItemStack(new ItemStack(Items.TOTEM_OF_UNDYING), (double)(xPos - (float)off + 73.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (double)(yPos - 56.0F * ((float)mc.gameSettings.guiScale / 2.0F)), String.valueOf(count), false);
        }

    }

    public void StaffActive(MatrixStack stack) {
        float x = this.StaffActive.getX();
        float y = this.StaffActive.getY();
        float offset = 9.0F;
        float height = 20.5F;
        float width = 106.0F;
        height += offset * (float)this.activeStaff - 4.0F;
        float xStaff = x + 26.0F;
        if (this.activeStaff == 0) {
            --height;
            width -= 25.0F;
            xStaff -= 12.5F;
        }

        Render2D.drawRoundedRect(x, y, width, height, 2.5F, (new Color(4, 4, 4, 215)).getRGB());
        StyledFont small1 = Fonts.msSemiBold[14];
        small1.drawString(stack, "   Staff Active", (double)xStaff, (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());
        int i = 0;
        Iterator var10 = mc.world.getScoreboard().getTeams().stream().sorted(Comparator.comparing(Team::getName)).toList().iterator();

        while(true) {
            String name;
            boolean vanish;
            boolean near;
            boolean active;
            do {
                do {
                    if (!var10.hasNext()) {
                        this.activeStaff = i;
                        this.StaffActive.setWidth(width);
                        this.StaffActive.setHeight(height);
                        return;
                    }

                    ScorePlayerTeam team = (ScorePlayerTeam)var10.next();
                    name = team.getMembershipCollection().toString();
                    name = name.substring(1, name.length() - 1);
                } while(!this.namePattern.matcher(name).matches());

                vanish = true;
                near = false;
                active = false;
                Iterator var16 = mc.world.getPlayers().iterator();

                while(var16.hasNext()) {
                    AbstractClientPlayerEntity player = (AbstractClientPlayerEntity)var16.next();
                    if (player.getNameClear().equals(name)) {
                        near = true;
                    }
                }

                var16 = mc.getConnection().getPlayerInfoMap().iterator();

                while(var16.hasNext()) {
                    NetworkPlayerInfo info = (NetworkPlayerInfo)var16.next();
                    if (info.getGameProfile().getName().equals(name)) {
                        vanish = false;
                        if (!near) {
                            active = true;
                        }
                    }
                }
            } while(!vanish && !Managment.STAFF_MANAGER.isStaff(name));

            String Name = name.substring(0, Math.min(name.length(), 13));
            StyledFont small = Fonts.msSemiBold[13];
            StyledFont small2 = Fonts.msMedium[13];
            float yText = y + 17.0F;
            small2.drawString(stack, Name, (double)(x + 4.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
            if (vanish) {
                small.drawString(stack, "Spectator", (double)(x + 68.5F), (double)yText, (new Color(231, 52, 52, 255)).getRGB());
            } else if (active) {
                small.drawString(stack, "Active", (double)(x + 63.5F), (double)yText, (new Color(21, 238, 15, 255)).getRGB());
            } else if (near) {
                small.drawString(stack, "Near", (double)(x + 68.8F), (double)yText, (new Color(229, 188, 23, 255)).getRGB());
            }

            y += offset;
            ++i;
        }
    }

    public void KeyBinds(MatrixStack stack) {
        float x = this.KeyBinds.getX();
        float y = this.KeyBinds.getY();
        float offset = 9.5F;
        float height = 21.0F;
        float width = 75.0F;
        int activeKeyBinds = 0;

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

        height += offset * activeKeyBinds - 5.0F;

        Render2D.drawRoundedRect(x, y, width, height, 2.5F, (new Color(4, 4, 4, 215)).getRGB());
        StyledFont small1 = Fonts.msSemiBold[14];
        small1.drawString(stack, "KeyBinds", (double)(x + 20.0F), (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());

        int index = 0;
        SmartScissor.push();
        SmartScissor.setFromComponentCoordinates((double)x, (double)y, (double)width, (double)height);
        for (Function f : Managment.FUNCTION_MANAGER.getFunctions()) {
            if (f.bind != 0 && f.state) {
                String bindText = "[" + ClientUtil.getKey(f.bind).toUpperCase() + "]";
                float yText = y + 17.0F + index * offset;
                StyledFont small = Fonts.msMedium[13];
                small.drawString(stack, f.name, (double)(x + 4.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
                small.drawString(stack, bindText, (double)(x + 57.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
                index++;
            }
        }
        SmartScissor.unset();
        SmartScissor.pop();

        this.KeyBinds.setWidth(width);
        this.KeyBinds.setHeight(height);
    }


    public void Effects(MatrixStack stack) {
        float x = this.Effects.getX();
        float y = this.Effects.getY();
        float offset = this.offsetEffects.getValue().floatValue();
        float height = 21.3F;
        StyledFont small = Fonts.msSemiBold[13];
        int counterEffect = 0;
        Iterator var8 = mc.player.getActivePotionEffects().iterator();

        while(var8.hasNext()) {
            EffectInstance effectInstance = (EffectInstance)var8.next();
            String levelpotion = String.valueOf(effectInstance.getAmplifier() + 1);
            float textWidthBonus = 27.3F;
            if (levelpotion.contains("1")) {
                levelpotion = "";
                textWidthBonus -= 5.0F;
            }

            String durationText = EffectUtils.getPotionDurationString(effectInstance, 1.0F);
            String text = I18n.format(effectInstance.getEffectName(), new Object[0]);
            float textWidth = small.getWidth(text + effectInstance.getAmplifier() + levelpotion) + textWidthBonus - 0.6F;
            Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
            small.drawString(stack, text + " " + levelpotion, (double)(x + 22.3F), (double)(y + 5.5F), (new Color(255, 255, 255, 255)).getRGB());
            small.drawString(stack, durationText, (double)(x + 22.3F), (double)(y + 13.5F), (new Color(255, 255, 255, 255)).getRGB());
            PotionSpriteUploader potionspriteuploader = mc.getPotionSpriteUploader();
            Effect effect = effectInstance.getPotion();
            TextureAtlasSprite textureatlassprite = potionspriteuploader.getSprite(effect);
            mc.getTextureManager().bindTexture(textureatlassprite.getAtlasTexture().getTextureLocation());
            DisplayEffectsScreen.blit(stack, (int)(x + 2.0F), (int)y + 2, 0, 18, 18, textureatlassprite);
            y += offset;
            ++counterEffect;
            this.Effects.setWidth(textWidth);
        }

        float setHeight = offset / 8.0F * (float)counterEffect;
        this.Effects.setHeight(height * (float)counterEffect + setHeight);
    }

    public void BPS(MatrixStack stack) {
        float x = this.BPS.getX();
        float y = this.BPS.getY();
        float height = 15.0F;
        StyledFont small = Fonts.msSemiBold[14];
        int X = (int)mc.player.getPosX();
        int Y = (int)mc.player.getPosY();
        int Z = (int)mc.player.getPosZ();
        Object[] var10001 = new Object[]{Math.hypot(mc.player.getPosX() - mc.player.prevPosX, mc.player.getPosZ() - mc.player.prevPosZ) * 20.0};
        String text = "Speed: " + String.format("%.2f", var10001);
        float textWidth = small.getWidth(text) + 8.5F;
        Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        small.drawString(stack, text, (double)(x + 4.5F), (double)y + 6.3, (new Color(255, 255, 255, 255)).getRGB());
        this.BPS.setWidth(textWidth);
        this.BPS.setHeight(height);
    }

    public void Coords(MatrixStack stack) {
        float x = this.Coords.getX();
        float y = this.Coords.getY();
        float height = 15.0F;
        StyledFont small = Fonts.msSemiBold[14];
        int X = (int)mc.player.getPosX();
        int Y = (int)mc.player.getPosY();
        int Z = (int)mc.player.getPosZ();
        String text = "Coords: x: " + X + ", y: " + Y + ", z: " + Z;
        float textWidth = small.getWidth(text) + 8.5F;
        Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        small.drawString(stack, text, (double)(x + 4.5F), (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());
        this.Coords.setWidth(textWidth);
        this.Coords.setHeight(height);
    }

    public void WT(MatrixStack stack) {
        float x = this.WT.getX();
        float y = this.WT.getY();
        float height = 17.0F;
        StyledFont small1 = Fonts.msSemiBold[14];
        StyledFont small = Fonts.msSemiBold[15];
        String playerName = mc.player.getName().getString();

        float offsetX = 1.0F;
        float offsetY = 1.5F;
        float fpsOffsetX = 50.0F;
        float fpsOffsetY = 1.5F;

        Minecraft var10000 = mc;
        String FPS = Minecraft.debugFPS + " FPS";
        String text = "Catlavan";
        float textWidth = small1.getWidth(text) + 13.0F;
        Render2D.drawRoundedRect(x + offsetX, y + offsetY, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        float var100000 = x + fpsOffsetX;
        Minecraft var10003 = mc;
        int var12 = Minecraft.debugFPS;
        Render2D.drawRoundedRect(var100000, y + fpsOffsetY, small1.getWidth("  " + var12 + "fps") + 14.0F, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());

        small.drawString(stack, "Catlavan", (double)(x + offsetX + 5.0F), (double)(y + offsetY + 7.0F), (new Color(255, 255, 255, 255)).getRGB());

        Minecraft var10002 = mc;
        small.drawString(stack, "  " + Minecraft.debugFPS + "fps" + TextFormatting.GRAY, (double)(x + fpsOffsetX + 4.0F), (double)(y + fpsOffsetY + 7.0F), (new Color(255, 255, 255, 255)).getRGB());

        this.WT.setWidth(textWidth);
        this.WT.setHeight(height);
    }




    public void TargetHUD(MatrixStack stack) {
        float x = this.TargetHUD.getX();
        float y = this.TargetHUD.getY();
        float width = 91.0F;
        float height = 34.0F;
        float widthFace = 34.0F;
        this.target = this.getTarget(this.target);
        this.targetHudAnimation.setDuration(280);
        this.scale = this.targetHudAnimation.getOutput();
        if (this.scale == 0.0) {
            this.target = null;
        }

        if (this.target != null) {
            GlStateManager.pushMatrix();
            AnimationMath.sizeAnimation((double)(x + width / 2.0F), (double)(y + 15.0F), this.scale);
            Render2D.drawRoundedRect(x + 3.0F, y, width, height, 2.0F, (new Color(4, 4, 4, 215)).getRGB());
            if (this.target instanceof PlayerEntity) {
                Render2D.drawFace(x + 6.5F, y + 4.0F, 8.0F, 8.0F, 8.0F, 8.0F, 27.0F, 26.0F, 64.0F, 64.0F, (AbstractClientPlayerEntity)this.target);
            }

            int count = 0;

            for(int i = 0; i < mc.player.inventory.getSizeInventory(); ++i) {
                ItemStack s = mc.player.inventory.getStackInSlot(i);
                if (s.getItem() == Items.TOTEM_OF_UNDYING) {
                    ++count;
                }
            }

            float xHP = x + widthFace + 3.8F;
            float yHP = y + 21.5F;
            float widthHP = 52.0F;
            this.health = AnimationMath.fast(this.health, this.target.getHealth() / this.target.getMaxHealth(), 6.0F);
            this.health = MathHelper.clamp(this.health, 0.0F, 1.0F);
            this.absorpation = AnimationMath.fast(this.absorpation, this.target.getAbsorptionAmount() / this.target.getMaxHealth(), 6.0F);
            this.absorpation = MathHelper.clamp(this.absorpation, 0.0F, 1.0F);
            int green_color;
            int blackgreen_color;
            if (this.target.getHealth() > 5.0F) {
                if (this.target.getHealth() > 12.0F) {
                    green_color = (new Color(85, 201, 21, 255)).getRGB();
                    blackgreen_color = (new Color(44, 141, 24, 255)).getRGB();
                    Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
                } else {
                    green_color = (new Color(255, 101, 5, 255)).getRGB();
                    blackgreen_color = (new Color(150, 87, 21, 255)).getRGB();
                    Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
                }
            } else {
                green_color = (new Color(238, 35, 35, 255)).getRGB();
                blackgreen_color = (new Color(185, 22, 22, 255)).getRGB();
                Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
            }

            Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.absorpation, 5.6F, 1.0F, (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB());
            String targetName = this.target.getName().getString();
            StyledFont small = Fonts.gilroyBold[13];
            SmartScissor.push();
            SmartScissor.setFromComponentCoordinates((double)x, (double)y, (double)(width - 6.0F), (double)height);
            small.drawString(stack, targetName, (double)xHP, (double)(yHP - 14.3F), (new Color(255, 255, 255, 255)).getRGB());
            SmartScissor.unset();
            SmartScissor.pop();
            String HP = String.valueOf(this.target.getHealth() + this.target.getAbsorptionAmount());
            String StringHP = HP.substring(0, Math.min(HP.length(), 4));
            if (this.target.getHealth() + this.target.getAbsorptionAmount() < 10.0F) {
                StringHP = HP.substring(0, Math.min(HP.length(), 3));
            }

            StyledFont small1 = Fonts.gilroyBold[11];
            small1.drawString(stack, "HP: " + StringHP, (double)xHP, (double)(yHP - 5.7F), (new Color(255, 255, 255, 255)).getRGB());
            this.drawItemStack(x, y - 12.0F, 10.5F, 0.7F);
            GlStateManager.popMatrix();
            this.TargetHUD.setWidth(width);
            this.TargetHUD.setHeight(height);
        }

    }

    private void drawItemStack(float x, float y, float offset, float scaleValue) {
        ArrayList<ItemStack> stackList = new ArrayList(Arrays.asList(this.target.getHeldItemMainhand(), this.target.getHeldItemOffhand()));
        stackList.addAll((Collection)this.target.getArmorInventoryList());
        AtomicReference<Float> posX = new AtomicReference(x);
        stackList.stream().filter((stack) -> {
            return !stack.isEmpty();
        }).forEach((stack) -> {
            HudUtil.drawItemStack(stack, (Float)posX.getAndAccumulate(offset, Float::sum), y, true, true, scaleValue);
        });
    }

    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity target = nullTarget;
        AttackAura var10000 = Managment.FUNCTION_MANAGER.attackAura;
        if (AttackAura.getTarget() instanceof LivingEntity) {
            var10000 = Managment.FUNCTION_MANAGER.attackAura;
            target = AttackAura.getTarget();
            this.targetHudAnimation.setDirection(Direction.FORWARDS);
        } else if (IMinecraft.mc.currentScreen instanceof ChatScreen) {
            target = IMinecraft.mc.player;
            this.targetHudAnimation.setDirection(Direction.FORWARDS);
        } else {
            this.targetHudAnimation.setDirection(Direction.BACKWARDS);
        }

        return (LivingEntity)target;
    }
}
говно
 
Начинающий
Статус
Оффлайн
Регистрация
8 Авг 2024
Сообщения
433
Реакции[?]
3
Поинты[?]
4K
Короче вот
Пожалуйста, авторизуйтесь для просмотра ссылки.

ДА ПОНИМАЮ ГОВНО КРИВО И Т.Д Я НАПИСАЛ НА СКОРУЮ РУКУ! ПОТОМУ ЧТО СКУЧНО
Вот сам код
САМ КОД:
package intensity.cc.modules.impl.render;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.DisplayEffectsScreen;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.network.play.NetworkPlayerInfo;
import net.minecraft.client.renderer.texture.PotionSpriteUploader;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Team;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.TextFormatting;
import intensity.cc.Initilization;
import intensity.cc.events.Event;
import intensity.cc.events.impl.render.EventRender;
import intensity.cc.managment.Managment;
import intensity.cc.modules.Function;
import intensity.cc.modules.FunctionAnnotation;
import intensity.cc.modules.Type;
import intensity.cc.modules.impl.combat.AttackAura;
import intensity.cc.modules.settings.Setting;
import intensity.cc.modules.settings.imp.BooleanOption;
import intensity.cc.modules.settings.imp.MultiBoxSetting;
import intensity.cc.modules.settings.imp.SliderSetting;
import intensity.cc.managment.StyleManager;
import intensity.cc.util.ClientUtil;
import intensity.cc.util.IMinecraft;
import intensity.cc.util.animations.Animation;
import intensity.cc.util.animations.Direction;
import intensity.cc.util.animations.impl.EaseBackIn;
import intensity.cc.util.drag.Dragging;
import intensity.cc.util.font.Fonts;
import intensity.cc.util.font.styled.StyledFont;
import intensity.cc.util.misc.HudUtil;
import intensity.cc.util.misc.TimerUtil;
import intensity.cc.util.render.ColorUtil;
import intensity.cc.util.render.RenderUtil.Render2D;
import intensity.cc.util.render.RenderUtil.SmartScissor;
import intensity.cc.util.render.animation.AnimationMath;

@FunctionAnnotation(
        name = "CatlavanHUD",
        type = Type.Render
)
public class HUD extends Function {
    public static MultiBoxSetting elements = new MultiBoxSetting("Элементы", new BooleanOption[]{new BooleanOption("ТХШКА", true), new BooleanOption("ВТШКА", true), new BooleanOption("Корды", true), new BooleanOption("БПС", true), new BooleanOption("Потионс", true), new BooleanOption("Хоткеи", true), new BooleanOption("Стафф", true), new BooleanOption("Бронь", true)});
    private final SliderSetting offsetEffects = (new SliderSetting("Расстояние эффектов", 24.0F, 23.0F, 26.0F, 0.1F)).setVisible(() -> {
        return elements.get(5);
    });

    final Dragging TargetHUD;
    final Dragging TimerHUD;
    final Dragging WT;
    final Dragging Coords;
    final Dragging BPS;
    final Dragging Effects;
    final Dragging KeyBinds;
    final Dragging StaffActive;
    int activeStaff;
    private final Pattern namePattern;
    int activeBind;
    float heightAnimation;
    private float perc;
    private final Animation targetHudAnimation;
    private double scale;
    private LivingEntity target;
    float health;
    float absorpation;

    public HUD() {
        this.TargetHUD = Initilization.createDrag(this, "TargetHUD", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.TimerHUD = Initilization.createDrag(this, "TimerHUD", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.WT = Initilization.createDrag(this, "WT", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.Coords = Initilization.createDrag(this, "Coords", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.BPS = Initilization.createDrag(this, "BPS", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.Effects = Initilization.createDrag(this, "Effects", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.KeyBinds = Initilization.createDrag(this, "KeyBinds", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.StaffActive = Initilization.createDrag(this, "StaffActive", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.activeStaff = 0;
        this.namePattern = Pattern.compile("^\\w{3,16}$");
        this.activeBind = 0;
        this.heightAnimation = 0.0F;
        this.targetHudAnimation = new EaseBackIn(270, 1.0, 1.5F);
        this.scale = 0.0;
        this.target = null;
        this.health = 0.0F;
        this.absorpation = 0.0F;
        this.addSettings(new Setting[]{elements, this.offsetEffects});
    }

    public void onEvent(Event event) {
        if (event instanceof EventRender eventRender) {
            MatrixStack stack = eventRender.matrixStack;
            if (elements.get(0)) {
                this.TargetHUD(stack);
            }

            if (elements.get(1)) {
                this.WT(stack);
            }

            if (elements.get(2)) {
                this.Coords(stack);
            }

            if (elements.get(3)) {
                this.BPS(stack);
            }

            if (elements.get(4)) {
                this.Effects(stack);
            }

            if (elements.get(5)) {
                this.KeyBinds(stack);
            }

            if (elements.get(6)) {
                this.StaffActive(stack);
            }

            if (elements.get(7)) {
                this.ArmorHUD(stack, eventRender);
            }
        }

    }

    public void ArmorHUD(MatrixStack stack, EventRender eventRender) {
        int count = 0;

        for(int i = 0; i < mc.player.inventory.getSizeInventory(); ++i) {
            ItemStack s = mc.player.inventory.getStackInSlot(i);
            if (s.getItem() == Items.TOTEM_OF_UNDYING) {
                ++count;
            }
        }

        float xPos = (float)eventRender.scaledResolution.scaledWidth() / 2.0F;
        float yPos = (float)eventRender.scaledResolution.scaledHeight();
        boolean totemInInv = mc.player.inventory.mainInventory.stream().map(ItemStack::getItem).toList().contains(Items.TOTEM_OF_UNDYING);
        int off = totemInInv ? 5 : 0;
        if (mc.player.isCreative()) {
            yPos += 17.0F;
        }

        for(Iterator var8 = mc.player.inventory.armorInventory.iterator(); var8.hasNext(); off += 15) {
            ItemStack s = (ItemStack)var8.next();
            ESP.drawItemStack(s, (double)(xPos - (float)off + 74.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (double)(yPos - 56.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (String)null, false);
        }

        if (totemInInv) {
            ESP.drawItemStack(new ItemStack(Items.TOTEM_OF_UNDYING), (double)(xPos - (float)off + 73.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (double)(yPos - 56.0F * ((float)mc.gameSettings.guiScale / 2.0F)), String.valueOf(count), false);
        }

    }

    public void StaffActive(MatrixStack stack) {
        float x = this.StaffActive.getX();
        float y = this.StaffActive.getY();
        float offset = 9.0F;
        float height = 20.5F;
        float width = 106.0F;
        height += offset * (float)this.activeStaff - 4.0F;
        float xStaff = x + 26.0F;
        if (this.activeStaff == 0) {
            --height;
            width -= 25.0F;
            xStaff -= 12.5F;
        }

        Render2D.drawRoundedRect(x, y, width, height, 2.5F, (new Color(4, 4, 4, 215)).getRGB());
        StyledFont small1 = Fonts.msSemiBold[14];
        small1.drawString(stack, "   Staff Active", (double)xStaff, (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());
        int i = 0;
        Iterator var10 = mc.world.getScoreboard().getTeams().stream().sorted(Comparator.comparing(Team::getName)).toList().iterator();

        while(true) {
            String name;
            boolean vanish;
            boolean near;
            boolean active;
            do {
                do {
                    if (!var10.hasNext()) {
                        this.activeStaff = i;
                        this.StaffActive.setWidth(width);
                        this.StaffActive.setHeight(height);
                        return;
                    }

                    ScorePlayerTeam team = (ScorePlayerTeam)var10.next();
                    name = team.getMembershipCollection().toString();
                    name = name.substring(1, name.length() - 1);
                } while(!this.namePattern.matcher(name).matches());

                vanish = true;
                near = false;
                active = false;
                Iterator var16 = mc.world.getPlayers().iterator();

                while(var16.hasNext()) {
                    AbstractClientPlayerEntity player = (AbstractClientPlayerEntity)var16.next();
                    if (player.getNameClear().equals(name)) {
                        near = true;
                    }
                }

                var16 = mc.getConnection().getPlayerInfoMap().iterator();

                while(var16.hasNext()) {
                    NetworkPlayerInfo info = (NetworkPlayerInfo)var16.next();
                    if (info.getGameProfile().getName().equals(name)) {
                        vanish = false;
                        if (!near) {
                            active = true;
                        }
                    }
                }
            } while(!vanish && !Managment.STAFF_MANAGER.isStaff(name));

            String Name = name.substring(0, Math.min(name.length(), 13));
            StyledFont small = Fonts.msSemiBold[13];
            StyledFont small2 = Fonts.msMedium[13];
            float yText = y + 17.0F;
            small2.drawString(stack, Name, (double)(x + 4.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
            if (vanish) {
                small.drawString(stack, "Spectator", (double)(x + 68.5F), (double)yText, (new Color(231, 52, 52, 255)).getRGB());
            } else if (active) {
                small.drawString(stack, "Active", (double)(x + 63.5F), (double)yText, (new Color(21, 238, 15, 255)).getRGB());
            } else if (near) {
                small.drawString(stack, "Near", (double)(x + 68.8F), (double)yText, (new Color(229, 188, 23, 255)).getRGB());
            }

            y += offset;
            ++i;
        }
    }

    public void KeyBinds(MatrixStack stack) {
        float x = this.KeyBinds.getX();
        float y = this.KeyBinds.getY();
        float offset = 9.5F;
        float height = 21.0F;
        float width = 75.0F;
        int activeKeyBinds = 0;

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

        height += offset * activeKeyBinds - 5.0F;

        Render2D.drawRoundedRect(x, y, width, height, 2.5F, (new Color(4, 4, 4, 215)).getRGB());
        StyledFont small1 = Fonts.msSemiBold[14];
        small1.drawString(stack, "KeyBinds", (double)(x + 20.0F), (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());

        int index = 0;
        SmartScissor.push();
        SmartScissor.setFromComponentCoordinates((double)x, (double)y, (double)width, (double)height);
        for (Function f : Managment.FUNCTION_MANAGER.getFunctions()) {
            if (f.bind != 0 && f.state) {
                String bindText = "[" + ClientUtil.getKey(f.bind).toUpperCase() + "]";
                float yText = y + 17.0F + index * offset;
                StyledFont small = Fonts.msMedium[13];
                small.drawString(stack, f.name, (double)(x + 4.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
                small.drawString(stack, bindText, (double)(x + 57.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
                index++;
            }
        }
        SmartScissor.unset();
        SmartScissor.pop();

        this.KeyBinds.setWidth(width);
        this.KeyBinds.setHeight(height);
    }


    public void Effects(MatrixStack stack) {
        float x = this.Effects.getX();
        float y = this.Effects.getY();
        float offset = this.offsetEffects.getValue().floatValue();
        float height = 21.3F;
        StyledFont small = Fonts.msSemiBold[13];
        int counterEffect = 0;
        Iterator var8 = mc.player.getActivePotionEffects().iterator();

        while(var8.hasNext()) {
            EffectInstance effectInstance = (EffectInstance)var8.next();
            String levelpotion = String.valueOf(effectInstance.getAmplifier() + 1);
            float textWidthBonus = 27.3F;
            if (levelpotion.contains("1")) {
                levelpotion = "";
                textWidthBonus -= 5.0F;
            }

            String durationText = EffectUtils.getPotionDurationString(effectInstance, 1.0F);
            String text = I18n.format(effectInstance.getEffectName(), new Object[0]);
            float textWidth = small.getWidth(text + effectInstance.getAmplifier() + levelpotion) + textWidthBonus - 0.6F;
            Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
            small.drawString(stack, text + " " + levelpotion, (double)(x + 22.3F), (double)(y + 5.5F), (new Color(255, 255, 255, 255)).getRGB());
            small.drawString(stack, durationText, (double)(x + 22.3F), (double)(y + 13.5F), (new Color(255, 255, 255, 255)).getRGB());
            PotionSpriteUploader potionspriteuploader = mc.getPotionSpriteUploader();
            Effect effect = effectInstance.getPotion();
            TextureAtlasSprite textureatlassprite = potionspriteuploader.getSprite(effect);
            mc.getTextureManager().bindTexture(textureatlassprite.getAtlasTexture().getTextureLocation());
            DisplayEffectsScreen.blit(stack, (int)(x + 2.0F), (int)y + 2, 0, 18, 18, textureatlassprite);
            y += offset;
            ++counterEffect;
            this.Effects.setWidth(textWidth);
        }

        float setHeight = offset / 8.0F * (float)counterEffect;
        this.Effects.setHeight(height * (float)counterEffect + setHeight);
    }

    public void BPS(MatrixStack stack) {
        float x = this.BPS.getX();
        float y = this.BPS.getY();
        float height = 15.0F;
        StyledFont small = Fonts.msSemiBold[14];
        int X = (int)mc.player.getPosX();
        int Y = (int)mc.player.getPosY();
        int Z = (int)mc.player.getPosZ();
        Object[] var10001 = new Object[]{Math.hypot(mc.player.getPosX() - mc.player.prevPosX, mc.player.getPosZ() - mc.player.prevPosZ) * 20.0};
        String text = "Speed: " + String.format("%.2f", var10001);
        float textWidth = small.getWidth(text) + 8.5F;
        Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        small.drawString(stack, text, (double)(x + 4.5F), (double)y + 6.3, (new Color(255, 255, 255, 255)).getRGB());
        this.BPS.setWidth(textWidth);
        this.BPS.setHeight(height);
    }

    public void Coords(MatrixStack stack) {
        float x = this.Coords.getX();
        float y = this.Coords.getY();
        float height = 15.0F;
        StyledFont small = Fonts.msSemiBold[14];
        int X = (int)mc.player.getPosX();
        int Y = (int)mc.player.getPosY();
        int Z = (int)mc.player.getPosZ();
        String text = "Coords: x: " + X + ", y: " + Y + ", z: " + Z;
        float textWidth = small.getWidth(text) + 8.5F;
        Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        small.drawString(stack, text, (double)(x + 4.5F), (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());
        this.Coords.setWidth(textWidth);
        this.Coords.setHeight(height);
    }

    public void WT(MatrixStack stack) {
        float x = this.WT.getX();
        float y = this.WT.getY();
        float height = 17.0F;
        StyledFont small1 = Fonts.msSemiBold[14];
        StyledFont small = Fonts.msSemiBold[15];
        String playerName = mc.player.getName().getString();

        float offsetX = 1.0F;
        float offsetY = 1.5F;
        float fpsOffsetX = 50.0F;
        float fpsOffsetY = 1.5F;

        Minecraft var10000 = mc;
        String FPS = Minecraft.debugFPS + " FPS";
        String text = "Catlavan";
        float textWidth = small1.getWidth(text) + 13.0F;
        Render2D.drawRoundedRect(x + offsetX, y + offsetY, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        float var100000 = x + fpsOffsetX;
        Minecraft var10003 = mc;
        int var12 = Minecraft.debugFPS;
        Render2D.drawRoundedRect(var100000, y + fpsOffsetY, small1.getWidth("  " + var12 + "fps") + 14.0F, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());

        small.drawString(stack, "Catlavan", (double)(x + offsetX + 5.0F), (double)(y + offsetY + 7.0F), (new Color(255, 255, 255, 255)).getRGB());

        Minecraft var10002 = mc;
        small.drawString(stack, "  " + Minecraft.debugFPS + "fps" + TextFormatting.GRAY, (double)(x + fpsOffsetX + 4.0F), (double)(y + fpsOffsetY + 7.0F), (new Color(255, 255, 255, 255)).getRGB());

        this.WT.setWidth(textWidth);
        this.WT.setHeight(height);
    }




    public void TargetHUD(MatrixStack stack) {
        float x = this.TargetHUD.getX();
        float y = this.TargetHUD.getY();
        float width = 91.0F;
        float height = 34.0F;
        float widthFace = 34.0F;
        this.target = this.getTarget(this.target);
        this.targetHudAnimation.setDuration(280);
        this.scale = this.targetHudAnimation.getOutput();
        if (this.scale == 0.0) {
            this.target = null;
        }

        if (this.target != null) {
            GlStateManager.pushMatrix();
            AnimationMath.sizeAnimation((double)(x + width / 2.0F), (double)(y + 15.0F), this.scale);
            Render2D.drawRoundedRect(x + 3.0F, y, width, height, 2.0F, (new Color(4, 4, 4, 215)).getRGB());
            if (this.target instanceof PlayerEntity) {
                Render2D.drawFace(x + 6.5F, y + 4.0F, 8.0F, 8.0F, 8.0F, 8.0F, 27.0F, 26.0F, 64.0F, 64.0F, (AbstractClientPlayerEntity)this.target);
            }

            int count = 0;

            for(int i = 0; i < mc.player.inventory.getSizeInventory(); ++i) {
                ItemStack s = mc.player.inventory.getStackInSlot(i);
                if (s.getItem() == Items.TOTEM_OF_UNDYING) {
                    ++count;
                }
            }

            float xHP = x + widthFace + 3.8F;
            float yHP = y + 21.5F;
            float widthHP = 52.0F;
            this.health = AnimationMath.fast(this.health, this.target.getHealth() / this.target.getMaxHealth(), 6.0F);
            this.health = MathHelper.clamp(this.health, 0.0F, 1.0F);
            this.absorpation = AnimationMath.fast(this.absorpation, this.target.getAbsorptionAmount() / this.target.getMaxHealth(), 6.0F);
            this.absorpation = MathHelper.clamp(this.absorpation, 0.0F, 1.0F);
            int green_color;
            int blackgreen_color;
            if (this.target.getHealth() > 5.0F) {
                if (this.target.getHealth() > 12.0F) {
                    green_color = (new Color(85, 201, 21, 255)).getRGB();
                    blackgreen_color = (new Color(44, 141, 24, 255)).getRGB();
                    Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
                } else {
                    green_color = (new Color(255, 101, 5, 255)).getRGB();
                    blackgreen_color = (new Color(150, 87, 21, 255)).getRGB();
                    Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
                }
            } else {
                green_color = (new Color(238, 35, 35, 255)).getRGB();
                blackgreen_color = (new Color(185, 22, 22, 255)).getRGB();
                Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
            }

            Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.absorpation, 5.6F, 1.0F, (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB());
            String targetName = this.target.getName().getString();
            StyledFont small = Fonts.gilroyBold[13];
            SmartScissor.push();
            SmartScissor.setFromComponentCoordinates((double)x, (double)y, (double)(width - 6.0F), (double)height);
            small.drawString(stack, targetName, (double)xHP, (double)(yHP - 14.3F), (new Color(255, 255, 255, 255)).getRGB());
            SmartScissor.unset();
            SmartScissor.pop();
            String HP = String.valueOf(this.target.getHealth() + this.target.getAbsorptionAmount());
            String StringHP = HP.substring(0, Math.min(HP.length(), 4));
            if (this.target.getHealth() + this.target.getAbsorptionAmount() < 10.0F) {
                StringHP = HP.substring(0, Math.min(HP.length(), 3));
            }

            StyledFont small1 = Fonts.gilroyBold[11];
            small1.drawString(stack, "HP: " + StringHP, (double)xHP, (double)(yHP - 5.7F), (new Color(255, 255, 255, 255)).getRGB());
            this.drawItemStack(x, y - 12.0F, 10.5F, 0.7F);
            GlStateManager.popMatrix();
            this.TargetHUD.setWidth(width);
            this.TargetHUD.setHeight(height);
        }

    }

    private void drawItemStack(float x, float y, float offset, float scaleValue) {
        ArrayList<ItemStack> stackList = new ArrayList(Arrays.asList(this.target.getHeldItemMainhand(), this.target.getHeldItemOffhand()));
        stackList.addAll((Collection)this.target.getArmorInventoryList());
        AtomicReference<Float> posX = new AtomicReference(x);
        stackList.stream().filter((stack) -> {
            return !stack.isEmpty();
        }).forEach((stack) -> {
            HudUtil.drawItemStack(stack, (Float)posX.getAndAccumulate(offset, Float::sum), y, true, true, scaleValue);
        });
    }

    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity target = nullTarget;
        AttackAura var10000 = Managment.FUNCTION_MANAGER.attackAura;
        if (AttackAura.getTarget() instanceof LivingEntity) {
            var10000 = Managment.FUNCTION_MANAGER.attackAura;
            target = AttackAura.getTarget();
            this.targetHudAnimation.setDirection(Direction.FORWARDS);
        } else if (IMinecraft.mc.currentScreen instanceof ChatScreen) {
            target = IMinecraft.mc.player;
            this.targetHudAnimation.setDirection(Direction.FORWARDS);
        } else {
            this.targetHudAnimation.setDirection(Direction.BACKWARDS);
        }

        return (LivingEntity)target;
    }
}
Лучше чем в катлаване
 
Начинающий
Статус
Оффлайн
Регистрация
23 Апр 2024
Сообщения
458
Реакции[?]
1
Поинты[?]
2K
Короче вот
Пожалуйста, авторизуйтесь для просмотра ссылки.

ДА ПОНИМАЮ ГОВНО КРИВО И Т.Д Я НАПИСАЛ НА СКОРУЮ РУКУ! ПОТОМУ ЧТО СКУЧНО
Вот сам код
САМ КОД:
package intensity.cc.modules.impl.render;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.DisplayEffectsScreen;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.network.play.NetworkPlayerInfo;
import net.minecraft.client.renderer.texture.PotionSpriteUploader;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Team;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.TextFormatting;
import intensity.cc.Initilization;
import intensity.cc.events.Event;
import intensity.cc.events.impl.render.EventRender;
import intensity.cc.managment.Managment;
import intensity.cc.modules.Function;
import intensity.cc.modules.FunctionAnnotation;
import intensity.cc.modules.Type;
import intensity.cc.modules.impl.combat.AttackAura;
import intensity.cc.modules.settings.Setting;
import intensity.cc.modules.settings.imp.BooleanOption;
import intensity.cc.modules.settings.imp.MultiBoxSetting;
import intensity.cc.modules.settings.imp.SliderSetting;
import intensity.cc.managment.StyleManager;
import intensity.cc.util.ClientUtil;
import intensity.cc.util.IMinecraft;
import intensity.cc.util.animations.Animation;
import intensity.cc.util.animations.Direction;
import intensity.cc.util.animations.impl.EaseBackIn;
import intensity.cc.util.drag.Dragging;
import intensity.cc.util.font.Fonts;
import intensity.cc.util.font.styled.StyledFont;
import intensity.cc.util.misc.HudUtil;
import intensity.cc.util.misc.TimerUtil;
import intensity.cc.util.render.ColorUtil;
import intensity.cc.util.render.RenderUtil.Render2D;
import intensity.cc.util.render.RenderUtil.SmartScissor;
import intensity.cc.util.render.animation.AnimationMath;

@FunctionAnnotation(
        name = "CatlavanHUD",
        type = Type.Render
)
public class HUD extends Function {
    public static MultiBoxSetting elements = new MultiBoxSetting("Элементы", new BooleanOption[]{new BooleanOption("ТХШКА", true), new BooleanOption("ВТШКА", true), new BooleanOption("Корды", true), new BooleanOption("БПС", true), new BooleanOption("Потионс", true), new BooleanOption("Хоткеи", true), new BooleanOption("Стафф", true), new BooleanOption("Бронь", true)});
    private final SliderSetting offsetEffects = (new SliderSetting("Расстояние эффектов", 24.0F, 23.0F, 26.0F, 0.1F)).setVisible(() -> {
        return elements.get(5);
    });

    final Dragging TargetHUD;
    final Dragging TimerHUD;
    final Dragging WT;
    final Dragging Coords;
    final Dragging BPS;
    final Dragging Effects;
    final Dragging KeyBinds;
    final Dragging StaffActive;
    int activeStaff;
    private final Pattern namePattern;
    int activeBind;
    float heightAnimation;
    private float perc;
    private final Animation targetHudAnimation;
    private double scale;
    private LivingEntity target;
    float health;
    float absorpation;

    public HUD() {
        this.TargetHUD = Initilization.createDrag(this, "TargetHUD", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.TimerHUD = Initilization.createDrag(this, "TimerHUD", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.WT = Initilization.createDrag(this, "WT", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.Coords = Initilization.createDrag(this, "Coords", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.BPS = Initilization.createDrag(this, "BPS", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.Effects = Initilization.createDrag(this, "Effects", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.KeyBinds = Initilization.createDrag(this, "KeyBinds", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.StaffActive = Initilization.createDrag(this, "StaffActive", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.activeStaff = 0;
        this.namePattern = Pattern.compile("^\\w{3,16}$");
        this.activeBind = 0;
        this.heightAnimation = 0.0F;
        this.targetHudAnimation = new EaseBackIn(270, 1.0, 1.5F);
        this.scale = 0.0;
        this.target = null;
        this.health = 0.0F;
        this.absorpation = 0.0F;
        this.addSettings(new Setting[]{elements, this.offsetEffects});
    }

    public void onEvent(Event event) {
        if (event instanceof EventRender eventRender) {
            MatrixStack stack = eventRender.matrixStack;
            if (elements.get(0)) {
                this.TargetHUD(stack);
            }

            if (elements.get(1)) {
                this.WT(stack);
            }

            if (elements.get(2)) {
                this.Coords(stack);
            }

            if (elements.get(3)) {
                this.BPS(stack);
            }

            if (elements.get(4)) {
                this.Effects(stack);
            }

            if (elements.get(5)) {
                this.KeyBinds(stack);
            }

            if (elements.get(6)) {
                this.StaffActive(stack);
            }

            if (elements.get(7)) {
                this.ArmorHUD(stack, eventRender);
            }
        }

    }

    public void ArmorHUD(MatrixStack stack, EventRender eventRender) {
        int count = 0;

        for(int i = 0; i < mc.player.inventory.getSizeInventory(); ++i) {
            ItemStack s = mc.player.inventory.getStackInSlot(i);
            if (s.getItem() == Items.TOTEM_OF_UNDYING) {
                ++count;
            }
        }

        float xPos = (float)eventRender.scaledResolution.scaledWidth() / 2.0F;
        float yPos = (float)eventRender.scaledResolution.scaledHeight();
        boolean totemInInv = mc.player.inventory.mainInventory.stream().map(ItemStack::getItem).toList().contains(Items.TOTEM_OF_UNDYING);
        int off = totemInInv ? 5 : 0;
        if (mc.player.isCreative()) {
            yPos += 17.0F;
        }

        for(Iterator var8 = mc.player.inventory.armorInventory.iterator(); var8.hasNext(); off += 15) {
            ItemStack s = (ItemStack)var8.next();
            ESP.drawItemStack(s, (double)(xPos - (float)off + 74.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (double)(yPos - 56.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (String)null, false);
        }

        if (totemInInv) {
            ESP.drawItemStack(new ItemStack(Items.TOTEM_OF_UNDYING), (double)(xPos - (float)off + 73.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (double)(yPos - 56.0F * ((float)mc.gameSettings.guiScale / 2.0F)), String.valueOf(count), false);
        }

    }

    public void StaffActive(MatrixStack stack) {
        float x = this.StaffActive.getX();
        float y = this.StaffActive.getY();
        float offset = 9.0F;
        float height = 20.5F;
        float width = 106.0F;
        height += offset * (float)this.activeStaff - 4.0F;
        float xStaff = x + 26.0F;
        if (this.activeStaff == 0) {
            --height;
            width -= 25.0F;
            xStaff -= 12.5F;
        }

        Render2D.drawRoundedRect(x, y, width, height, 2.5F, (new Color(4, 4, 4, 215)).getRGB());
        StyledFont small1 = Fonts.msSemiBold[14];
        small1.drawString(stack, "   Staff Active", (double)xStaff, (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());
        int i = 0;
        Iterator var10 = mc.world.getScoreboard().getTeams().stream().sorted(Comparator.comparing(Team::getName)).toList().iterator();

        while(true) {
            String name;
            boolean vanish;
            boolean near;
            boolean active;
            do {
                do {
                    if (!var10.hasNext()) {
                        this.activeStaff = i;
                        this.StaffActive.setWidth(width);
                        this.StaffActive.setHeight(height);
                        return;
                    }

                    ScorePlayerTeam team = (ScorePlayerTeam)var10.next();
                    name = team.getMembershipCollection().toString();
                    name = name.substring(1, name.length() - 1);
                } while(!this.namePattern.matcher(name).matches());

                vanish = true;
                near = false;
                active = false;
                Iterator var16 = mc.world.getPlayers().iterator();

                while(var16.hasNext()) {
                    AbstractClientPlayerEntity player = (AbstractClientPlayerEntity)var16.next();
                    if (player.getNameClear().equals(name)) {
                        near = true;
                    }
                }

                var16 = mc.getConnection().getPlayerInfoMap().iterator();

                while(var16.hasNext()) {
                    NetworkPlayerInfo info = (NetworkPlayerInfo)var16.next();
                    if (info.getGameProfile().getName().equals(name)) {
                        vanish = false;
                        if (!near) {
                            active = true;
                        }
                    }
                }
            } while(!vanish && !Managment.STAFF_MANAGER.isStaff(name));

            String Name = name.substring(0, Math.min(name.length(), 13));
            StyledFont small = Fonts.msSemiBold[13];
            StyledFont small2 = Fonts.msMedium[13];
            float yText = y + 17.0F;
            small2.drawString(stack, Name, (double)(x + 4.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
            if (vanish) {
                small.drawString(stack, "Spectator", (double)(x + 68.5F), (double)yText, (new Color(231, 52, 52, 255)).getRGB());
            } else if (active) {
                small.drawString(stack, "Active", (double)(x + 63.5F), (double)yText, (new Color(21, 238, 15, 255)).getRGB());
            } else if (near) {
                small.drawString(stack, "Near", (double)(x + 68.8F), (double)yText, (new Color(229, 188, 23, 255)).getRGB());
            }

            y += offset;
            ++i;
        }
    }

    public void KeyBinds(MatrixStack stack) {
        float x = this.KeyBinds.getX();
        float y = this.KeyBinds.getY();
        float offset = 9.5F;
        float height = 21.0F;
        float width = 75.0F;
        int activeKeyBinds = 0;

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

        height += offset * activeKeyBinds - 5.0F;

        Render2D.drawRoundedRect(x, y, width, height, 2.5F, (new Color(4, 4, 4, 215)).getRGB());
        StyledFont small1 = Fonts.msSemiBold[14];
        small1.drawString(stack, "KeyBinds", (double)(x + 20.0F), (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());

        int index = 0;
        SmartScissor.push();
        SmartScissor.setFromComponentCoordinates((double)x, (double)y, (double)width, (double)height);
        for (Function f : Managment.FUNCTION_MANAGER.getFunctions()) {
            if (f.bind != 0 && f.state) {
                String bindText = "[" + ClientUtil.getKey(f.bind).toUpperCase() + "]";
                float yText = y + 17.0F + index * offset;
                StyledFont small = Fonts.msMedium[13];
                small.drawString(stack, f.name, (double)(x + 4.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
                small.drawString(stack, bindText, (double)(x + 57.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
                index++;
            }
        }
        SmartScissor.unset();
        SmartScissor.pop();

        this.KeyBinds.setWidth(width);
        this.KeyBinds.setHeight(height);
    }


    public void Effects(MatrixStack stack) {
        float x = this.Effects.getX();
        float y = this.Effects.getY();
        float offset = this.offsetEffects.getValue().floatValue();
        float height = 21.3F;
        StyledFont small = Fonts.msSemiBold[13];
        int counterEffect = 0;
        Iterator var8 = mc.player.getActivePotionEffects().iterator();

        while(var8.hasNext()) {
            EffectInstance effectInstance = (EffectInstance)var8.next();
            String levelpotion = String.valueOf(effectInstance.getAmplifier() + 1);
            float textWidthBonus = 27.3F;
            if (levelpotion.contains("1")) {
                levelpotion = "";
                textWidthBonus -= 5.0F;
            }

            String durationText = EffectUtils.getPotionDurationString(effectInstance, 1.0F);
            String text = I18n.format(effectInstance.getEffectName(), new Object[0]);
            float textWidth = small.getWidth(text + effectInstance.getAmplifier() + levelpotion) + textWidthBonus - 0.6F;
            Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
            small.drawString(stack, text + " " + levelpotion, (double)(x + 22.3F), (double)(y + 5.5F), (new Color(255, 255, 255, 255)).getRGB());
            small.drawString(stack, durationText, (double)(x + 22.3F), (double)(y + 13.5F), (new Color(255, 255, 255, 255)).getRGB());
            PotionSpriteUploader potionspriteuploader = mc.getPotionSpriteUploader();
            Effect effect = effectInstance.getPotion();
            TextureAtlasSprite textureatlassprite = potionspriteuploader.getSprite(effect);
            mc.getTextureManager().bindTexture(textureatlassprite.getAtlasTexture().getTextureLocation());
            DisplayEffectsScreen.blit(stack, (int)(x + 2.0F), (int)y + 2, 0, 18, 18, textureatlassprite);
            y += offset;
            ++counterEffect;
            this.Effects.setWidth(textWidth);
        }

        float setHeight = offset / 8.0F * (float)counterEffect;
        this.Effects.setHeight(height * (float)counterEffect + setHeight);
    }

    public void BPS(MatrixStack stack) {
        float x = this.BPS.getX();
        float y = this.BPS.getY();
        float height = 15.0F;
        StyledFont small = Fonts.msSemiBold[14];
        int X = (int)mc.player.getPosX();
        int Y = (int)mc.player.getPosY();
        int Z = (int)mc.player.getPosZ();
        Object[] var10001 = new Object[]{Math.hypot(mc.player.getPosX() - mc.player.prevPosX, mc.player.getPosZ() - mc.player.prevPosZ) * 20.0};
        String text = "Speed: " + String.format("%.2f", var10001);
        float textWidth = small.getWidth(text) + 8.5F;
        Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        small.drawString(stack, text, (double)(x + 4.5F), (double)y + 6.3, (new Color(255, 255, 255, 255)).getRGB());
        this.BPS.setWidth(textWidth);
        this.BPS.setHeight(height);
    }

    public void Coords(MatrixStack stack) {
        float x = this.Coords.getX();
        float y = this.Coords.getY();
        float height = 15.0F;
        StyledFont small = Fonts.msSemiBold[14];
        int X = (int)mc.player.getPosX();
        int Y = (int)mc.player.getPosY();
        int Z = (int)mc.player.getPosZ();
        String text = "Coords: x: " + X + ", y: " + Y + ", z: " + Z;
        float textWidth = small.getWidth(text) + 8.5F;
        Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        small.drawString(stack, text, (double)(x + 4.5F), (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());
        this.Coords.setWidth(textWidth);
        this.Coords.setHeight(height);
    }

    public void WT(MatrixStack stack) {
        float x = this.WT.getX();
        float y = this.WT.getY();
        float height = 17.0F;
        StyledFont small1 = Fonts.msSemiBold[14];
        StyledFont small = Fonts.msSemiBold[15];
        String playerName = mc.player.getName().getString();

        float offsetX = 1.0F;
        float offsetY = 1.5F;
        float fpsOffsetX = 50.0F;
        float fpsOffsetY = 1.5F;

        Minecraft var10000 = mc;
        String FPS = Minecraft.debugFPS + " FPS";
        String text = "Catlavan";
        float textWidth = small1.getWidth(text) + 13.0F;
        Render2D.drawRoundedRect(x + offsetX, y + offsetY, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        float var100000 = x + fpsOffsetX;
        Minecraft var10003 = mc;
        int var12 = Minecraft.debugFPS;
        Render2D.drawRoundedRect(var100000, y + fpsOffsetY, small1.getWidth("  " + var12 + "fps") + 14.0F, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());

        small.drawString(stack, "Catlavan", (double)(x + offsetX + 5.0F), (double)(y + offsetY + 7.0F), (new Color(255, 255, 255, 255)).getRGB());

        Minecraft var10002 = mc;
        small.drawString(stack, "  " + Minecraft.debugFPS + "fps" + TextFormatting.GRAY, (double)(x + fpsOffsetX + 4.0F), (double)(y + fpsOffsetY + 7.0F), (new Color(255, 255, 255, 255)).getRGB());

        this.WT.setWidth(textWidth);
        this.WT.setHeight(height);
    }




    public void TargetHUD(MatrixStack stack) {
        float x = this.TargetHUD.getX();
        float y = this.TargetHUD.getY();
        float width = 91.0F;
        float height = 34.0F;
        float widthFace = 34.0F;
        this.target = this.getTarget(this.target);
        this.targetHudAnimation.setDuration(280);
        this.scale = this.targetHudAnimation.getOutput();
        if (this.scale == 0.0) {
            this.target = null;
        }

        if (this.target != null) {
            GlStateManager.pushMatrix();
            AnimationMath.sizeAnimation((double)(x + width / 2.0F), (double)(y + 15.0F), this.scale);
            Render2D.drawRoundedRect(x + 3.0F, y, width, height, 2.0F, (new Color(4, 4, 4, 215)).getRGB());
            if (this.target instanceof PlayerEntity) {
                Render2D.drawFace(x + 6.5F, y + 4.0F, 8.0F, 8.0F, 8.0F, 8.0F, 27.0F, 26.0F, 64.0F, 64.0F, (AbstractClientPlayerEntity)this.target);
            }

            int count = 0;

            for(int i = 0; i < mc.player.inventory.getSizeInventory(); ++i) {
                ItemStack s = mc.player.inventory.getStackInSlot(i);
                if (s.getItem() == Items.TOTEM_OF_UNDYING) {
                    ++count;
                }
            }

            float xHP = x + widthFace + 3.8F;
            float yHP = y + 21.5F;
            float widthHP = 52.0F;
            this.health = AnimationMath.fast(this.health, this.target.getHealth() / this.target.getMaxHealth(), 6.0F);
            this.health = MathHelper.clamp(this.health, 0.0F, 1.0F);
            this.absorpation = AnimationMath.fast(this.absorpation, this.target.getAbsorptionAmount() / this.target.getMaxHealth(), 6.0F);
            this.absorpation = MathHelper.clamp(this.absorpation, 0.0F, 1.0F);
            int green_color;
            int blackgreen_color;
            if (this.target.getHealth() > 5.0F) {
                if (this.target.getHealth() > 12.0F) {
                    green_color = (new Color(85, 201, 21, 255)).getRGB();
                    blackgreen_color = (new Color(44, 141, 24, 255)).getRGB();
                    Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
                } else {
                    green_color = (new Color(255, 101, 5, 255)).getRGB();
                    blackgreen_color = (new Color(150, 87, 21, 255)).getRGB();
                    Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
                }
            } else {
                green_color = (new Color(238, 35, 35, 255)).getRGB();
                blackgreen_color = (new Color(185, 22, 22, 255)).getRGB();
                Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
            }

            Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.absorpation, 5.6F, 1.0F, (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB());
            String targetName = this.target.getName().getString();
            StyledFont small = Fonts.gilroyBold[13];
            SmartScissor.push();
            SmartScissor.setFromComponentCoordinates((double)x, (double)y, (double)(width - 6.0F), (double)height);
            small.drawString(stack, targetName, (double)xHP, (double)(yHP - 14.3F), (new Color(255, 255, 255, 255)).getRGB());
            SmartScissor.unset();
            SmartScissor.pop();
            String HP = String.valueOf(this.target.getHealth() + this.target.getAbsorptionAmount());
            String StringHP = HP.substring(0, Math.min(HP.length(), 4));
            if (this.target.getHealth() + this.target.getAbsorptionAmount() < 10.0F) {
                StringHP = HP.substring(0, Math.min(HP.length(), 3));
            }

            StyledFont small1 = Fonts.gilroyBold[11];
            small1.drawString(stack, "HP: " + StringHP, (double)xHP, (double)(yHP - 5.7F), (new Color(255, 255, 255, 255)).getRGB());
            this.drawItemStack(x, y - 12.0F, 10.5F, 0.7F);
            GlStateManager.popMatrix();
            this.TargetHUD.setWidth(width);
            this.TargetHUD.setHeight(height);
        }

    }

    private void drawItemStack(float x, float y, float offset, float scaleValue) {
        ArrayList<ItemStack> stackList = new ArrayList(Arrays.asList(this.target.getHeldItemMainhand(), this.target.getHeldItemOffhand()));
        stackList.addAll((Collection)this.target.getArmorInventoryList());
        AtomicReference<Float> posX = new AtomicReference(x);
        stackList.stream().filter((stack) -> {
            return !stack.isEmpty();
        }).forEach((stack) -> {
            HudUtil.drawItemStack(stack, (Float)posX.getAndAccumulate(offset, Float::sum), y, true, true, scaleValue);
        });
    }

    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity target = nullTarget;
        AttackAura var10000 = Managment.FUNCTION_MANAGER.attackAura;
        if (AttackAura.getTarget() instanceof LivingEntity) {
            var10000 = Managment.FUNCTION_MANAGER.attackAura;
            target = AttackAura.getTarget();
            this.targetHudAnimation.setDirection(Direction.FORWARDS);
        } else if (IMinecraft.mc.currentScreen instanceof ChatScreen) {
            target = IMinecraft.mc.player;
            this.targetHudAnimation.setDirection(Direction.FORWARDS);
        } else {
            this.targetHudAnimation.setDirection(Direction.BACKWARDS);
        }

        return (LivingEntity)target;
    }
}
похоже, +rep
 
Начинающий
Статус
Оффлайн
Регистрация
26 Окт 2024
Сообщения
93
Реакции[?]
0
Поинты[?]
0
Короче вот
Пожалуйста, авторизуйтесь для просмотра ссылки.

ДА ПОНИМАЮ ГОВНО КРИВО И Т.Д Я НАПИСАЛ НА СКОРУЮ РУКУ! ПОТОМУ ЧТО СКУЧНО
Вот сам код
САМ КОД:
package intensity.cc.modules.impl.render;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.DisplayEffectsScreen;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.network.play.NetworkPlayerInfo;
import net.minecraft.client.renderer.texture.PotionSpriteUploader;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Team;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.TextFormatting;
import intensity.cc.Initilization;
import intensity.cc.events.Event;
import intensity.cc.events.impl.render.EventRender;
import intensity.cc.managment.Managment;
import intensity.cc.modules.Function;
import intensity.cc.modules.FunctionAnnotation;
import intensity.cc.modules.Type;
import intensity.cc.modules.impl.combat.AttackAura;
import intensity.cc.modules.settings.Setting;
import intensity.cc.modules.settings.imp.BooleanOption;
import intensity.cc.modules.settings.imp.MultiBoxSetting;
import intensity.cc.modules.settings.imp.SliderSetting;
import intensity.cc.managment.StyleManager;
import intensity.cc.util.ClientUtil;
import intensity.cc.util.IMinecraft;
import intensity.cc.util.animations.Animation;
import intensity.cc.util.animations.Direction;
import intensity.cc.util.animations.impl.EaseBackIn;
import intensity.cc.util.drag.Dragging;
import intensity.cc.util.font.Fonts;
import intensity.cc.util.font.styled.StyledFont;
import intensity.cc.util.misc.HudUtil;
import intensity.cc.util.misc.TimerUtil;
import intensity.cc.util.render.ColorUtil;
import intensity.cc.util.render.RenderUtil.Render2D;
import intensity.cc.util.render.RenderUtil.SmartScissor;
import intensity.cc.util.render.animation.AnimationMath;

@FunctionAnnotation(
        name = "CatlavanHUD",
        type = Type.Render
)
public class HUD extends Function {
    public static MultiBoxSetting elements = new MultiBoxSetting("Элементы", new BooleanOption[]{new BooleanOption("ТХШКА", true), new BooleanOption("ВТШКА", true), new BooleanOption("Корды", true), new BooleanOption("БПС", true), new BooleanOption("Потионс", true), new BooleanOption("Хоткеи", true), new BooleanOption("Стафф", true), new BooleanOption("Бронь", true)});
    private final SliderSetting offsetEffects = (new SliderSetting("Расстояние эффектов", 24.0F, 23.0F, 26.0F, 0.1F)).setVisible(() -> {
        return elements.get(5);
    });

    final Dragging TargetHUD;
    final Dragging TimerHUD;
    final Dragging WT;
    final Dragging Coords;
    final Dragging BPS;
    final Dragging Effects;
    final Dragging KeyBinds;
    final Dragging StaffActive;
    int activeStaff;
    private final Pattern namePattern;
    int activeBind;
    float heightAnimation;
    private float perc;
    private final Animation targetHudAnimation;
    private double scale;
    private LivingEntity target;
    float health;
    float absorpation;

    public HUD() {
        this.TargetHUD = Initilization.createDrag(this, "TargetHUD", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.TimerHUD = Initilization.createDrag(this, "TimerHUD", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.WT = Initilization.createDrag(this, "WT", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.Coords = Initilization.createDrag(this, "Coords", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.BPS = Initilization.createDrag(this, "BPS", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.Effects = Initilization.createDrag(this, "Effects", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.KeyBinds = Initilization.createDrag(this, "KeyBinds", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.StaffActive = Initilization.createDrag(this, "StaffActive", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.activeStaff = 0;
        this.namePattern = Pattern.compile("^\\w{3,16}$");
        this.activeBind = 0;
        this.heightAnimation = 0.0F;
        this.targetHudAnimation = new EaseBackIn(270, 1.0, 1.5F);
        this.scale = 0.0;
        this.target = null;
        this.health = 0.0F;
        this.absorpation = 0.0F;
        this.addSettings(new Setting[]{elements, this.offsetEffects});
    }

    public void onEvent(Event event) {
        if (event instanceof EventRender eventRender) {
            MatrixStack stack = eventRender.matrixStack;
            if (elements.get(0)) {
                this.TargetHUD(stack);
            }

            if (elements.get(1)) {
                this.WT(stack);
            }

            if (elements.get(2)) {
                this.Coords(stack);
            }

            if (elements.get(3)) {
                this.BPS(stack);
            }

            if (elements.get(4)) {
                this.Effects(stack);
            }

            if (elements.get(5)) {
                this.KeyBinds(stack);
            }

            if (elements.get(6)) {
                this.StaffActive(stack);
            }

            if (elements.get(7)) {
                this.ArmorHUD(stack, eventRender);
            }
        }

    }

    public void ArmorHUD(MatrixStack stack, EventRender eventRender) {
        int count = 0;

        for(int i = 0; i < mc.player.inventory.getSizeInventory(); ++i) {
            ItemStack s = mc.player.inventory.getStackInSlot(i);
            if (s.getItem() == Items.TOTEM_OF_UNDYING) {
                ++count;
            }
        }

        float xPos = (float)eventRender.scaledResolution.scaledWidth() / 2.0F;
        float yPos = (float)eventRender.scaledResolution.scaledHeight();
        boolean totemInInv = mc.player.inventory.mainInventory.stream().map(ItemStack::getItem).toList().contains(Items.TOTEM_OF_UNDYING);
        int off = totemInInv ? 5 : 0;
        if (mc.player.isCreative()) {
            yPos += 17.0F;
        }

        for(Iterator var8 = mc.player.inventory.armorInventory.iterator(); var8.hasNext(); off += 15) {
            ItemStack s = (ItemStack)var8.next();
            ESP.drawItemStack(s, (double)(xPos - (float)off + 74.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (double)(yPos - 56.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (String)null, false);
        }

        if (totemInInv) {
            ESP.drawItemStack(new ItemStack(Items.TOTEM_OF_UNDYING), (double)(xPos - (float)off + 73.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (double)(yPos - 56.0F * ((float)mc.gameSettings.guiScale / 2.0F)), String.valueOf(count), false);
        }

    }

    public void StaffActive(MatrixStack stack) {
        float x = this.StaffActive.getX();
        float y = this.StaffActive.getY();
        float offset = 9.0F;
        float height = 20.5F;
        float width = 106.0F;
        height += offset * (float)this.activeStaff - 4.0F;
        float xStaff = x + 26.0F;
        if (this.activeStaff == 0) {
            --height;
            width -= 25.0F;
            xStaff -= 12.5F;
        }

        Render2D.drawRoundedRect(x, y, width, height, 2.5F, (new Color(4, 4, 4, 215)).getRGB());
        StyledFont small1 = Fonts.msSemiBold[14];
        small1.drawString(stack, "   Staff Active", (double)xStaff, (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());
        int i = 0;
        Iterator var10 = mc.world.getScoreboard().getTeams().stream().sorted(Comparator.comparing(Team::getName)).toList().iterator();

        while(true) {
            String name;
            boolean vanish;
            boolean near;
            boolean active;
            do {
                do {
                    if (!var10.hasNext()) {
                        this.activeStaff = i;
                        this.StaffActive.setWidth(width);
                        this.StaffActive.setHeight(height);
                        return;
                    }

                    ScorePlayerTeam team = (ScorePlayerTeam)var10.next();
                    name = team.getMembershipCollection().toString();
                    name = name.substring(1, name.length() - 1);
                } while(!this.namePattern.matcher(name).matches());

                vanish = true;
                near = false;
                active = false;
                Iterator var16 = mc.world.getPlayers().iterator();

                while(var16.hasNext()) {
                    AbstractClientPlayerEntity player = (AbstractClientPlayerEntity)var16.next();
                    if (player.getNameClear().equals(name)) {
                        near = true;
                    }
                }

                var16 = mc.getConnection().getPlayerInfoMap().iterator();

                while(var16.hasNext()) {
                    NetworkPlayerInfo info = (NetworkPlayerInfo)var16.next();
                    if (info.getGameProfile().getName().equals(name)) {
                        vanish = false;
                        if (!near) {
                            active = true;
                        }
                    }
                }
            } while(!vanish && !Managment.STAFF_MANAGER.isStaff(name));

            String Name = name.substring(0, Math.min(name.length(), 13));
            StyledFont small = Fonts.msSemiBold[13];
            StyledFont small2 = Fonts.msMedium[13];
            float yText = y + 17.0F;
            small2.drawString(stack, Name, (double)(x + 4.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
            if (vanish) {
                small.drawString(stack, "Spectator", (double)(x + 68.5F), (double)yText, (new Color(231, 52, 52, 255)).getRGB());
            } else if (active) {
                small.drawString(stack, "Active", (double)(x + 63.5F), (double)yText, (new Color(21, 238, 15, 255)).getRGB());
            } else if (near) {
                small.drawString(stack, "Near", (double)(x + 68.8F), (double)yText, (new Color(229, 188, 23, 255)).getRGB());
            }

            y += offset;
            ++i;
        }
    }

    public void KeyBinds(MatrixStack stack) {
        float x = this.KeyBinds.getX();
        float y = this.KeyBinds.getY();
        float offset = 9.5F;
        float height = 21.0F;
        float width = 75.0F;
        int activeKeyBinds = 0;

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

        height += offset * activeKeyBinds - 5.0F;

        Render2D.drawRoundedRect(x, y, width, height, 2.5F, (new Color(4, 4, 4, 215)).getRGB());
        StyledFont small1 = Fonts.msSemiBold[14];
        small1.drawString(stack, "KeyBinds", (double)(x + 20.0F), (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());

        int index = 0;
        SmartScissor.push();
        SmartScissor.setFromComponentCoordinates((double)x, (double)y, (double)width, (double)height);
        for (Function f : Managment.FUNCTION_MANAGER.getFunctions()) {
            if (f.bind != 0 && f.state) {
                String bindText = "[" + ClientUtil.getKey(f.bind).toUpperCase() + "]";
                float yText = y + 17.0F + index * offset;
                StyledFont small = Fonts.msMedium[13];
                small.drawString(stack, f.name, (double)(x + 4.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
                small.drawString(stack, bindText, (double)(x + 57.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
                index++;
            }
        }
        SmartScissor.unset();
        SmartScissor.pop();

        this.KeyBinds.setWidth(width);
        this.KeyBinds.setHeight(height);
    }


    public void Effects(MatrixStack stack) {
        float x = this.Effects.getX();
        float y = this.Effects.getY();
        float offset = this.offsetEffects.getValue().floatValue();
        float height = 21.3F;
        StyledFont small = Fonts.msSemiBold[13];
        int counterEffect = 0;
        Iterator var8 = mc.player.getActivePotionEffects().iterator();

        while(var8.hasNext()) {
            EffectInstance effectInstance = (EffectInstance)var8.next();
            String levelpotion = String.valueOf(effectInstance.getAmplifier() + 1);
            float textWidthBonus = 27.3F;
            if (levelpotion.contains("1")) {
                levelpotion = "";
                textWidthBonus -= 5.0F;
            }

            String durationText = EffectUtils.getPotionDurationString(effectInstance, 1.0F);
            String text = I18n.format(effectInstance.getEffectName(), new Object[0]);
            float textWidth = small.getWidth(text + effectInstance.getAmplifier() + levelpotion) + textWidthBonus - 0.6F;
            Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
            small.drawString(stack, text + " " + levelpotion, (double)(x + 22.3F), (double)(y + 5.5F), (new Color(255, 255, 255, 255)).getRGB());
            small.drawString(stack, durationText, (double)(x + 22.3F), (double)(y + 13.5F), (new Color(255, 255, 255, 255)).getRGB());
            PotionSpriteUploader potionspriteuploader = mc.getPotionSpriteUploader();
            Effect effect = effectInstance.getPotion();
            TextureAtlasSprite textureatlassprite = potionspriteuploader.getSprite(effect);
            mc.getTextureManager().bindTexture(textureatlassprite.getAtlasTexture().getTextureLocation());
            DisplayEffectsScreen.blit(stack, (int)(x + 2.0F), (int)y + 2, 0, 18, 18, textureatlassprite);
            y += offset;
            ++counterEffect;
            this.Effects.setWidth(textWidth);
        }

        float setHeight = offset / 8.0F * (float)counterEffect;
        this.Effects.setHeight(height * (float)counterEffect + setHeight);
    }

    public void BPS(MatrixStack stack) {
        float x = this.BPS.getX();
        float y = this.BPS.getY();
        float height = 15.0F;
        StyledFont small = Fonts.msSemiBold[14];
        int X = (int)mc.player.getPosX();
        int Y = (int)mc.player.getPosY();
        int Z = (int)mc.player.getPosZ();
        Object[] var10001 = new Object[]{Math.hypot(mc.player.getPosX() - mc.player.prevPosX, mc.player.getPosZ() - mc.player.prevPosZ) * 20.0};
        String text = "Speed: " + String.format("%.2f", var10001);
        float textWidth = small.getWidth(text) + 8.5F;
        Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        small.drawString(stack, text, (double)(x + 4.5F), (double)y + 6.3, (new Color(255, 255, 255, 255)).getRGB());
        this.BPS.setWidth(textWidth);
        this.BPS.setHeight(height);
    }

    public void Coords(MatrixStack stack) {
        float x = this.Coords.getX();
        float y = this.Coords.getY();
        float height = 15.0F;
        StyledFont small = Fonts.msSemiBold[14];
        int X = (int)mc.player.getPosX();
        int Y = (int)mc.player.getPosY();
        int Z = (int)mc.player.getPosZ();
        String text = "Coords: x: " + X + ", y: " + Y + ", z: " + Z;
        float textWidth = small.getWidth(text) + 8.5F;
        Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        small.drawString(stack, text, (double)(x + 4.5F), (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());
        this.Coords.setWidth(textWidth);
        this.Coords.setHeight(height);
    }

    public void WT(MatrixStack stack) {
        float x = this.WT.getX();
        float y = this.WT.getY();
        float height = 17.0F;
        StyledFont small1 = Fonts.msSemiBold[14];
        StyledFont small = Fonts.msSemiBold[15];
        String playerName = mc.player.getName().getString();

        float offsetX = 1.0F;
        float offsetY = 1.5F;
        float fpsOffsetX = 50.0F;
        float fpsOffsetY = 1.5F;

        Minecraft var10000 = mc;
        String FPS = Minecraft.debugFPS + " FPS";
        String text = "Catlavan";
        float textWidth = small1.getWidth(text) + 13.0F;
        Render2D.drawRoundedRect(x + offsetX, y + offsetY, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        float var100000 = x + fpsOffsetX;
        Minecraft var10003 = mc;
        int var12 = Minecraft.debugFPS;
        Render2D.drawRoundedRect(var100000, y + fpsOffsetY, small1.getWidth("  " + var12 + "fps") + 14.0F, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());

        small.drawString(stack, "Catlavan", (double)(x + offsetX + 5.0F), (double)(y + offsetY + 7.0F), (new Color(255, 255, 255, 255)).getRGB());

        Minecraft var10002 = mc;
        small.drawString(stack, "  " + Minecraft.debugFPS + "fps" + TextFormatting.GRAY, (double)(x + fpsOffsetX + 4.0F), (double)(y + fpsOffsetY + 7.0F), (new Color(255, 255, 255, 255)).getRGB());

        this.WT.setWidth(textWidth);
        this.WT.setHeight(height);
    }




    public void TargetHUD(MatrixStack stack) {
        float x = this.TargetHUD.getX();
        float y = this.TargetHUD.getY();
        float width = 91.0F;
        float height = 34.0F;
        float widthFace = 34.0F;
        this.target = this.getTarget(this.target);
        this.targetHudAnimation.setDuration(280);
        this.scale = this.targetHudAnimation.getOutput();
        if (this.scale == 0.0) {
            this.target = null;
        }

        if (this.target != null) {
            GlStateManager.pushMatrix();
            AnimationMath.sizeAnimation((double)(x + width / 2.0F), (double)(y + 15.0F), this.scale);
            Render2D.drawRoundedRect(x + 3.0F, y, width, height, 2.0F, (new Color(4, 4, 4, 215)).getRGB());
            if (this.target instanceof PlayerEntity) {
                Render2D.drawFace(x + 6.5F, y + 4.0F, 8.0F, 8.0F, 8.0F, 8.0F, 27.0F, 26.0F, 64.0F, 64.0F, (AbstractClientPlayerEntity)this.target);
            }

            int count = 0;

            for(int i = 0; i < mc.player.inventory.getSizeInventory(); ++i) {
                ItemStack s = mc.player.inventory.getStackInSlot(i);
                if (s.getItem() == Items.TOTEM_OF_UNDYING) {
                    ++count;
                }
            }

            float xHP = x + widthFace + 3.8F;
            float yHP = y + 21.5F;
            float widthHP = 52.0F;
            this.health = AnimationMath.fast(this.health, this.target.getHealth() / this.target.getMaxHealth(), 6.0F);
            this.health = MathHelper.clamp(this.health, 0.0F, 1.0F);
            this.absorpation = AnimationMath.fast(this.absorpation, this.target.getAbsorptionAmount() / this.target.getMaxHealth(), 6.0F);
            this.absorpation = MathHelper.clamp(this.absorpation, 0.0F, 1.0F);
            int green_color;
            int blackgreen_color;
            if (this.target.getHealth() > 5.0F) {
                if (this.target.getHealth() > 12.0F) {
                    green_color = (new Color(85, 201, 21, 255)).getRGB();
                    blackgreen_color = (new Color(44, 141, 24, 255)).getRGB();
                    Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
                } else {
                    green_color = (new Color(255, 101, 5, 255)).getRGB();
                    blackgreen_color = (new Color(150, 87, 21, 255)).getRGB();
                    Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
                }
            } else {
                green_color = (new Color(238, 35, 35, 255)).getRGB();
                blackgreen_color = (new Color(185, 22, 22, 255)).getRGB();
                Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
            }

            Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.absorpation, 5.6F, 1.0F, (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB());
            String targetName = this.target.getName().getString();
            StyledFont small = Fonts.gilroyBold[13];
            SmartScissor.push();
            SmartScissor.setFromComponentCoordinates((double)x, (double)y, (double)(width - 6.0F), (double)height);
            small.drawString(stack, targetName, (double)xHP, (double)(yHP - 14.3F), (new Color(255, 255, 255, 255)).getRGB());
            SmartScissor.unset();
            SmartScissor.pop();
            String HP = String.valueOf(this.target.getHealth() + this.target.getAbsorptionAmount());
            String StringHP = HP.substring(0, Math.min(HP.length(), 4));
            if (this.target.getHealth() + this.target.getAbsorptionAmount() < 10.0F) {
                StringHP = HP.substring(0, Math.min(HP.length(), 3));
            }

            StyledFont small1 = Fonts.gilroyBold[11];
            small1.drawString(stack, "HP: " + StringHP, (double)xHP, (double)(yHP - 5.7F), (new Color(255, 255, 255, 255)).getRGB());
            this.drawItemStack(x, y - 12.0F, 10.5F, 0.7F);
            GlStateManager.popMatrix();
            this.TargetHUD.setWidth(width);
            this.TargetHUD.setHeight(height);
        }

    }

    private void drawItemStack(float x, float y, float offset, float scaleValue) {
        ArrayList<ItemStack> stackList = new ArrayList(Arrays.asList(this.target.getHeldItemMainhand(), this.target.getHeldItemOffhand()));
        stackList.addAll((Collection)this.target.getArmorInventoryList());
        AtomicReference<Float> posX = new AtomicReference(x);
        stackList.stream().filter((stack) -> {
            return !stack.isEmpty();
        }).forEach((stack) -> {
            HudUtil.drawItemStack(stack, (Float)posX.getAndAccumulate(offset, Float::sum), y, true, true, scaleValue);
        });
    }

    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity target = nullTarget;
        AttackAura var10000 = Managment.FUNCTION_MANAGER.attackAura;
        if (AttackAura.getTarget() instanceof LivingEntity) {
            var10000 = Managment.FUNCTION_MANAGER.attackAura;
            target = AttackAura.getTarget();
            this.targetHudAnimation.setDirection(Direction.FORWARDS);
        } else if (IMinecraft.mc.currentScreen instanceof ChatScreen) {
            target = IMinecraft.mc.player;
            this.targetHudAnimation.setDirection(Direction.FORWARDS);
        } else {
            this.targetHudAnimation.setDirection(Direction.BACKWARDS);
        }

        return (LivingEntity)target;
    }
}
пойдет вы гусек
 
Начинающий
Статус
Оффлайн
Регистрация
19 Июл 2023
Сообщения
27
Реакции[?]
0
Поинты[?]
0
че его так все скидят мб там чето очень сложное по типу скругленного ректа и прозрачность :roflanEbalo:
Хз всё легко если дашь фонт я тх чутка переделаю и фонты и будет точь в точь
че его так все скидят мб там чето очень сложное по типу скругленного ректа и прозрачность :roflanEbalo:
дохуя ебланов пытаются скидить точь в точь но блять они даже не могут где блять включена выключена функция поставить геткей
 
Последнее редактирование:
Начинающий
Статус
Оффлайн
Регистрация
14 Окт 2024
Сообщения
18
Реакции[?]
0
Поинты[?]
0
Короче вот
Пожалуйста, авторизуйтесь для просмотра ссылки.

ДА ПОНИМАЮ ГОВНО КРИВО И Т.Д Я НАПИСАЛ НА СКОРУЮ РУКУ! ПОТОМУ ЧТО СКУЧНО
Вот сам код
САМ КОД:
package intensity.cc.modules.impl.render;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.DisplayEffectsScreen;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.network.play.NetworkPlayerInfo;
import net.minecraft.client.renderer.texture.PotionSpriteUploader;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Team;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.TextFormatting;
import intensity.cc.Initilization;
import intensity.cc.events.Event;
import intensity.cc.events.impl.render.EventRender;
import intensity.cc.managment.Managment;
import intensity.cc.modules.Function;
import intensity.cc.modules.FunctionAnnotation;
import intensity.cc.modules.Type;
import intensity.cc.modules.impl.combat.AttackAura;
import intensity.cc.modules.settings.Setting;
import intensity.cc.modules.settings.imp.BooleanOption;
import intensity.cc.modules.settings.imp.MultiBoxSetting;
import intensity.cc.modules.settings.imp.SliderSetting;
import intensity.cc.managment.StyleManager;
import intensity.cc.util.ClientUtil;
import intensity.cc.util.IMinecraft;
import intensity.cc.util.animations.Animation;
import intensity.cc.util.animations.Direction;
import intensity.cc.util.animations.impl.EaseBackIn;
import intensity.cc.util.drag.Dragging;
import intensity.cc.util.font.Fonts;
import intensity.cc.util.font.styled.StyledFont;
import intensity.cc.util.misc.HudUtil;
import intensity.cc.util.misc.TimerUtil;
import intensity.cc.util.render.ColorUtil;
import intensity.cc.util.render.RenderUtil.Render2D;
import intensity.cc.util.render.RenderUtil.SmartScissor;
import intensity.cc.util.render.animation.AnimationMath;

@FunctionAnnotation(
        name = "CatlavanHUD",
        type = Type.Render
)
public class HUD extends Function {
    public static MultiBoxSetting elements = new MultiBoxSetting("Элементы", new BooleanOption[]{new BooleanOption("ТХШКА", true), new BooleanOption("ВТШКА", true), new BooleanOption("Корды", true), new BooleanOption("БПС", true), new BooleanOption("Потионс", true), new BooleanOption("Хоткеи", true), new BooleanOption("Стафф", true), new BooleanOption("Бронь", true)});
    private final SliderSetting offsetEffects = (new SliderSetting("Расстояние эффектов", 24.0F, 23.0F, 26.0F, 0.1F)).setVisible(() -> {
        return elements.get(5);
    });

    final Dragging TargetHUD;
    final Dragging TimerHUD;
    final Dragging WT;
    final Dragging Coords;
    final Dragging BPS;
    final Dragging Effects;
    final Dragging KeyBinds;
    final Dragging StaffActive;
    int activeStaff;
    private final Pattern namePattern;
    int activeBind;
    float heightAnimation;
    private float perc;
    private final Animation targetHudAnimation;
    private double scale;
    private LivingEntity target;
    float health;
    float absorpation;

    public HUD() {
        this.TargetHUD = Initilization.createDrag(this, "TargetHUD", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.TimerHUD = Initilization.createDrag(this, "TimerHUD", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.WT = Initilization.createDrag(this, "WT", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.Coords = Initilization.createDrag(this, "Coords", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.BPS = Initilization.createDrag(this, "BPS", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.Effects = Initilization.createDrag(this, "Effects", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.KeyBinds = Initilization.createDrag(this, "KeyBinds", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.StaffActive = Initilization.createDrag(this, "StaffActive", (float)(mc.getMainWindow().scaledWidth() / 2), (float)mc.getMainWindow().scaledHeight() / 2.0F);
        this.activeStaff = 0;
        this.namePattern = Pattern.compile("^\\w{3,16}$");
        this.activeBind = 0;
        this.heightAnimation = 0.0F;
        this.targetHudAnimation = new EaseBackIn(270, 1.0, 1.5F);
        this.scale = 0.0;
        this.target = null;
        this.health = 0.0F;
        this.absorpation = 0.0F;
        this.addSettings(new Setting[]{elements, this.offsetEffects});
    }

    public void onEvent(Event event) {
        if (event instanceof EventRender eventRender) {
            MatrixStack stack = eventRender.matrixStack;
            if (elements.get(0)) {
                this.TargetHUD(stack);
            }

            if (elements.get(1)) {
                this.WT(stack);
            }

            if (elements.get(2)) {
                this.Coords(stack);
            }

            if (elements.get(3)) {
                this.BPS(stack);
            }

            if (elements.get(4)) {
                this.Effects(stack);
            }

            if (elements.get(5)) {
                this.KeyBinds(stack);
            }

            if (elements.get(6)) {
                this.StaffActive(stack);
            }

            if (elements.get(7)) {
                this.ArmorHUD(stack, eventRender);
            }
        }

    }

    public void ArmorHUD(MatrixStack stack, EventRender eventRender) {
        int count = 0;

        for(int i = 0; i < mc.player.inventory.getSizeInventory(); ++i) {
            ItemStack s = mc.player.inventory.getStackInSlot(i);
            if (s.getItem() == Items.TOTEM_OF_UNDYING) {
                ++count;
            }
        }

        float xPos = (float)eventRender.scaledResolution.scaledWidth() / 2.0F;
        float yPos = (float)eventRender.scaledResolution.scaledHeight();
        boolean totemInInv = mc.player.inventory.mainInventory.stream().map(ItemStack::getItem).toList().contains(Items.TOTEM_OF_UNDYING);
        int off = totemInInv ? 5 : 0;
        if (mc.player.isCreative()) {
            yPos += 17.0F;
        }

        for(Iterator var8 = mc.player.inventory.armorInventory.iterator(); var8.hasNext(); off += 15) {
            ItemStack s = (ItemStack)var8.next();
            ESP.drawItemStack(s, (double)(xPos - (float)off + 74.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (double)(yPos - 56.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (String)null, false);
        }

        if (totemInInv) {
            ESP.drawItemStack(new ItemStack(Items.TOTEM_OF_UNDYING), (double)(xPos - (float)off + 73.0F * ((float)mc.gameSettings.guiScale / 2.0F)), (double)(yPos - 56.0F * ((float)mc.gameSettings.guiScale / 2.0F)), String.valueOf(count), false);
        }

    }

    public void StaffActive(MatrixStack stack) {
        float x = this.StaffActive.getX();
        float y = this.StaffActive.getY();
        float offset = 9.0F;
        float height = 20.5F;
        float width = 106.0F;
        height += offset * (float)this.activeStaff - 4.0F;
        float xStaff = x + 26.0F;
        if (this.activeStaff == 0) {
            --height;
            width -= 25.0F;
            xStaff -= 12.5F;
        }

        Render2D.drawRoundedRect(x, y, width, height, 2.5F, (new Color(4, 4, 4, 215)).getRGB());
        StyledFont small1 = Fonts.msSemiBold[14];
        small1.drawString(stack, "   Staff Active", (double)xStaff, (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());
        int i = 0;
        Iterator var10 = mc.world.getScoreboard().getTeams().stream().sorted(Comparator.comparing(Team::getName)).toList().iterator();

        while(true) {
            String name;
            boolean vanish;
            boolean near;
            boolean active;
            do {
                do {
                    if (!var10.hasNext()) {
                        this.activeStaff = i;
                        this.StaffActive.setWidth(width);
                        this.StaffActive.setHeight(height);
                        return;
                    }

                    ScorePlayerTeam team = (ScorePlayerTeam)var10.next();
                    name = team.getMembershipCollection().toString();
                    name = name.substring(1, name.length() - 1);
                } while(!this.namePattern.matcher(name).matches());

                vanish = true;
                near = false;
                active = false;
                Iterator var16 = mc.world.getPlayers().iterator();

                while(var16.hasNext()) {
                    AbstractClientPlayerEntity player = (AbstractClientPlayerEntity)var16.next();
                    if (player.getNameClear().equals(name)) {
                        near = true;
                    }
                }

                var16 = mc.getConnection().getPlayerInfoMap().iterator();

                while(var16.hasNext()) {
                    NetworkPlayerInfo info = (NetworkPlayerInfo)var16.next();
                    if (info.getGameProfile().getName().equals(name)) {
                        vanish = false;
                        if (!near) {
                            active = true;
                        }
                    }
                }
            } while(!vanish && !Managment.STAFF_MANAGER.isStaff(name));

            String Name = name.substring(0, Math.min(name.length(), 13));
            StyledFont small = Fonts.msSemiBold[13];
            StyledFont small2 = Fonts.msMedium[13];
            float yText = y + 17.0F;
            small2.drawString(stack, Name, (double)(x + 4.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
            if (vanish) {
                small.drawString(stack, "Spectator", (double)(x + 68.5F), (double)yText, (new Color(231, 52, 52, 255)).getRGB());
            } else if (active) {
                small.drawString(stack, "Active", (double)(x + 63.5F), (double)yText, (new Color(21, 238, 15, 255)).getRGB());
            } else if (near) {
                small.drawString(stack, "Near", (double)(x + 68.8F), (double)yText, (new Color(229, 188, 23, 255)).getRGB());
            }

            y += offset;
            ++i;
        }
    }

    public void KeyBinds(MatrixStack stack) {
        float x = this.KeyBinds.getX();
        float y = this.KeyBinds.getY();
        float offset = 9.5F;
        float height = 21.0F;
        float width = 75.0F;
        int activeKeyBinds = 0;

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

        height += offset * activeKeyBinds - 5.0F;

        Render2D.drawRoundedRect(x, y, width, height, 2.5F, (new Color(4, 4, 4, 215)).getRGB());
        StyledFont small1 = Fonts.msSemiBold[14];
        small1.drawString(stack, "KeyBinds", (double)(x + 20.0F), (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());

        int index = 0;
        SmartScissor.push();
        SmartScissor.setFromComponentCoordinates((double)x, (double)y, (double)width, (double)height);
        for (Function f : Managment.FUNCTION_MANAGER.getFunctions()) {
            if (f.bind != 0 && f.state) {
                String bindText = "[" + ClientUtil.getKey(f.bind).toUpperCase() + "]";
                float yText = y + 17.0F + index * offset;
                StyledFont small = Fonts.msMedium[13];
                small.drawString(stack, f.name, (double)(x + 4.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
                small.drawString(stack, bindText, (double)(x + 57.0F), (double)yText, (new Color(255, 255, 255, 255)).getRGB());
                index++;
            }
        }
        SmartScissor.unset();
        SmartScissor.pop();

        this.KeyBinds.setWidth(width);
        this.KeyBinds.setHeight(height);
    }


    public void Effects(MatrixStack stack) {
        float x = this.Effects.getX();
        float y = this.Effects.getY();
        float offset = this.offsetEffects.getValue().floatValue();
        float height = 21.3F;
        StyledFont small = Fonts.msSemiBold[13];
        int counterEffect = 0;
        Iterator var8 = mc.player.getActivePotionEffects().iterator();

        while(var8.hasNext()) {
            EffectInstance effectInstance = (EffectInstance)var8.next();
            String levelpotion = String.valueOf(effectInstance.getAmplifier() + 1);
            float textWidthBonus = 27.3F;
            if (levelpotion.contains("1")) {
                levelpotion = "";
                textWidthBonus -= 5.0F;
            }

            String durationText = EffectUtils.getPotionDurationString(effectInstance, 1.0F);
            String text = I18n.format(effectInstance.getEffectName(), new Object[0]);
            float textWidth = small.getWidth(text + effectInstance.getAmplifier() + levelpotion) + textWidthBonus - 0.6F;
            Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
            small.drawString(stack, text + " " + levelpotion, (double)(x + 22.3F), (double)(y + 5.5F), (new Color(255, 255, 255, 255)).getRGB());
            small.drawString(stack, durationText, (double)(x + 22.3F), (double)(y + 13.5F), (new Color(255, 255, 255, 255)).getRGB());
            PotionSpriteUploader potionspriteuploader = mc.getPotionSpriteUploader();
            Effect effect = effectInstance.getPotion();
            TextureAtlasSprite textureatlassprite = potionspriteuploader.getSprite(effect);
            mc.getTextureManager().bindTexture(textureatlassprite.getAtlasTexture().getTextureLocation());
            DisplayEffectsScreen.blit(stack, (int)(x + 2.0F), (int)y + 2, 0, 18, 18, textureatlassprite);
            y += offset;
            ++counterEffect;
            this.Effects.setWidth(textWidth);
        }

        float setHeight = offset / 8.0F * (float)counterEffect;
        this.Effects.setHeight(height * (float)counterEffect + setHeight);
    }

    public void BPS(MatrixStack stack) {
        float x = this.BPS.getX();
        float y = this.BPS.getY();
        float height = 15.0F;
        StyledFont small = Fonts.msSemiBold[14];
        int X = (int)mc.player.getPosX();
        int Y = (int)mc.player.getPosY();
        int Z = (int)mc.player.getPosZ();
        Object[] var10001 = new Object[]{Math.hypot(mc.player.getPosX() - mc.player.prevPosX, mc.player.getPosZ() - mc.player.prevPosZ) * 20.0};
        String text = "Speed: " + String.format("%.2f", var10001);
        float textWidth = small.getWidth(text) + 8.5F;
        Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        small.drawString(stack, text, (double)(x + 4.5F), (double)y + 6.3, (new Color(255, 255, 255, 255)).getRGB());
        this.BPS.setWidth(textWidth);
        this.BPS.setHeight(height);
    }

    public void Coords(MatrixStack stack) {
        float x = this.Coords.getX();
        float y = this.Coords.getY();
        float height = 15.0F;
        StyledFont small = Fonts.msSemiBold[14];
        int X = (int)mc.player.getPosX();
        int Y = (int)mc.player.getPosY();
        int Z = (int)mc.player.getPosZ();
        String text = "Coords: x: " + X + ", y: " + Y + ", z: " + Z;
        float textWidth = small.getWidth(text) + 8.5F;
        Render2D.drawRoundedRect(x, y, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        small.drawString(stack, text, (double)(x + 4.5F), (double)(y + 6.0F), (new Color(255, 255, 255, 255)).getRGB());
        this.Coords.setWidth(textWidth);
        this.Coords.setHeight(height);
    }

    public void WT(MatrixStack stack) {
        float x = this.WT.getX();
        float y = this.WT.getY();
        float height = 17.0F;
        StyledFont small1 = Fonts.msSemiBold[14];
        StyledFont small = Fonts.msSemiBold[15];
        String playerName = mc.player.getName().getString();

        float offsetX = 1.0F;
        float offsetY = 1.5F;
        float fpsOffsetX = 50.0F;
        float fpsOffsetY = 1.5F;

        Minecraft var10000 = mc;
        String FPS = Minecraft.debugFPS + " FPS";
        String text = "Catlavan";
        float textWidth = small1.getWidth(text) + 13.0F;
        Render2D.drawRoundedRect(x + offsetX, y + offsetY, textWidth, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());
        float var100000 = x + fpsOffsetX;
        Minecraft var10003 = mc;
        int var12 = Minecraft.debugFPS;
        Render2D.drawRoundedRect(var100000, y + fpsOffsetY, small1.getWidth("  " + var12 + "fps") + 14.0F, height, 3.0F, (new Color(4, 4, 4, 215)).getRGB());

        small.drawString(stack, "Catlavan", (double)(x + offsetX + 5.0F), (double)(y + offsetY + 7.0F), (new Color(255, 255, 255, 255)).getRGB());

        Minecraft var10002 = mc;
        small.drawString(stack, "  " + Minecraft.debugFPS + "fps" + TextFormatting.GRAY, (double)(x + fpsOffsetX + 4.0F), (double)(y + fpsOffsetY + 7.0F), (new Color(255, 255, 255, 255)).getRGB());

        this.WT.setWidth(textWidth);
        this.WT.setHeight(height);
    }




    public void TargetHUD(MatrixStack stack) {
        float x = this.TargetHUD.getX();
        float y = this.TargetHUD.getY();
        float width = 91.0F;
        float height = 34.0F;
        float widthFace = 34.0F;
        this.target = this.getTarget(this.target);
        this.targetHudAnimation.setDuration(280);
        this.scale = this.targetHudAnimation.getOutput();
        if (this.scale == 0.0) {
            this.target = null;
        }

        if (this.target != null) {
            GlStateManager.pushMatrix();
            AnimationMath.sizeAnimation((double)(x + width / 2.0F), (double)(y + 15.0F), this.scale);
            Render2D.drawRoundedRect(x + 3.0F, y, width, height, 2.0F, (new Color(4, 4, 4, 215)).getRGB());
            if (this.target instanceof PlayerEntity) {
                Render2D.drawFace(x + 6.5F, y + 4.0F, 8.0F, 8.0F, 8.0F, 8.0F, 27.0F, 26.0F, 64.0F, 64.0F, (AbstractClientPlayerEntity)this.target);
            }

            int count = 0;

            for(int i = 0; i < mc.player.inventory.getSizeInventory(); ++i) {
                ItemStack s = mc.player.inventory.getStackInSlot(i);
                if (s.getItem() == Items.TOTEM_OF_UNDYING) {
                    ++count;
                }
            }

            float xHP = x + widthFace + 3.8F;
            float yHP = y + 21.5F;
            float widthHP = 52.0F;
            this.health = AnimationMath.fast(this.health, this.target.getHealth() / this.target.getMaxHealth(), 6.0F);
            this.health = MathHelper.clamp(this.health, 0.0F, 1.0F);
            this.absorpation = AnimationMath.fast(this.absorpation, this.target.getAbsorptionAmount() / this.target.getMaxHealth(), 6.0F);
            this.absorpation = MathHelper.clamp(this.absorpation, 0.0F, 1.0F);
            int green_color;
            int blackgreen_color;
            if (this.target.getHealth() > 5.0F) {
                if (this.target.getHealth() > 12.0F) {
                    green_color = (new Color(85, 201, 21, 255)).getRGB();
                    blackgreen_color = (new Color(44, 141, 24, 255)).getRGB();
                    Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
                } else {
                    green_color = (new Color(255, 101, 5, 255)).getRGB();
                    blackgreen_color = (new Color(150, 87, 21, 255)).getRGB();
                    Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
                }
            } else {
                green_color = (new Color(238, 35, 35, 255)).getRGB();
                blackgreen_color = (new Color(185, 22, 22, 255)).getRGB();
                Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.health, 5.6F, 1.0F, blackgreen_color, blackgreen_color, green_color, green_color);
            }

            Render2D.drawGradientRound(xHP, yHP + 2.0F, 52.0F * this.absorpation, 5.6F, 1.0F, (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB(), (new Color(222, 108, 14, 255)).getRGB());
            String targetName = this.target.getName().getString();
            StyledFont small = Fonts.gilroyBold[13];
            SmartScissor.push();
            SmartScissor.setFromComponentCoordinates((double)x, (double)y, (double)(width - 6.0F), (double)height);
            small.drawString(stack, targetName, (double)xHP, (double)(yHP - 14.3F), (new Color(255, 255, 255, 255)).getRGB());
            SmartScissor.unset();
            SmartScissor.pop();
            String HP = String.valueOf(this.target.getHealth() + this.target.getAbsorptionAmount());
            String StringHP = HP.substring(0, Math.min(HP.length(), 4));
            if (this.target.getHealth() + this.target.getAbsorptionAmount() < 10.0F) {
                StringHP = HP.substring(0, Math.min(HP.length(), 3));
            }

            StyledFont small1 = Fonts.gilroyBold[11];
            small1.drawString(stack, "HP: " + StringHP, (double)xHP, (double)(yHP - 5.7F), (new Color(255, 255, 255, 255)).getRGB());
            this.drawItemStack(x, y - 12.0F, 10.5F, 0.7F);
            GlStateManager.popMatrix();
            this.TargetHUD.setWidth(width);
            this.TargetHUD.setHeight(height);
        }

    }

    private void drawItemStack(float x, float y, float offset, float scaleValue) {
        ArrayList<ItemStack> stackList = new ArrayList(Arrays.asList(this.target.getHeldItemMainhand(), this.target.getHeldItemOffhand()));
        stackList.addAll((Collection)this.target.getArmorInventoryList());
        AtomicReference<Float> posX = new AtomicReference(x);
        stackList.stream().filter((stack) -> {
            return !stack.isEmpty();
        }).forEach((stack) -> {
            HudUtil.drawItemStack(stack, (Float)posX.getAndAccumulate(offset, Float::sum), y, true, true, scaleValue);
        });
    }

    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity target = nullTarget;
        AttackAura var10000 = Managment.FUNCTION_MANAGER.attackAura;
        if (AttackAura.getTarget() instanceof LivingEntity) {
            var10000 = Managment.FUNCTION_MANAGER.attackAura;
            target = AttackAura.getTarget();
            this.targetHudAnimation.setDirection(Direction.FORWARDS);
        } else if (IMinecraft.mc.currentScreen instanceof ChatScreen) {
            target = IMinecraft.mc.player;
            this.targetHudAnimation.setDirection(Direction.FORWARDS);
        } else {
            this.targetHudAnimation.setDirection(Direction.BACKWARDS);
        }

        return (LivingEntity)target;
    }
}
норм, но кривенько чуть чуть
 
Сверху Снизу