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

Часть функционала TargetHud || Rich 1.21.4

1773616270522.png
 
Всем сап заливаю свой таргетхуд
фууу брух че это:
Expand Collapse Copy
package fun.rich.display.hud;
import fun.rich.Rich;
import fun.rich.utils.interactions.interact.PlayerInteractionHelper;
import fun.rich.utils.math.time.StopWatch;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.client.render.entity.state.LivingEntityRenderState;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import fun.rich.utils.client.managers.api.draggable.AbstractDraggable;
import fun.rich.features.impl.combat.Aura;
import fun.rich.features.impl.render.Hud;
import fun.rich.common.animation.Animation;
import fun.rich.common.animation.Direction;
import fun.rich.common.animation.implement.Decelerate;
import fun.rich.utils.display.font.FontRenderer;
import fun.rich.utils.display.font.Fonts;
import fun.rich.utils.display.shape.ShapeProperties;
import fun.rich.utils.display.color.ColorAssist;
import fun.rich.utils.interactions.item.ItemTask;
import fun.rich.utils.math.calc.Calculate;
import fun.rich.utils.display.geometry.Render2D;
import fun.rich.utils.display.scissor.ScissorAssist;
import fun.rich.utils.client.packet.network.Network;
import java.awt.*;

public class TargetHud extends AbstractDraggable {
    private final Animation animation = new Decelerate().setMs(650).setValue(1);
    private final Animation faceAlphaAnimation = new Decelerate().setMs(125).setValue(1);
    private final StopWatch stopWatch = new StopWatch();
    private final StopWatch distanceUpdateTimer = new StopWatch();
    private LivingEntity lastTarget;
    private Item lastItem = Items.AIR;
    private float health;
    private float absorption;
    private float displayedDistance;

    public TargetHud() {
        super("Target Hud", 10, 80, 100, 36, true);
    }

    @Override
    public boolean visible() {
        return scaleAnimation.isDirection(Direction.FORWARDS);
    }

    @Override
    public void tick() {
        LivingEntity auraTarget = Aura.getInstance().getTarget();
        if (auraTarget != null) {
            lastTarget = auraTarget;
            startAnimation();
            faceAlphaAnimation.setDirection(Direction.FORWARDS);
        } else if (PlayerInteractionHelper.isChat(mc.currentScreen)) {
            lastTarget = mc.player;
            startAnimation();
            faceAlphaAnimation.setDirection(Direction.FORWARDS);
        } else if (stopWatch.finished(500)) {
            stopAnimation();
            faceAlphaAnimation.setDirection(Direction.BACKWARDS);
        }
    }

    @Override
    public void drawDraggable(DrawContext context) {
        if (Hud.getInstance().interfaceSettings.isSelected("Target Hud") && Hud.getInstance().state) {
            if (lastTarget != null) {
                MatrixStack matrix = context.getMatrices();
//                drawUsingItem(context, matrix);
                drawMain(context, matrix);
                drawArmor(context, matrix);
                drawFace(context);
            }
        }
    }

    private void drawMain(DrawContext context, MatrixStack matrix) {

        FontRenderer nameFont = Fonts.getSize(16, Fonts.Type.SEMI);
        FontRenderer infoFont = Fonts.getSize(11, Fonts.Type.REGULAR);

        float baseX = getX();
        float baseY = getY();

        float hp = PlayerInteractionHelper.getHealth(lastTarget);
        float maxHp = lastTarget.getMaxHealth();
        float hpPercent = MathHelper.clamp(hp / maxHp, 0f, 1f);

        health = Calculate.interpolateSmooth(0.6f, health, hpPercent);

        float distance = mc.player.distanceTo(lastTarget);
        displayedDistance = Calculate.interpolateSmooth(0.5f, displayedDistance, distance);

        float barMaxWidth = 65f;
        float barWidth = barMaxWidth * health;

        setWidth(120);
        setHeight(42);

        blur.render(ShapeProperties.create(matrix, baseX, baseY, getWidth(), getHeight())
                .round(7)
                .color(new Color(0, 0, 0, 130).getRGB())
                .build());

        rectangle.render(ShapeProperties.create(matrix, baseX, baseY, getWidth(), getHeight())
                .round(7)
                .thickness(1f)
                .outlineColor(new Color(25,25,25,255).getRGB())
                .color(new Color(20,20,22,150).getRGB())
                .build());

        float contentX = baseX + 28;
        float contentY = baseY + 6;

        nameFont.drawString(matrix,
                lastTarget.getName().getString(),
                contentX,
                contentY,
                ColorAssist.getText());

        String distText = String.format("%.1fm", displayedDistance);

        infoFont.drawString(matrix,
                distText,
                contentX,
                contentY + 11,
                new Color(170,170,190,255).getRGB());

        float barY = contentY + 20;

        rectangle.render(ShapeProperties.create(matrix,
                        contentX,
                        barY,
                        barMaxWidth,
                        3)
                .round(2)
                .color(new Color(45,45,45,220).getRGB())
                .build());

        Color hpColor = hpPercent > 0.5f
                ? new Color(80, 200, 120)
                : hpPercent > 0.25f
                ? new Color(255, 170, 0)
                : new Color(255, 70, 70);

        rectangle.render(ShapeProperties.create(matrix,
                        contentX,
                        barY,
                        barWidth,
                        3)
                .round(2)
                .color(hpColor.getRGB())
                .build());

        String hpText = String.format("%.1f HP", hp);

        infoFont.drawString(matrix,
                hpText,
                contentX + barMaxWidth + 5,
                barY - 2,
                new Color(255,255,255,230).getRGB());
    }

    private void drawArmor(DrawContext context, MatrixStack matrix) {
        ItemStack[] slots = new ItemStack[]{
                lastTarget.getMainHandStack(),
                lastTarget.getOffHandStack(),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.HEAD),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.CHEST),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.LEGS),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.FEET)
        };
        float x = getX() + 21f;
        float y = getY() + 17;
        float slotSize = 16 * 0.5F + 2;
        matrix.push();
        matrix.translate(x, y, 0);
        for (int i = 0; i < 6; i++) {
            float currentX = i * 11.5f;

            blur.render(ShapeProperties.create(matrix, currentX - 0.5f, 15F, slotSize + 1, slotSize + 1)
                    .round(3).quality(12)
                    .color(new Color(0, 0, 0, 150).getRGB())
                    .build());

            rectangle.render(ShapeProperties.create(matrix, currentX - 0.5f, 15F, slotSize + 1, slotSize + 1)
                    .round(3)
                    .thickness(0.1f)
                    .outlineColor(new Color(33, 33, 33, 255).getRGB())
                    .color(
                            new Color(18, 19, 20, 75).getRGB(),
                            new Color(0, 2, 5, 75).getRGB(),
                            new Color(0, 2, 5, 75).getRGB(),
                            new Color(18, 19, 20, 75).getRGB())
                    .build());

            if (!slots[i].isEmpty()) {
                Render2D.defaultDrawStack(context, slots[i], currentX, 15.5F, false, false, 0.5F);
            } else {
                String xText = "x";
                FontRenderer font = Fonts.getSize(12, Fonts.Type.DEFAULT);
                float textWidth = font.getStringWidth(xText);
                float textHeight = font.getStringHeight(xText);
                float textX = currentX + (slotSize - textWidth) / 2.0F;
                float textY = 15.5F + (slotSize - textHeight) / 2.0F;
                font.drawString(matrix, xText, textX, textY + 6.25f, new Color(225, 225, 255, 255).getRGB());
            }
        }
        matrix.pop();
    }

    private void drawUsingItem(DrawContext context, MatrixStack matrix) {
        animation.setDirection(lastTarget.isUsingItem() ? Direction.FORWARDS : Direction.BACKWARDS);
        if (!lastTarget.getActiveItem().isEmpty() && lastTarget.getActiveItem().getCount() != 0) {
            lastItem = lastTarget.getActiveItem().getItem();
        }
        if (!animation.isFinished(Direction.BACKWARDS) && !lastItem.equals(Items.AIR)) {
            int size = 24;
            float anim = animation.getOutput().floatValue();
            float progress = (lastTarget.getItemUseTime() + tickCounter.getTickDelta(false)) / ItemTask.maxUseTick(lastItem) * 360;
            float x = getX() - (size + 5) * anim;
            float y = getY() + 4;
            ScissorAssist scissorManager = Rich.getInstance().getScissorManager();
            scissorManager.push(matrix.peek().getPositionMatrix(), getX() - 50, getY(), 50, getHeight());
            Calculate.setAlpha(anim, () -> {
                blur.render(ShapeProperties.create(matrix, x, y, size, size).quality(5)
                        .round(12).softness(1).thickness(2).outlineColor(ColorAssist.getOutline(0)).color(ColorAssist.getRect(0.7F)).build());
                arc.render(ShapeProperties.create(matrix, x, y, size, size).round(0.38F).thickness(0.30f).end(progress)
                        .color(ColorAssist.fade(0), ColorAssist.fade(200), ColorAssist.fade(0), ColorAssist.fade(200)).build());
                Render2D.defaultDrawStack(context, lastItem.getDefaultStack(), x + 3f, y + 3f, false, false, 1f);
            });
            scissorManager.pop();
        }
    }

    private void drawFace(DrawContext context) {

        EntityRenderer<? super LivingEntity, ?> baseRenderer =
                mc.getEntityRenderDispatcher().getRenderer(lastTarget);

        if (!(baseRenderer instanceof LivingEntityRenderer<?, ?, ?>)) {
            return;
        }

        @SuppressWarnings("unchecked")
        LivingEntityRenderer<LivingEntity, LivingEntityRenderState, ?> renderer =
                (LivingEntityRenderer<LivingEntity, LivingEntityRenderState, ?>) baseRenderer;

        LivingEntityRenderState state =
                renderer.getAndUpdateRenderState(lastTarget, tickCounter.getTickDelta(false));

        Identifier textureLocation = renderer.getTexture(state);

        float alpha = faceAlphaAnimation.getOutput().floatValue();

        Calculate.setAlpha(alpha, () -> {

            // фон под лицо
            rectangle.render(ShapeProperties.create(context.getMatrices(),
                            getX() + 4,
                            getY() + 6,
                            22,
                            22)
                    .round(5)
                    .color(new Color(30, 30, 32, 200).getRGB())
                    .build());

            Render2D.drawTexture(context,
                    textureLocation,
                    getX() + 5,
                    getY() + 7,
                    20,
                    20,
                    8,
                    8,
                    64,
                    Color.WHITE.getRGB(),
                    ColorAssist.multRed(-1, 1 + lastTarget.hurtTime / 4F));
        });
    }
}
Посмотреть вложение 329316
/del дерьмо ебучее
 
Всем сап заливаю свой таргетхуд
фууу брух че это:
Expand Collapse Copy
package fun.rich.display.hud;
import fun.rich.Rich;
import fun.rich.utils.interactions.interact.PlayerInteractionHelper;
import fun.rich.utils.math.time.StopWatch;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.client.render.entity.state.LivingEntityRenderState;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import fun.rich.utils.client.managers.api.draggable.AbstractDraggable;
import fun.rich.features.impl.combat.Aura;
import fun.rich.features.impl.render.Hud;
import fun.rich.common.animation.Animation;
import fun.rich.common.animation.Direction;
import fun.rich.common.animation.implement.Decelerate;
import fun.rich.utils.display.font.FontRenderer;
import fun.rich.utils.display.font.Fonts;
import fun.rich.utils.display.shape.ShapeProperties;
import fun.rich.utils.display.color.ColorAssist;
import fun.rich.utils.interactions.item.ItemTask;
import fun.rich.utils.math.calc.Calculate;
import fun.rich.utils.display.geometry.Render2D;
import fun.rich.utils.display.scissor.ScissorAssist;
import fun.rich.utils.client.packet.network.Network;
import java.awt.*;

public class TargetHud extends AbstractDraggable {
    private final Animation animation = new Decelerate().setMs(650).setValue(1);
    private final Animation faceAlphaAnimation = new Decelerate().setMs(125).setValue(1);
    private final StopWatch stopWatch = new StopWatch();
    private final StopWatch distanceUpdateTimer = new StopWatch();
    private LivingEntity lastTarget;
    private Item lastItem = Items.AIR;
    private float health;
    private float absorption;
    private float displayedDistance;

    public TargetHud() {
        super("Target Hud", 10, 80, 100, 36, true);
    }

    @Override
    public boolean visible() {
        return scaleAnimation.isDirection(Direction.FORWARDS);
    }

    @Override
    public void tick() {
        LivingEntity auraTarget = Aura.getInstance().getTarget();
        if (auraTarget != null) {
            lastTarget = auraTarget;
            startAnimation();
            faceAlphaAnimation.setDirection(Direction.FORWARDS);
        } else if (PlayerInteractionHelper.isChat(mc.currentScreen)) {
            lastTarget = mc.player;
            startAnimation();
            faceAlphaAnimation.setDirection(Direction.FORWARDS);
        } else if (stopWatch.finished(500)) {
            stopAnimation();
            faceAlphaAnimation.setDirection(Direction.BACKWARDS);
        }
    }

    @Override
    public void drawDraggable(DrawContext context) {
        if (Hud.getInstance().interfaceSettings.isSelected("Target Hud") && Hud.getInstance().state) {
            if (lastTarget != null) {
                MatrixStack matrix = context.getMatrices();
//                drawUsingItem(context, matrix);
                drawMain(context, matrix);
                drawArmor(context, matrix);
                drawFace(context);
            }
        }
    }

    private void drawMain(DrawContext context, MatrixStack matrix) {

        FontRenderer nameFont = Fonts.getSize(16, Fonts.Type.SEMI);
        FontRenderer infoFont = Fonts.getSize(11, Fonts.Type.REGULAR);

        float baseX = getX();
        float baseY = getY();

        float hp = PlayerInteractionHelper.getHealth(lastTarget);
        float maxHp = lastTarget.getMaxHealth();
        float hpPercent = MathHelper.clamp(hp / maxHp, 0f, 1f);

        health = Calculate.interpolateSmooth(0.6f, health, hpPercent);

        float distance = mc.player.distanceTo(lastTarget);
        displayedDistance = Calculate.interpolateSmooth(0.5f, displayedDistance, distance);

        float barMaxWidth = 65f;
        float barWidth = barMaxWidth * health;

        setWidth(120);
        setHeight(42);

        blur.render(ShapeProperties.create(matrix, baseX, baseY, getWidth(), getHeight())
                .round(7)
                .color(new Color(0, 0, 0, 130).getRGB())
                .build());

        rectangle.render(ShapeProperties.create(matrix, baseX, baseY, getWidth(), getHeight())
                .round(7)
                .thickness(1f)
                .outlineColor(new Color(25,25,25,255).getRGB())
                .color(new Color(20,20,22,150).getRGB())
                .build());

        float contentX = baseX + 28;
        float contentY = baseY + 6;

        nameFont.drawString(matrix,
                lastTarget.getName().getString(),
                contentX,
                contentY,
                ColorAssist.getText());

        String distText = String.format("%.1fm", displayedDistance);

        infoFont.drawString(matrix,
                distText,
                contentX,
                contentY + 11,
                new Color(170,170,190,255).getRGB());

        float barY = contentY + 20;

        rectangle.render(ShapeProperties.create(matrix,
                        contentX,
                        barY,
                        barMaxWidth,
                        3)
                .round(2)
                .color(new Color(45,45,45,220).getRGB())
                .build());

        Color hpColor = hpPercent > 0.5f
                ? new Color(80, 200, 120)
                : hpPercent > 0.25f
                ? new Color(255, 170, 0)
                : new Color(255, 70, 70);

        rectangle.render(ShapeProperties.create(matrix,
                        contentX,
                        barY,
                        barWidth,
                        3)
                .round(2)
                .color(hpColor.getRGB())
                .build());

        String hpText = String.format("%.1f HP", hp);

        infoFont.drawString(matrix,
                hpText,
                contentX + barMaxWidth + 5,
                barY - 2,
                new Color(255,255,255,230).getRGB());
    }

    private void drawArmor(DrawContext context, MatrixStack matrix) {
        ItemStack[] slots = new ItemStack[]{
                lastTarget.getMainHandStack(),
                lastTarget.getOffHandStack(),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.HEAD),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.CHEST),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.LEGS),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.FEET)
        };
        float x = getX() + 21f;
        float y = getY() + 17;
        float slotSize = 16 * 0.5F + 2;
        matrix.push();
        matrix.translate(x, y, 0);
        for (int i = 0; i < 6; i++) {
            float currentX = i * 11.5f;

            blur.render(ShapeProperties.create(matrix, currentX - 0.5f, 15F, slotSize + 1, slotSize + 1)
                    .round(3).quality(12)
                    .color(new Color(0, 0, 0, 150).getRGB())
                    .build());

            rectangle.render(ShapeProperties.create(matrix, currentX - 0.5f, 15F, slotSize + 1, slotSize + 1)
                    .round(3)
                    .thickness(0.1f)
                    .outlineColor(new Color(33, 33, 33, 255).getRGB())
                    .color(
                            new Color(18, 19, 20, 75).getRGB(),
                            new Color(0, 2, 5, 75).getRGB(),
                            new Color(0, 2, 5, 75).getRGB(),
                            new Color(18, 19, 20, 75).getRGB())
                    .build());

            if (!slots[i].isEmpty()) {
                Render2D.defaultDrawStack(context, slots[i], currentX, 15.5F, false, false, 0.5F);
            } else {
                String xText = "x";
                FontRenderer font = Fonts.getSize(12, Fonts.Type.DEFAULT);
                float textWidth = font.getStringWidth(xText);
                float textHeight = font.getStringHeight(xText);
                float textX = currentX + (slotSize - textWidth) / 2.0F;
                float textY = 15.5F + (slotSize - textHeight) / 2.0F;
                font.drawString(matrix, xText, textX, textY + 6.25f, new Color(225, 225, 255, 255).getRGB());
            }
        }
        matrix.pop();
    }

    private void drawUsingItem(DrawContext context, MatrixStack matrix) {
        animation.setDirection(lastTarget.isUsingItem() ? Direction.FORWARDS : Direction.BACKWARDS);
        if (!lastTarget.getActiveItem().isEmpty() && lastTarget.getActiveItem().getCount() != 0) {
            lastItem = lastTarget.getActiveItem().getItem();
        }
        if (!animation.isFinished(Direction.BACKWARDS) && !lastItem.equals(Items.AIR)) {
            int size = 24;
            float anim = animation.getOutput().floatValue();
            float progress = (lastTarget.getItemUseTime() + tickCounter.getTickDelta(false)) / ItemTask.maxUseTick(lastItem) * 360;
            float x = getX() - (size + 5) * anim;
            float y = getY() + 4;
            ScissorAssist scissorManager = Rich.getInstance().getScissorManager();
            scissorManager.push(matrix.peek().getPositionMatrix(), getX() - 50, getY(), 50, getHeight());
            Calculate.setAlpha(anim, () -> {
                blur.render(ShapeProperties.create(matrix, x, y, size, size).quality(5)
                        .round(12).softness(1).thickness(2).outlineColor(ColorAssist.getOutline(0)).color(ColorAssist.getRect(0.7F)).build());
                arc.render(ShapeProperties.create(matrix, x, y, size, size).round(0.38F).thickness(0.30f).end(progress)
                        .color(ColorAssist.fade(0), ColorAssist.fade(200), ColorAssist.fade(0), ColorAssist.fade(200)).build());
                Render2D.defaultDrawStack(context, lastItem.getDefaultStack(), x + 3f, y + 3f, false, false, 1f);
            });
            scissorManager.pop();
        }
    }

    private void drawFace(DrawContext context) {

        EntityRenderer<? super LivingEntity, ?> baseRenderer =
                mc.getEntityRenderDispatcher().getRenderer(lastTarget);

        if (!(baseRenderer instanceof LivingEntityRenderer<?, ?, ?>)) {
            return;
        }

        @SuppressWarnings("unchecked")
        LivingEntityRenderer<LivingEntity, LivingEntityRenderState, ?> renderer =
                (LivingEntityRenderer<LivingEntity, LivingEntityRenderState, ?>) baseRenderer;

        LivingEntityRenderState state =
                renderer.getAndUpdateRenderState(lastTarget, tickCounter.getTickDelta(false));

        Identifier textureLocation = renderer.getTexture(state);

        float alpha = faceAlphaAnimation.getOutput().floatValue();

        Calculate.setAlpha(alpha, () -> {

            // фон под лицо
            rectangle.render(ShapeProperties.create(context.getMatrices(),
                            getX() + 4,
                            getY() + 6,
                            22,
                            22)
                    .round(5)
                    .color(new Color(30, 30, 32, 200).getRGB())
                    .build());

            Render2D.drawTexture(context,
                    textureLocation,
                    getX() + 5,
                    getY() + 7,
                    20,
                    20,
                    8,
                    8,
                    64,
                    Color.WHITE.getRGB(),
                    ColorAssist.multRed(-1, 1 + lastTarget.hurtTime / 4F));
        });
    }
}
Посмотреть вложение 329316
вырежи интернет нахуй пожалуйста
 
Всем сап заливаю свой таргетхуд
фууу брух че это:
Expand Collapse Copy
package fun.rich.display.hud;
import fun.rich.Rich;
import fun.rich.utils.interactions.interact.PlayerInteractionHelper;
import fun.rich.utils.math.time.StopWatch;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.client.render.entity.state.LivingEntityRenderState;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import fun.rich.utils.client.managers.api.draggable.AbstractDraggable;
import fun.rich.features.impl.combat.Aura;
import fun.rich.features.impl.render.Hud;
import fun.rich.common.animation.Animation;
import fun.rich.common.animation.Direction;
import fun.rich.common.animation.implement.Decelerate;
import fun.rich.utils.display.font.FontRenderer;
import fun.rich.utils.display.font.Fonts;
import fun.rich.utils.display.shape.ShapeProperties;
import fun.rich.utils.display.color.ColorAssist;
import fun.rich.utils.interactions.item.ItemTask;
import fun.rich.utils.math.calc.Calculate;
import fun.rich.utils.display.geometry.Render2D;
import fun.rich.utils.display.scissor.ScissorAssist;
import fun.rich.utils.client.packet.network.Network;
import java.awt.*;

public class TargetHud extends AbstractDraggable {
    private final Animation animation = new Decelerate().setMs(650).setValue(1);
    private final Animation faceAlphaAnimation = new Decelerate().setMs(125).setValue(1);
    private final StopWatch stopWatch = new StopWatch();
    private final StopWatch distanceUpdateTimer = new StopWatch();
    private LivingEntity lastTarget;
    private Item lastItem = Items.AIR;
    private float health;
    private float absorption;
    private float displayedDistance;

    public TargetHud() {
        super("Target Hud", 10, 80, 100, 36, true);
    }

    @Override
    public boolean visible() {
        return scaleAnimation.isDirection(Direction.FORWARDS);
    }

    @Override
    public void tick() {
        LivingEntity auraTarget = Aura.getInstance().getTarget();
        if (auraTarget != null) {
            lastTarget = auraTarget;
            startAnimation();
            faceAlphaAnimation.setDirection(Direction.FORWARDS);
        } else if (PlayerInteractionHelper.isChat(mc.currentScreen)) {
            lastTarget = mc.player;
            startAnimation();
            faceAlphaAnimation.setDirection(Direction.FORWARDS);
        } else if (stopWatch.finished(500)) {
            stopAnimation();
            faceAlphaAnimation.setDirection(Direction.BACKWARDS);
        }
    }

    @Override
    public void drawDraggable(DrawContext context) {
        if (Hud.getInstance().interfaceSettings.isSelected("Target Hud") && Hud.getInstance().state) {
            if (lastTarget != null) {
                MatrixStack matrix = context.getMatrices();
//                drawUsingItem(context, matrix);
                drawMain(context, matrix);
                drawArmor(context, matrix);
                drawFace(context);
            }
        }
    }

    private void drawMain(DrawContext context, MatrixStack matrix) {

        FontRenderer nameFont = Fonts.getSize(16, Fonts.Type.SEMI);
        FontRenderer infoFont = Fonts.getSize(11, Fonts.Type.REGULAR);

        float baseX = getX();
        float baseY = getY();

        float hp = PlayerInteractionHelper.getHealth(lastTarget);
        float maxHp = lastTarget.getMaxHealth();
        float hpPercent = MathHelper.clamp(hp / maxHp, 0f, 1f);

        health = Calculate.interpolateSmooth(0.6f, health, hpPercent);

        float distance = mc.player.distanceTo(lastTarget);
        displayedDistance = Calculate.interpolateSmooth(0.5f, displayedDistance, distance);

        float barMaxWidth = 65f;
        float barWidth = barMaxWidth * health;

        setWidth(120);
        setHeight(42);

        blur.render(ShapeProperties.create(matrix, baseX, baseY, getWidth(), getHeight())
                .round(7)
                .color(new Color(0, 0, 0, 130).getRGB())
                .build());

        rectangle.render(ShapeProperties.create(matrix, baseX, baseY, getWidth(), getHeight())
                .round(7)
                .thickness(1f)
                .outlineColor(new Color(25,25,25,255).getRGB())
                .color(new Color(20,20,22,150).getRGB())
                .build());

        float contentX = baseX + 28;
        float contentY = baseY + 6;

        nameFont.drawString(matrix,
                lastTarget.getName().getString(),
                contentX,
                contentY,
                ColorAssist.getText());

        String distText = String.format("%.1fm", displayedDistance);

        infoFont.drawString(matrix,
                distText,
                contentX,
                contentY + 11,
                new Color(170,170,190,255).getRGB());

        float barY = contentY + 20;

        rectangle.render(ShapeProperties.create(matrix,
                        contentX,
                        barY,
                        barMaxWidth,
                        3)
                .round(2)
                .color(new Color(45,45,45,220).getRGB())
                .build());

        Color hpColor = hpPercent > 0.5f
                ? new Color(80, 200, 120)
                : hpPercent > 0.25f
                ? new Color(255, 170, 0)
                : new Color(255, 70, 70);

        rectangle.render(ShapeProperties.create(matrix,
                        contentX,
                        barY,
                        barWidth,
                        3)
                .round(2)
                .color(hpColor.getRGB())
                .build());

        String hpText = String.format("%.1f HP", hp);

        infoFont.drawString(matrix,
                hpText,
                contentX + barMaxWidth + 5,
                barY - 2,
                new Color(255,255,255,230).getRGB());
    }

    private void drawArmor(DrawContext context, MatrixStack matrix) {
        ItemStack[] slots = new ItemStack[]{
                lastTarget.getMainHandStack(),
                lastTarget.getOffHandStack(),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.HEAD),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.CHEST),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.LEGS),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.FEET)
        };
        float x = getX() + 21f;
        float y = getY() + 17;
        float slotSize = 16 * 0.5F + 2;
        matrix.push();
        matrix.translate(x, y, 0);
        for (int i = 0; i < 6; i++) {
            float currentX = i * 11.5f;

            blur.render(ShapeProperties.create(matrix, currentX - 0.5f, 15F, slotSize + 1, slotSize + 1)
                    .round(3).quality(12)
                    .color(new Color(0, 0, 0, 150).getRGB())
                    .build());

            rectangle.render(ShapeProperties.create(matrix, currentX - 0.5f, 15F, slotSize + 1, slotSize + 1)
                    .round(3)
                    .thickness(0.1f)
                    .outlineColor(new Color(33, 33, 33, 255).getRGB())
                    .color(
                            new Color(18, 19, 20, 75).getRGB(),
                            new Color(0, 2, 5, 75).getRGB(),
                            new Color(0, 2, 5, 75).getRGB(),
                            new Color(18, 19, 20, 75).getRGB())
                    .build());

            if (!slots[i].isEmpty()) {
                Render2D.defaultDrawStack(context, slots[i], currentX, 15.5F, false, false, 0.5F);
            } else {
                String xText = "x";
                FontRenderer font = Fonts.getSize(12, Fonts.Type.DEFAULT);
                float textWidth = font.getStringWidth(xText);
                float textHeight = font.getStringHeight(xText);
                float textX = currentX + (slotSize - textWidth) / 2.0F;
                float textY = 15.5F + (slotSize - textHeight) / 2.0F;
                font.drawString(matrix, xText, textX, textY + 6.25f, new Color(225, 225, 255, 255).getRGB());
            }
        }
        matrix.pop();
    }

    private void drawUsingItem(DrawContext context, MatrixStack matrix) {
        animation.setDirection(lastTarget.isUsingItem() ? Direction.FORWARDS : Direction.BACKWARDS);
        if (!lastTarget.getActiveItem().isEmpty() && lastTarget.getActiveItem().getCount() != 0) {
            lastItem = lastTarget.getActiveItem().getItem();
        }
        if (!animation.isFinished(Direction.BACKWARDS) && !lastItem.equals(Items.AIR)) {
            int size = 24;
            float anim = animation.getOutput().floatValue();
            float progress = (lastTarget.getItemUseTime() + tickCounter.getTickDelta(false)) / ItemTask.maxUseTick(lastItem) * 360;
            float x = getX() - (size + 5) * anim;
            float y = getY() + 4;
            ScissorAssist scissorManager = Rich.getInstance().getScissorManager();
            scissorManager.push(matrix.peek().getPositionMatrix(), getX() - 50, getY(), 50, getHeight());
            Calculate.setAlpha(anim, () -> {
                blur.render(ShapeProperties.create(matrix, x, y, size, size).quality(5)
                        .round(12).softness(1).thickness(2).outlineColor(ColorAssist.getOutline(0)).color(ColorAssist.getRect(0.7F)).build());
                arc.render(ShapeProperties.create(matrix, x, y, size, size).round(0.38F).thickness(0.30f).end(progress)
                        .color(ColorAssist.fade(0), ColorAssist.fade(200), ColorAssist.fade(0), ColorAssist.fade(200)).build());
                Render2D.defaultDrawStack(context, lastItem.getDefaultStack(), x + 3f, y + 3f, false, false, 1f);
            });
            scissorManager.pop();
        }
    }

    private void drawFace(DrawContext context) {

        EntityRenderer<? super LivingEntity, ?> baseRenderer =
                mc.getEntityRenderDispatcher().getRenderer(lastTarget);

        if (!(baseRenderer instanceof LivingEntityRenderer<?, ?, ?>)) {
            return;
        }

        @SuppressWarnings("unchecked")
        LivingEntityRenderer<LivingEntity, LivingEntityRenderState, ?> renderer =
                (LivingEntityRenderer<LivingEntity, LivingEntityRenderState, ?>) baseRenderer;

        LivingEntityRenderState state =
                renderer.getAndUpdateRenderState(lastTarget, tickCounter.getTickDelta(false));

        Identifier textureLocation = renderer.getTexture(state);

        float alpha = faceAlphaAnimation.getOutput().floatValue();

        Calculate.setAlpha(alpha, () -> {

            // фон под лицо
            rectangle.render(ShapeProperties.create(context.getMatrices(),
                            getX() + 4,
                            getY() + 6,
                            22,
                            22)
                    .round(5)
                    .color(new Color(30, 30, 32, 200).getRGB())
                    .build());

            Render2D.drawTexture(context,
                    textureLocation,
                    getX() + 5,
                    getY() + 7,
                    20,
                    20,
                    8,
                    8,
                    64,
                    Color.WHITE.getRGB(),
                    ColorAssist.multRed(-1, 1 + lastTarget.hurtTime / 4F));
        });
    }
}
Посмотреть вложение 329316
пойду порыгаю
 
Всем сап заливаю свой таргетхуд
фууу брух че это:
Expand Collapse Copy
package fun.rich.display.hud;
import fun.rich.Rich;
import fun.rich.utils.interactions.interact.PlayerInteractionHelper;
import fun.rich.utils.math.time.StopWatch;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.client.render.entity.state.LivingEntityRenderState;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import fun.rich.utils.client.managers.api.draggable.AbstractDraggable;
import fun.rich.features.impl.combat.Aura;
import fun.rich.features.impl.render.Hud;
import fun.rich.common.animation.Animation;
import fun.rich.common.animation.Direction;
import fun.rich.common.animation.implement.Decelerate;
import fun.rich.utils.display.font.FontRenderer;
import fun.rich.utils.display.font.Fonts;
import fun.rich.utils.display.shape.ShapeProperties;
import fun.rich.utils.display.color.ColorAssist;
import fun.rich.utils.interactions.item.ItemTask;
import fun.rich.utils.math.calc.Calculate;
import fun.rich.utils.display.geometry.Render2D;
import fun.rich.utils.display.scissor.ScissorAssist;
import fun.rich.utils.client.packet.network.Network;
import java.awt.*;

public class TargetHud extends AbstractDraggable {
    private final Animation animation = new Decelerate().setMs(650).setValue(1);
    private final Animation faceAlphaAnimation = new Decelerate().setMs(125).setValue(1);
    private final StopWatch stopWatch = new StopWatch();
    private final StopWatch distanceUpdateTimer = new StopWatch();
    private LivingEntity lastTarget;
    private Item lastItem = Items.AIR;
    private float health;
    private float absorption;
    private float displayedDistance;

    public TargetHud() {
        super("Target Hud", 10, 80, 100, 36, true);
    }

    @Override
    public boolean visible() {
        return scaleAnimation.isDirection(Direction.FORWARDS);
    }

    @Override
    public void tick() {
        LivingEntity auraTarget = Aura.getInstance().getTarget();
        if (auraTarget != null) {
            lastTarget = auraTarget;
            startAnimation();
            faceAlphaAnimation.setDirection(Direction.FORWARDS);
        } else if (PlayerInteractionHelper.isChat(mc.currentScreen)) {
            lastTarget = mc.player;
            startAnimation();
            faceAlphaAnimation.setDirection(Direction.FORWARDS);
        } else if (stopWatch.finished(500)) {
            stopAnimation();
            faceAlphaAnimation.setDirection(Direction.BACKWARDS);
        }
    }

    @Override
    public void drawDraggable(DrawContext context) {
        if (Hud.getInstance().interfaceSettings.isSelected("Target Hud") && Hud.getInstance().state) {
            if (lastTarget != null) {
                MatrixStack matrix = context.getMatrices();
//                drawUsingItem(context, matrix);
                drawMain(context, matrix);
                drawArmor(context, matrix);
                drawFace(context);
            }
        }
    }

    private void drawMain(DrawContext context, MatrixStack matrix) {

        FontRenderer nameFont = Fonts.getSize(16, Fonts.Type.SEMI);
        FontRenderer infoFont = Fonts.getSize(11, Fonts.Type.REGULAR);

        float baseX = getX();
        float baseY = getY();

        float hp = PlayerInteractionHelper.getHealth(lastTarget);
        float maxHp = lastTarget.getMaxHealth();
        float hpPercent = MathHelper.clamp(hp / maxHp, 0f, 1f);

        health = Calculate.interpolateSmooth(0.6f, health, hpPercent);

        float distance = mc.player.distanceTo(lastTarget);
        displayedDistance = Calculate.interpolateSmooth(0.5f, displayedDistance, distance);

        float barMaxWidth = 65f;
        float barWidth = barMaxWidth * health;

        setWidth(120);
        setHeight(42);

        blur.render(ShapeProperties.create(matrix, baseX, baseY, getWidth(), getHeight())
                .round(7)
                .color(new Color(0, 0, 0, 130).getRGB())
                .build());

        rectangle.render(ShapeProperties.create(matrix, baseX, baseY, getWidth(), getHeight())
                .round(7)
                .thickness(1f)
                .outlineColor(new Color(25,25,25,255).getRGB())
                .color(new Color(20,20,22,150).getRGB())
                .build());

        float contentX = baseX + 28;
        float contentY = baseY + 6;

        nameFont.drawString(matrix,
                lastTarget.getName().getString(),
                contentX,
                contentY,
                ColorAssist.getText());

        String distText = String.format("%.1fm", displayedDistance);

        infoFont.drawString(matrix,
                distText,
                contentX,
                contentY + 11,
                new Color(170,170,190,255).getRGB());

        float barY = contentY + 20;

        rectangle.render(ShapeProperties.create(matrix,
                        contentX,
                        barY,
                        barMaxWidth,
                        3)
                .round(2)
                .color(new Color(45,45,45,220).getRGB())
                .build());

        Color hpColor = hpPercent > 0.5f
                ? new Color(80, 200, 120)
                : hpPercent > 0.25f
                ? new Color(255, 170, 0)
                : new Color(255, 70, 70);

        rectangle.render(ShapeProperties.create(matrix,
                        contentX,
                        barY,
                        barWidth,
                        3)
                .round(2)
                .color(hpColor.getRGB())
                .build());

        String hpText = String.format("%.1f HP", hp);

        infoFont.drawString(matrix,
                hpText,
                contentX + barMaxWidth + 5,
                barY - 2,
                new Color(255,255,255,230).getRGB());
    }

    private void drawArmor(DrawContext context, MatrixStack matrix) {
        ItemStack[] slots = new ItemStack[]{
                lastTarget.getMainHandStack(),
                lastTarget.getOffHandStack(),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.HEAD),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.CHEST),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.LEGS),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.FEET)
        };
        float x = getX() + 21f;
        float y = getY() + 17;
        float slotSize = 16 * 0.5F + 2;
        matrix.push();
        matrix.translate(x, y, 0);
        for (int i = 0; i < 6; i++) {
            float currentX = i * 11.5f;

            blur.render(ShapeProperties.create(matrix, currentX - 0.5f, 15F, slotSize + 1, slotSize + 1)
                    .round(3).quality(12)
                    .color(new Color(0, 0, 0, 150).getRGB())
                    .build());

            rectangle.render(ShapeProperties.create(matrix, currentX - 0.5f, 15F, slotSize + 1, slotSize + 1)
                    .round(3)
                    .thickness(0.1f)
                    .outlineColor(new Color(33, 33, 33, 255).getRGB())
                    .color(
                            new Color(18, 19, 20, 75).getRGB(),
                            new Color(0, 2, 5, 75).getRGB(),
                            new Color(0, 2, 5, 75).getRGB(),
                            new Color(18, 19, 20, 75).getRGB())
                    .build());

            if (!slots[i].isEmpty()) {
                Render2D.defaultDrawStack(context, slots[i], currentX, 15.5F, false, false, 0.5F);
            } else {
                String xText = "x";
                FontRenderer font = Fonts.getSize(12, Fonts.Type.DEFAULT);
                float textWidth = font.getStringWidth(xText);
                float textHeight = font.getStringHeight(xText);
                float textX = currentX + (slotSize - textWidth) / 2.0F;
                float textY = 15.5F + (slotSize - textHeight) / 2.0F;
                font.drawString(matrix, xText, textX, textY + 6.25f, new Color(225, 225, 255, 255).getRGB());
            }
        }
        matrix.pop();
    }

    private void drawUsingItem(DrawContext context, MatrixStack matrix) {
        animation.setDirection(lastTarget.isUsingItem() ? Direction.FORWARDS : Direction.BACKWARDS);
        if (!lastTarget.getActiveItem().isEmpty() && lastTarget.getActiveItem().getCount() != 0) {
            lastItem = lastTarget.getActiveItem().getItem();
        }
        if (!animation.isFinished(Direction.BACKWARDS) && !lastItem.equals(Items.AIR)) {
            int size = 24;
            float anim = animation.getOutput().floatValue();
            float progress = (lastTarget.getItemUseTime() + tickCounter.getTickDelta(false)) / ItemTask.maxUseTick(lastItem) * 360;
            float x = getX() - (size + 5) * anim;
            float y = getY() + 4;
            ScissorAssist scissorManager = Rich.getInstance().getScissorManager();
            scissorManager.push(matrix.peek().getPositionMatrix(), getX() - 50, getY(), 50, getHeight());
            Calculate.setAlpha(anim, () -> {
                blur.render(ShapeProperties.create(matrix, x, y, size, size).quality(5)
                        .round(12).softness(1).thickness(2).outlineColor(ColorAssist.getOutline(0)).color(ColorAssist.getRect(0.7F)).build());
                arc.render(ShapeProperties.create(matrix, x, y, size, size).round(0.38F).thickness(0.30f).end(progress)
                        .color(ColorAssist.fade(0), ColorAssist.fade(200), ColorAssist.fade(0), ColorAssist.fade(200)).build());
                Render2D.defaultDrawStack(context, lastItem.getDefaultStack(), x + 3f, y + 3f, false, false, 1f);
            });
            scissorManager.pop();
        }
    }

    private void drawFace(DrawContext context) {

        EntityRenderer<? super LivingEntity, ?> baseRenderer =
                mc.getEntityRenderDispatcher().getRenderer(lastTarget);

        if (!(baseRenderer instanceof LivingEntityRenderer<?, ?, ?>)) {
            return;
        }

        @SuppressWarnings("unchecked")
        LivingEntityRenderer<LivingEntity, LivingEntityRenderState, ?> renderer =
                (LivingEntityRenderer<LivingEntity, LivingEntityRenderState, ?>) baseRenderer;

        LivingEntityRenderState state =
                renderer.getAndUpdateRenderState(lastTarget, tickCounter.getTickDelta(false));

        Identifier textureLocation = renderer.getTexture(state);

        float alpha = faceAlphaAnimation.getOutput().floatValue();

        Calculate.setAlpha(alpha, () -> {

            // фон под лицо
            rectangle.render(ShapeProperties.create(context.getMatrices(),
                            getX() + 4,
                            getY() + 6,
                            22,
                            22)
                    .round(5)
                    .color(new Color(30, 30, 32, 200).getRGB())
                    .build());

            Render2D.drawTexture(context,
                    textureLocation,
                    getX() + 5,
                    getY() + 7,
                    20,
                    20,
                    8,
                    8,
                    64,
                    Color.WHITE.getRGB(),
                    ColorAssist.multRed(-1, 1 + lastTarget.hurtTime / 4F));
        });
    }
}
Посмотреть вложение 329316
че за пиздец.........
 
Всем сап заливаю свой таргетхуд
фууу брух че это:
Expand Collapse Copy
package fun.rich.display.hud;
import fun.rich.Rich;
import fun.rich.utils.interactions.interact.PlayerInteractionHelper;
import fun.rich.utils.math.time.StopWatch;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.client.render.entity.state.LivingEntityRenderState;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import fun.rich.utils.client.managers.api.draggable.AbstractDraggable;
import fun.rich.features.impl.combat.Aura;
import fun.rich.features.impl.render.Hud;
import fun.rich.common.animation.Animation;
import fun.rich.common.animation.Direction;
import fun.rich.common.animation.implement.Decelerate;
import fun.rich.utils.display.font.FontRenderer;
import fun.rich.utils.display.font.Fonts;
import fun.rich.utils.display.shape.ShapeProperties;
import fun.rich.utils.display.color.ColorAssist;
import fun.rich.utils.interactions.item.ItemTask;
import fun.rich.utils.math.calc.Calculate;
import fun.rich.utils.display.geometry.Render2D;
import fun.rich.utils.display.scissor.ScissorAssist;
import fun.rich.utils.client.packet.network.Network;
import java.awt.*;

public class TargetHud extends AbstractDraggable {
    private final Animation animation = new Decelerate().setMs(650).setValue(1);
    private final Animation faceAlphaAnimation = new Decelerate().setMs(125).setValue(1);
    private final StopWatch stopWatch = new StopWatch();
    private final StopWatch distanceUpdateTimer = new StopWatch();
    private LivingEntity lastTarget;
    private Item lastItem = Items.AIR;
    private float health;
    private float absorption;
    private float displayedDistance;

    public TargetHud() {
        super("Target Hud", 10, 80, 100, 36, true);
    }

    @Override
    public boolean visible() {
        return scaleAnimation.isDirection(Direction.FORWARDS);
    }

    @Override
    public void tick() {
        LivingEntity auraTarget = Aura.getInstance().getTarget();
        if (auraTarget != null) {
            lastTarget = auraTarget;
            startAnimation();
            faceAlphaAnimation.setDirection(Direction.FORWARDS);
        } else if (PlayerInteractionHelper.isChat(mc.currentScreen)) {
            lastTarget = mc.player;
            startAnimation();
            faceAlphaAnimation.setDirection(Direction.FORWARDS);
        } else if (stopWatch.finished(500)) {
            stopAnimation();
            faceAlphaAnimation.setDirection(Direction.BACKWARDS);
        }
    }

    @Override
    public void drawDraggable(DrawContext context) {
        if (Hud.getInstance().interfaceSettings.isSelected("Target Hud") && Hud.getInstance().state) {
            if (lastTarget != null) {
                MatrixStack matrix = context.getMatrices();
//                drawUsingItem(context, matrix);
                drawMain(context, matrix);
                drawArmor(context, matrix);
                drawFace(context);
            }
        }
    }

    private void drawMain(DrawContext context, MatrixStack matrix) {

        FontRenderer nameFont = Fonts.getSize(16, Fonts.Type.SEMI);
        FontRenderer infoFont = Fonts.getSize(11, Fonts.Type.REGULAR);

        float baseX = getX();
        float baseY = getY();

        float hp = PlayerInteractionHelper.getHealth(lastTarget);
        float maxHp = lastTarget.getMaxHealth();
        float hpPercent = MathHelper.clamp(hp / maxHp, 0f, 1f);

        health = Calculate.interpolateSmooth(0.6f, health, hpPercent);

        float distance = mc.player.distanceTo(lastTarget);
        displayedDistance = Calculate.interpolateSmooth(0.5f, displayedDistance, distance);

        float barMaxWidth = 65f;
        float barWidth = barMaxWidth * health;

        setWidth(120);
        setHeight(42);

        blur.render(ShapeProperties.create(matrix, baseX, baseY, getWidth(), getHeight())
                .round(7)
                .color(new Color(0, 0, 0, 130).getRGB())
                .build());

        rectangle.render(ShapeProperties.create(matrix, baseX, baseY, getWidth(), getHeight())
                .round(7)
                .thickness(1f)
                .outlineColor(new Color(25,25,25,255).getRGB())
                .color(new Color(20,20,22,150).getRGB())
                .build());

        float contentX = baseX + 28;
        float contentY = baseY + 6;

        nameFont.drawString(matrix,
                lastTarget.getName().getString(),
                contentX,
                contentY,
                ColorAssist.getText());

        String distText = String.format("%.1fm", displayedDistance);

        infoFont.drawString(matrix,
                distText,
                contentX,
                contentY + 11,
                new Color(170,170,190,255).getRGB());

        float barY = contentY + 20;

        rectangle.render(ShapeProperties.create(matrix,
                        contentX,
                        barY,
                        barMaxWidth,
                        3)
                .round(2)
                .color(new Color(45,45,45,220).getRGB())
                .build());

        Color hpColor = hpPercent > 0.5f
                ? new Color(80, 200, 120)
                : hpPercent > 0.25f
                ? new Color(255, 170, 0)
                : new Color(255, 70, 70);

        rectangle.render(ShapeProperties.create(matrix,
                        contentX,
                        barY,
                        barWidth,
                        3)
                .round(2)
                .color(hpColor.getRGB())
                .build());

        String hpText = String.format("%.1f HP", hp);

        infoFont.drawString(matrix,
                hpText,
                contentX + barMaxWidth + 5,
                barY - 2,
                new Color(255,255,255,230).getRGB());
    }

    private void drawArmor(DrawContext context, MatrixStack matrix) {
        ItemStack[] slots = new ItemStack[]{
                lastTarget.getMainHandStack(),
                lastTarget.getOffHandStack(),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.HEAD),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.CHEST),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.LEGS),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.FEET)
        };
        float x = getX() + 21f;
        float y = getY() + 17;
        float slotSize = 16 * 0.5F + 2;
        matrix.push();
        matrix.translate(x, y, 0);
        for (int i = 0; i < 6; i++) {
            float currentX = i * 11.5f;

            blur.render(ShapeProperties.create(matrix, currentX - 0.5f, 15F, slotSize + 1, slotSize + 1)
                    .round(3).quality(12)
                    .color(new Color(0, 0, 0, 150).getRGB())
                    .build());

            rectangle.render(ShapeProperties.create(matrix, currentX - 0.5f, 15F, slotSize + 1, slotSize + 1)
                    .round(3)
                    .thickness(0.1f)
                    .outlineColor(new Color(33, 33, 33, 255).getRGB())
                    .color(
                            new Color(18, 19, 20, 75).getRGB(),
                            new Color(0, 2, 5, 75).getRGB(),
                            new Color(0, 2, 5, 75).getRGB(),
                            new Color(18, 19, 20, 75).getRGB())
                    .build());

            if (!slots[i].isEmpty()) {
                Render2D.defaultDrawStack(context, slots[i], currentX, 15.5F, false, false, 0.5F);
            } else {
                String xText = "x";
                FontRenderer font = Fonts.getSize(12, Fonts.Type.DEFAULT);
                float textWidth = font.getStringWidth(xText);
                float textHeight = font.getStringHeight(xText);
                float textX = currentX + (slotSize - textWidth) / 2.0F;
                float textY = 15.5F + (slotSize - textHeight) / 2.0F;
                font.drawString(matrix, xText, textX, textY + 6.25f, new Color(225, 225, 255, 255).getRGB());
            }
        }
        matrix.pop();
    }

    private void drawUsingItem(DrawContext context, MatrixStack matrix) {
        animation.setDirection(lastTarget.isUsingItem() ? Direction.FORWARDS : Direction.BACKWARDS);
        if (!lastTarget.getActiveItem().isEmpty() && lastTarget.getActiveItem().getCount() != 0) {
            lastItem = lastTarget.getActiveItem().getItem();
        }
        if (!animation.isFinished(Direction.BACKWARDS) && !lastItem.equals(Items.AIR)) {
            int size = 24;
            float anim = animation.getOutput().floatValue();
            float progress = (lastTarget.getItemUseTime() + tickCounter.getTickDelta(false)) / ItemTask.maxUseTick(lastItem) * 360;
            float x = getX() - (size + 5) * anim;
            float y = getY() + 4;
            ScissorAssist scissorManager = Rich.getInstance().getScissorManager();
            scissorManager.push(matrix.peek().getPositionMatrix(), getX() - 50, getY(), 50, getHeight());
            Calculate.setAlpha(anim, () -> {
                blur.render(ShapeProperties.create(matrix, x, y, size, size).quality(5)
                        .round(12).softness(1).thickness(2).outlineColor(ColorAssist.getOutline(0)).color(ColorAssist.getRect(0.7F)).build());
                arc.render(ShapeProperties.create(matrix, x, y, size, size).round(0.38F).thickness(0.30f).end(progress)
                        .color(ColorAssist.fade(0), ColorAssist.fade(200), ColorAssist.fade(0), ColorAssist.fade(200)).build());
                Render2D.defaultDrawStack(context, lastItem.getDefaultStack(), x + 3f, y + 3f, false, false, 1f);
            });
            scissorManager.pop();
        }
    }

    private void drawFace(DrawContext context) {

        EntityRenderer<? super LivingEntity, ?> baseRenderer =
                mc.getEntityRenderDispatcher().getRenderer(lastTarget);

        if (!(baseRenderer instanceof LivingEntityRenderer<?, ?, ?>)) {
            return;
        }

        @SuppressWarnings("unchecked")
        LivingEntityRenderer<LivingEntity, LivingEntityRenderState, ?> renderer =
                (LivingEntityRenderer<LivingEntity, LivingEntityRenderState, ?>) baseRenderer;

        LivingEntityRenderState state =
                renderer.getAndUpdateRenderState(lastTarget, tickCounter.getTickDelta(false));

        Identifier textureLocation = renderer.getTexture(state);

        float alpha = faceAlphaAnimation.getOutput().floatValue();

        Calculate.setAlpha(alpha, () -> {

            // фон под лицо
            rectangle.render(ShapeProperties.create(context.getMatrices(),
                            getX() + 4,
                            getY() + 6,
                            22,
                            22)
                    .round(5)
                    .color(new Color(30, 30, 32, 200).getRGB())
                    .build());

            Render2D.drawTexture(context,
                    textureLocation,
                    getX() + 5,
                    getY() + 7,
                    20,
                    20,
                    8,
                    8,
                    64,
                    Color.WHITE.getRGB(),
                    ColorAssist.multRed(-1, 1 + lastTarget.hurtTime / 4F));
        });
    }
}
Посмотреть вложение 329316
после данной темы у меня отпало желание чё нахуй
 
Всем сап заливаю свой таргетхуд
фууу брух че это:
Expand Collapse Copy
package fun.rich.display.hud;
import fun.rich.Rich;
import fun.rich.utils.interactions.interact.PlayerInteractionHelper;
import fun.rich.utils.math.time.StopWatch;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.client.render.entity.state.LivingEntityRenderState;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import fun.rich.utils.client.managers.api.draggable.AbstractDraggable;
import fun.rich.features.impl.combat.Aura;
import fun.rich.features.impl.render.Hud;
import fun.rich.common.animation.Animation;
import fun.rich.common.animation.Direction;
import fun.rich.common.animation.implement.Decelerate;
import fun.rich.utils.display.font.FontRenderer;
import fun.rich.utils.display.font.Fonts;
import fun.rich.utils.display.shape.ShapeProperties;
import fun.rich.utils.display.color.ColorAssist;
import fun.rich.utils.interactions.item.ItemTask;
import fun.rich.utils.math.calc.Calculate;
import fun.rich.utils.display.geometry.Render2D;
import fun.rich.utils.display.scissor.ScissorAssist;
import fun.rich.utils.client.packet.network.Network;
import java.awt.*;

public class TargetHud extends AbstractDraggable {
    private final Animation animation = new Decelerate().setMs(650).setValue(1);
    private final Animation faceAlphaAnimation = new Decelerate().setMs(125).setValue(1);
    private final StopWatch stopWatch = new StopWatch();
    private final StopWatch distanceUpdateTimer = new StopWatch();
    private LivingEntity lastTarget;
    private Item lastItem = Items.AIR;
    private float health;
    private float absorption;
    private float displayedDistance;

    public TargetHud() {
        super("Target Hud", 10, 80, 100, 36, true);
    }

    @Override
    public boolean visible() {
        return scaleAnimation.isDirection(Direction.FORWARDS);
    }

    @Override
    public void tick() {
        LivingEntity auraTarget = Aura.getInstance().getTarget();
        if (auraTarget != null) {
            lastTarget = auraTarget;
            startAnimation();
            faceAlphaAnimation.setDirection(Direction.FORWARDS);
        } else if (PlayerInteractionHelper.isChat(mc.currentScreen)) {
            lastTarget = mc.player;
            startAnimation();
            faceAlphaAnimation.setDirection(Direction.FORWARDS);
        } else if (stopWatch.finished(500)) {
            stopAnimation();
            faceAlphaAnimation.setDirection(Direction.BACKWARDS);
        }
    }

    @Override
    public void drawDraggable(DrawContext context) {
        if (Hud.getInstance().interfaceSettings.isSelected("Target Hud") && Hud.getInstance().state) {
            if (lastTarget != null) {
                MatrixStack matrix = context.getMatrices();
//                drawUsingItem(context, matrix);
                drawMain(context, matrix);
                drawArmor(context, matrix);
                drawFace(context);
            }
        }
    }

    private void drawMain(DrawContext context, MatrixStack matrix) {

        FontRenderer nameFont = Fonts.getSize(16, Fonts.Type.SEMI);
        FontRenderer infoFont = Fonts.getSize(11, Fonts.Type.REGULAR);

        float baseX = getX();
        float baseY = getY();

        float hp = PlayerInteractionHelper.getHealth(lastTarget);
        float maxHp = lastTarget.getMaxHealth();
        float hpPercent = MathHelper.clamp(hp / maxHp, 0f, 1f);

        health = Calculate.interpolateSmooth(0.6f, health, hpPercent);

        float distance = mc.player.distanceTo(lastTarget);
        displayedDistance = Calculate.interpolateSmooth(0.5f, displayedDistance, distance);

        float barMaxWidth = 65f;
        float barWidth = barMaxWidth * health;

        setWidth(120);
        setHeight(42);

        blur.render(ShapeProperties.create(matrix, baseX, baseY, getWidth(), getHeight())
                .round(7)
                .color(new Color(0, 0, 0, 130).getRGB())
                .build());

        rectangle.render(ShapeProperties.create(matrix, baseX, baseY, getWidth(), getHeight())
                .round(7)
                .thickness(1f)
                .outlineColor(new Color(25,25,25,255).getRGB())
                .color(new Color(20,20,22,150).getRGB())
                .build());

        float contentX = baseX + 28;
        float contentY = baseY + 6;

        nameFont.drawString(matrix,
                lastTarget.getName().getString(),
                contentX,
                contentY,
                ColorAssist.getText());

        String distText = String.format("%.1fm", displayedDistance);

        infoFont.drawString(matrix,
                distText,
                contentX,
                contentY + 11,
                new Color(170,170,190,255).getRGB());

        float barY = contentY + 20;

        rectangle.render(ShapeProperties.create(matrix,
                        contentX,
                        barY,
                        barMaxWidth,
                        3)
                .round(2)
                .color(new Color(45,45,45,220).getRGB())
                .build());

        Color hpColor = hpPercent > 0.5f
                ? new Color(80, 200, 120)
                : hpPercent > 0.25f
                ? new Color(255, 170, 0)
                : new Color(255, 70, 70);

        rectangle.render(ShapeProperties.create(matrix,
                        contentX,
                        barY,
                        barWidth,
                        3)
                .round(2)
                .color(hpColor.getRGB())
                .build());

        String hpText = String.format("%.1f HP", hp);

        infoFont.drawString(matrix,
                hpText,
                contentX + barMaxWidth + 5,
                barY - 2,
                new Color(255,255,255,230).getRGB());
    }

    private void drawArmor(DrawContext context, MatrixStack matrix) {
        ItemStack[] slots = new ItemStack[]{
                lastTarget.getMainHandStack(),
                lastTarget.getOffHandStack(),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.HEAD),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.CHEST),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.LEGS),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.FEET)
        };
        float x = getX() + 21f;
        float y = getY() + 17;
        float slotSize = 16 * 0.5F + 2;
        matrix.push();
        matrix.translate(x, y, 0);
        for (int i = 0; i < 6; i++) {
            float currentX = i * 11.5f;

            blur.render(ShapeProperties.create(matrix, currentX - 0.5f, 15F, slotSize + 1, slotSize + 1)
                    .round(3).quality(12)
                    .color(new Color(0, 0, 0, 150).getRGB())
                    .build());

            rectangle.render(ShapeProperties.create(matrix, currentX - 0.5f, 15F, slotSize + 1, slotSize + 1)
                    .round(3)
                    .thickness(0.1f)
                    .outlineColor(new Color(33, 33, 33, 255).getRGB())
                    .color(
                            new Color(18, 19, 20, 75).getRGB(),
                            new Color(0, 2, 5, 75).getRGB(),
                            new Color(0, 2, 5, 75).getRGB(),
                            new Color(18, 19, 20, 75).getRGB())
                    .build());

            if (!slots[i].isEmpty()) {
                Render2D.defaultDrawStack(context, slots[i], currentX, 15.5F, false, false, 0.5F);
            } else {
                String xText = "x";
                FontRenderer font = Fonts.getSize(12, Fonts.Type.DEFAULT);
                float textWidth = font.getStringWidth(xText);
                float textHeight = font.getStringHeight(xText);
                float textX = currentX + (slotSize - textWidth) / 2.0F;
                float textY = 15.5F + (slotSize - textHeight) / 2.0F;
                font.drawString(matrix, xText, textX, textY + 6.25f, new Color(225, 225, 255, 255).getRGB());
            }
        }
        matrix.pop();
    }

    private void drawUsingItem(DrawContext context, MatrixStack matrix) {
        animation.setDirection(lastTarget.isUsingItem() ? Direction.FORWARDS : Direction.BACKWARDS);
        if (!lastTarget.getActiveItem().isEmpty() && lastTarget.getActiveItem().getCount() != 0) {
            lastItem = lastTarget.getActiveItem().getItem();
        }
        if (!animation.isFinished(Direction.BACKWARDS) && !lastItem.equals(Items.AIR)) {
            int size = 24;
            float anim = animation.getOutput().floatValue();
            float progress = (lastTarget.getItemUseTime() + tickCounter.getTickDelta(false)) / ItemTask.maxUseTick(lastItem) * 360;
            float x = getX() - (size + 5) * anim;
            float y = getY() + 4;
            ScissorAssist scissorManager = Rich.getInstance().getScissorManager();
            scissorManager.push(matrix.peek().getPositionMatrix(), getX() - 50, getY(), 50, getHeight());
            Calculate.setAlpha(anim, () -> {
                blur.render(ShapeProperties.create(matrix, x, y, size, size).quality(5)
                        .round(12).softness(1).thickness(2).outlineColor(ColorAssist.getOutline(0)).color(ColorAssist.getRect(0.7F)).build());
                arc.render(ShapeProperties.create(matrix, x, y, size, size).round(0.38F).thickness(0.30f).end(progress)
                        .color(ColorAssist.fade(0), ColorAssist.fade(200), ColorAssist.fade(0), ColorAssist.fade(200)).build());
                Render2D.defaultDrawStack(context, lastItem.getDefaultStack(), x + 3f, y + 3f, false, false, 1f);
            });
            scissorManager.pop();
        }
    }

    private void drawFace(DrawContext context) {

        EntityRenderer<? super LivingEntity, ?> baseRenderer =
                mc.getEntityRenderDispatcher().getRenderer(lastTarget);

        if (!(baseRenderer instanceof LivingEntityRenderer<?, ?, ?>)) {
            return;
        }

        @SuppressWarnings("unchecked")
        LivingEntityRenderer<LivingEntity, LivingEntityRenderState, ?> renderer =
                (LivingEntityRenderer<LivingEntity, LivingEntityRenderState, ?>) baseRenderer;

        LivingEntityRenderState state =
                renderer.getAndUpdateRenderState(lastTarget, tickCounter.getTickDelta(false));

        Identifier textureLocation = renderer.getTexture(state);

        float alpha = faceAlphaAnimation.getOutput().floatValue();

        Calculate.setAlpha(alpha, () -> {

            // фон под лицо
            rectangle.render(ShapeProperties.create(context.getMatrices(),
                            getX() + 4,
                            getY() + 6,
                            22,
                            22)
                    .round(5)
                    .color(new Color(30, 30, 32, 200).getRGB())
                    .build());

            Render2D.drawTexture(context,
                    textureLocation,
                    getX() + 5,
                    getY() + 7,
                    20,
                    20,
                    8,
                    8,
                    64,
                    Color.WHITE.getRGB(),
                    ColorAssist.multRed(-1, 1 + lastTarget.hurtTime / 4F));
        });
    }
}
Посмотреть вложение 329316
в ебало вбили гвозди почему голова кривая такая?? что за крестики что за полоска ублюдская
не друг это очень хуево скорее всего GPT
 
Всем сап заливаю свой таргетхуд
фууу брух че это:
Expand Collapse Copy
package fun.rich.display.hud;
import fun.rich.Rich;
import fun.rich.utils.interactions.interact.PlayerInteractionHelper;
import fun.rich.utils.math.time.StopWatch;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.client.render.entity.state.LivingEntityRenderState;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import fun.rich.utils.client.managers.api.draggable.AbstractDraggable;
import fun.rich.features.impl.combat.Aura;
import fun.rich.features.impl.render.Hud;
import fun.rich.common.animation.Animation;
import fun.rich.common.animation.Direction;
import fun.rich.common.animation.implement.Decelerate;
import fun.rich.utils.display.font.FontRenderer;
import fun.rich.utils.display.font.Fonts;
import fun.rich.utils.display.shape.ShapeProperties;
import fun.rich.utils.display.color.ColorAssist;
import fun.rich.utils.interactions.item.ItemTask;
import fun.rich.utils.math.calc.Calculate;
import fun.rich.utils.display.geometry.Render2D;
import fun.rich.utils.display.scissor.ScissorAssist;
import fun.rich.utils.client.packet.network.Network;
import java.awt.*;

public class TargetHud extends AbstractDraggable {
    private final Animation animation = new Decelerate().setMs(650).setValue(1);
    private final Animation faceAlphaAnimation = new Decelerate().setMs(125).setValue(1);
    private final StopWatch stopWatch = new StopWatch();
    private final StopWatch distanceUpdateTimer = new StopWatch();
    private LivingEntity lastTarget;
    private Item lastItem = Items.AIR;
    private float health;
    private float absorption;
    private float displayedDistance;

    public TargetHud() {
        super("Target Hud", 10, 80, 100, 36, true);
    }

    @Override
    public boolean visible() {
        return scaleAnimation.isDirection(Direction.FORWARDS);
    }

    @Override
    public void tick() {
        LivingEntity auraTarget = Aura.getInstance().getTarget();
        if (auraTarget != null) {
            lastTarget = auraTarget;
            startAnimation();
            faceAlphaAnimation.setDirection(Direction.FORWARDS);
        } else if (PlayerInteractionHelper.isChat(mc.currentScreen)) {
            lastTarget = mc.player;
            startAnimation();
            faceAlphaAnimation.setDirection(Direction.FORWARDS);
        } else if (stopWatch.finished(500)) {
            stopAnimation();
            faceAlphaAnimation.setDirection(Direction.BACKWARDS);
        }
    }

    @Override
    public void drawDraggable(DrawContext context) {
        if (Hud.getInstance().interfaceSettings.isSelected("Target Hud") && Hud.getInstance().state) {
            if (lastTarget != null) {
                MatrixStack matrix = context.getMatrices();
//                drawUsingItem(context, matrix);
                drawMain(context, matrix);
                drawArmor(context, matrix);
                drawFace(context);
            }
        }
    }

    private void drawMain(DrawContext context, MatrixStack matrix) {

        FontRenderer nameFont = Fonts.getSize(16, Fonts.Type.SEMI);
        FontRenderer infoFont = Fonts.getSize(11, Fonts.Type.REGULAR);

        float baseX = getX();
        float baseY = getY();

        float hp = PlayerInteractionHelper.getHealth(lastTarget);
        float maxHp = lastTarget.getMaxHealth();
        float hpPercent = MathHelper.clamp(hp / maxHp, 0f, 1f);

        health = Calculate.interpolateSmooth(0.6f, health, hpPercent);

        float distance = mc.player.distanceTo(lastTarget);
        displayedDistance = Calculate.interpolateSmooth(0.5f, displayedDistance, distance);

        float barMaxWidth = 65f;
        float barWidth = barMaxWidth * health;

        setWidth(120);
        setHeight(42);

        blur.render(ShapeProperties.create(matrix, baseX, baseY, getWidth(), getHeight())
                .round(7)
                .color(new Color(0, 0, 0, 130).getRGB())
                .build());

        rectangle.render(ShapeProperties.create(matrix, baseX, baseY, getWidth(), getHeight())
                .round(7)
                .thickness(1f)
                .outlineColor(new Color(25,25,25,255).getRGB())
                .color(new Color(20,20,22,150).getRGB())
                .build());

        float contentX = baseX + 28;
        float contentY = baseY + 6;

        nameFont.drawString(matrix,
                lastTarget.getName().getString(),
                contentX,
                contentY,
                ColorAssist.getText());

        String distText = String.format("%.1fm", displayedDistance);

        infoFont.drawString(matrix,
                distText,
                contentX,
                contentY + 11,
                new Color(170,170,190,255).getRGB());

        float barY = contentY + 20;

        rectangle.render(ShapeProperties.create(matrix,
                        contentX,
                        barY,
                        barMaxWidth,
                        3)
                .round(2)
                .color(new Color(45,45,45,220).getRGB())
                .build());

        Color hpColor = hpPercent > 0.5f
                ? new Color(80, 200, 120)
                : hpPercent > 0.25f
                ? new Color(255, 170, 0)
                : new Color(255, 70, 70);

        rectangle.render(ShapeProperties.create(matrix,
                        contentX,
                        barY,
                        barWidth,
                        3)
                .round(2)
                .color(hpColor.getRGB())
                .build());

        String hpText = String.format("%.1f HP", hp);

        infoFont.drawString(matrix,
                hpText,
                contentX + barMaxWidth + 5,
                barY - 2,
                new Color(255,255,255,230).getRGB());
    }

    private void drawArmor(DrawContext context, MatrixStack matrix) {
        ItemStack[] slots = new ItemStack[]{
                lastTarget.getMainHandStack(),
                lastTarget.getOffHandStack(),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.HEAD),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.CHEST),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.LEGS),
                lastTarget.getEquippedStack(net.minecraft.entity.EquipmentSlot.FEET)
        };
        float x = getX() + 21f;
        float y = getY() + 17;
        float slotSize = 16 * 0.5F + 2;
        matrix.push();
        matrix.translate(x, y, 0);
        for (int i = 0; i < 6; i++) {
            float currentX = i * 11.5f;

            blur.render(ShapeProperties.create(matrix, currentX - 0.5f, 15F, slotSize + 1, slotSize + 1)
                    .round(3).quality(12)
                    .color(new Color(0, 0, 0, 150).getRGB())
                    .build());

            rectangle.render(ShapeProperties.create(matrix, currentX - 0.5f, 15F, slotSize + 1, slotSize + 1)
                    .round(3)
                    .thickness(0.1f)
                    .outlineColor(new Color(33, 33, 33, 255).getRGB())
                    .color(
                            new Color(18, 19, 20, 75).getRGB(),
                            new Color(0, 2, 5, 75).getRGB(),
                            new Color(0, 2, 5, 75).getRGB(),
                            new Color(18, 19, 20, 75).getRGB())
                    .build());

            if (!slots[i].isEmpty()) {
                Render2D.defaultDrawStack(context, slots[i], currentX, 15.5F, false, false, 0.5F);
            } else {
                String xText = "x";
                FontRenderer font = Fonts.getSize(12, Fonts.Type.DEFAULT);
                float textWidth = font.getStringWidth(xText);
                float textHeight = font.getStringHeight(xText);
                float textX = currentX + (slotSize - textWidth) / 2.0F;
                float textY = 15.5F + (slotSize - textHeight) / 2.0F;
                font.drawString(matrix, xText, textX, textY + 6.25f, new Color(225, 225, 255, 255).getRGB());
            }
        }
        matrix.pop();
    }

    private void drawUsingItem(DrawContext context, MatrixStack matrix) {
        animation.setDirection(lastTarget.isUsingItem() ? Direction.FORWARDS : Direction.BACKWARDS);
        if (!lastTarget.getActiveItem().isEmpty() && lastTarget.getActiveItem().getCount() != 0) {
            lastItem = lastTarget.getActiveItem().getItem();
        }
        if (!animation.isFinished(Direction.BACKWARDS) && !lastItem.equals(Items.AIR)) {
            int size = 24;
            float anim = animation.getOutput().floatValue();
            float progress = (lastTarget.getItemUseTime() + tickCounter.getTickDelta(false)) / ItemTask.maxUseTick(lastItem) * 360;
            float x = getX() - (size + 5) * anim;
            float y = getY() + 4;
            ScissorAssist scissorManager = Rich.getInstance().getScissorManager();
            scissorManager.push(matrix.peek().getPositionMatrix(), getX() - 50, getY(), 50, getHeight());
            Calculate.setAlpha(anim, () -> {
                blur.render(ShapeProperties.create(matrix, x, y, size, size).quality(5)
                        .round(12).softness(1).thickness(2).outlineColor(ColorAssist.getOutline(0)).color(ColorAssist.getRect(0.7F)).build());
                arc.render(ShapeProperties.create(matrix, x, y, size, size).round(0.38F).thickness(0.30f).end(progress)
                        .color(ColorAssist.fade(0), ColorAssist.fade(200), ColorAssist.fade(0), ColorAssist.fade(200)).build());
                Render2D.defaultDrawStack(context, lastItem.getDefaultStack(), x + 3f, y + 3f, false, false, 1f);
            });
            scissorManager.pop();
        }
    }

    private void drawFace(DrawContext context) {

        EntityRenderer<? super LivingEntity, ?> baseRenderer =
                mc.getEntityRenderDispatcher().getRenderer(lastTarget);

        if (!(baseRenderer instanceof LivingEntityRenderer<?, ?, ?>)) {
            return;
        }

        @SuppressWarnings("unchecked")
        LivingEntityRenderer<LivingEntity, LivingEntityRenderState, ?> renderer =
                (LivingEntityRenderer<LivingEntity, LivingEntityRenderState, ?>) baseRenderer;

        LivingEntityRenderState state =
                renderer.getAndUpdateRenderState(lastTarget, tickCounter.getTickDelta(false));

        Identifier textureLocation = renderer.getTexture(state);

        float alpha = faceAlphaAnimation.getOutput().floatValue();

        Calculate.setAlpha(alpha, () -> {

            // фон под лицо
            rectangle.render(ShapeProperties.create(context.getMatrices(),
                            getX() + 4,
                            getY() + 6,
                            22,
                            22)
                    .round(5)
                    .color(new Color(30, 30, 32, 200).getRGB())
                    .build());

            Render2D.drawTexture(context,
                    textureLocation,
                    getX() + 5,
                    getY() + 7,
                    20,
                    20,
                    8,
                    8,
                    64,
                    Color.WHITE.getRGB(),
                    ColorAssist.multRed(-1, 1 + lastTarget.hurtTime / 4F));
        });
    }
}
Посмотреть вложение 329316/del хуйня
 

Похожие темы

Назад
Сверху Снизу