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

TargetHud | Таргет худ | Expensive 3.1 ready | 3.1 READY

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
3 Окт 2022
Сообщения
227
Реакции
1
Сделал тх за минут 5-10, не больше, думаю многим зайдет.


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




TargetInfoRenderer:
Expand Collapse Copy
ывpackage im.NeverBels.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import im.NeverBels.NeverBels;
import im.NeverBels.events.EventDisplay;
import im.NeverBels.functions.impl.render.HUD;
import im.NeverBels.ui.display.elementRenderer;
import im.NeverBels.ui.styles.Style;
import im.NeverBels.utils.animations.Animation;
import im.NeverBels.utils.animations.Direction;
import im.NeverBels.utils.animations.impl.EaseBackIn;
import im.NeverBels.utils.drag.Dragging;
import im.NeverBels.utils.math.MathUtil;
import im.NeverBels.utils.math.StopWatch;
import im.NeverBels.utils.math.Vector4i;
import im.NeverBels.utils.render.ColorUtils;
import im.NeverBels.utils.render.DisplayUtils;
import im.NeverBels.utils.render.Scissor;
import im.NeverBels.utils.render.Stencil;
import im.NeverBels.utils.render.font.Fonts;
import lombok.AccessLevel;
import lombok.experimental.FieldDefaults;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.scoreboard.Score;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.util.text.TextFormatting;
import org.lwjgl.opengl.GL11;

@FieldDefaults(level = AccessLevel.PRIVATE)
public class TargetInfoRenderer12 implements elementRenderer {
    final StopWatch stopWatch = new StopWatch();
    final Dragging drag;
    LivingEntity entity = null;
    boolean shouldToBack;
    final Animation animation = new EaseBackIn(400, 1, 1);
    float healthAnimation = 0.0f, absorptionAnimation = 0.0f;
    float healthAnimation2 = 0.0f, absorptionAnimation2 = 0.0f;
    float posX, posY;

    static final float width = 102;
    static final float height = 38;
    static final float spacing = 4;
    static final float rounding = 4;
    static final float headSize = 22;

    public TargetInfoRenderer12(Dragging drag) {
        this.drag = drag;
    }

    @Override
    public void render(EventDisplay eventDisplay) {
        posX = drag.getX();
        posY = drag.getY();
        entity = getTarget(entity);
        boolean backAnimation = !shouldToBack || stopWatch.isReached(1000);
        animation.setDuration(backAnimation ?500 : 700);
        animation.setDirection(backAnimation ? Direction.BACKWARDS : Direction.FORWARDS);

        if (animation.getOutput() == 0.0f) {
            entity = null;
        }

        if (entity != null) {
            drag.setWidth(width);
            drag.setHeight(height);

            float health = fix1000Health(entity.getHealth());
            float maxHealth = MathHelper.clamp(entity.getMaxHealth(), 0, 24);
            float maxHealth2 = MathHelper.clamp(entity.getMaxHealth(), 0, 26);

            healthAnimation = MathUtil.fast(healthAnimation,
                    MathHelper.clamp(health / maxHealth, 0, 1), 2);
            absorptionAnimation = MathUtil.fast(absorptionAnimation,
                    MathHelper.clamp(entity.getAbsorptionAmount() / maxHealth, 0, 1), 2);

            healthAnimation2 = MathUtil.fast(healthAnimation2,        MathHelper.clamp(health / (maxHealth2 / 8), 0, 1), 1);
            absorptionAnimation2 = MathUtil.fast(absorptionAnimation2,        MathHelper.clamp(entity.getAbsorptionAmount() / (maxHealth2 / 4), 0, 1), 1);

            GlStateManager.pushMatrix();
            setSizeAnimation(animation.getOutput());
            drawBackGround(rounding);
            renderTextThatDisplaysTargetInfo(eventDisplay.getMatrixStack());
            drawTargetHead(entity, posX +  spacing, posY + spacing+2, headSize, headSize);
            renderHealthBar();
            GlStateManager.popMatrix();
        }
    }

    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity auraTarget = NeverBels.getInstance().getFunctionRegistry().getKillAura().getTarget();
        LivingEntity target = nullTarget;
        if (auraTarget != null) {
            stopWatch.reset();
            shouldToBack = true;
            target = auraTarget;
        } else if (mc.currentScreen instanceof ChatScreen) {
            stopWatch.reset();
            shouldToBack = true;
            target = mc.player;
        } else {
            shouldToBack = false;
        }
        return target;
    }

    public void drawTargetHead(LivingEntity entity, float x, float y, float width, float height) {
        if (entity != null) {
            EntityRenderer<? super LivingEntity> rendererManager = mc.getRenderManager().getRenderer(entity);
            drawFace(rendererManager.getEntityTexture(entity), x, y-3, 8F, 8F, 8F, 8F, width, height, 64F, 64F, entity);
        }
    }
    private void renderHealthBar() {
        Style style = NeverBels.getInstance().getStyleManager().getCurrentStyle();
        Vector4i vector4i = new Vector4i(HUD.getColor(0), HUD.getColor(90), HUD.getColor(180), HUD.getColor(170));
        DisplayUtils.drawRoundedRect(posX + 34 + headSize + spacing -32 + spacing, posY - 5.5f + height - spacing * 1 - 2, (width - 38) * healthAnimation, 3.5f, new Vector4f(3,3,3,3), (ColorUtils.setAlpha(ColorUtils.getColor(1), 255)));
    }


    private void renderTextThatDisplaysTargetInfo(MatrixStack matrixStack) {
        Style style = NeverBels.getInstance().getStyleManager().getCurrentStyle();
        float animationValue = (float) animation.getOutput();
        float halfAnimationValueRest = (1 - animationValue) / 2f;
        float testX = posX + (width * halfAnimationValueRest);
        float testY = posY + (height * halfAnimationValueRest);
        float testW = width * animationValue;
        float testH = height * animationValue;
        drawStyledRect(posX, posY, width, height, rounding, 195);
        //рендерится голова
        Stencil.initStencilToWrite();
        DisplayUtils.drawRoundedRect(posX + spacing, posY + spacing + 1, headSize, headSize,2, style.getSecondColor().getRGB() );
        Stencil.readStencilBuffer(1);
        drawTargetHead(entity, posX + spacing, posY + spacing + 2, headSize, headSize);
        Stencil.uninitStencilBuffer();
        Scissor.push();
        Scissor.setFromComponentCoordinates(testX, testY, testW - 1, testH);
        String hpText = "";
        if (entity.isInvisible() && userConnectedToFunTimeAndEntityIsPlayer()) {
            hpText = "Неизвестно";
        } else {
            float health = (float) MathUtil.round(healthAnimation * 20.0f, 0.1f);
            hpText = health * 5 + "%";
}

        Fonts.sfMedium.drawText(matrixStack, TextFormatting.getTextWithoutFormattingCodes(entity.getName().getString()), posX + 10 + headSize + spacing + spacing, posY + 2 + spacing + 1, -1, 8);
        Fonts.sfMedium.drawText(matrixStack, hpText, posX + 20 + headSize + spacing + spacing,
                posY + 5 + spacing + 1 + spacing + spacing, ColorUtils.rgba(255, 255, 255, 255), 6.5F);
        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/heart.png"), posX + 140 * healthAnimation2 / 1.5f , posY + 17 , 7, 7,ColorUtils.rgba(255,255,255,255));

        Scissor.unset();
        Scissor.pop();
    }


    public void setSizeAnimation(double scale) {
        GlStateManager.translated(posX + (width / 2), posY + (height / 2), 0);
        GlStateManager.scaled(scale, scale, scale);
        GlStateManager.translated(-(posX + (width / 2)), -(posY + (height / 2)), 0);
    }

    public void drawFace(ResourceLocation res, float d,
                         float y,
                         float u,
                         float v,
                         float uWidth,
                         float vHeight,
                         float width,
                         float height,
                         float tileWidth,
                         float tileHeight,
                         LivingEntity target) {
        GL11.glPushMatrix();
        GL11.glEnable(GL11.GL_BLEND);
        mc.getTextureManager().bindTexture(res);
        float hurtPercent = (target.hurtTime - (target.hurtTime != 0 ? mc.timer.renderPartialTicks : 0.0f)) / 8.0f;
        GL11.glColor4f(1, 1 - hurtPercent, 1 - hurtPercent, 1);
        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/hud/steve.png"), posX + 6 , posY + 6 , 24, 25,ColorUtils.rgba(255,255,255,255));
        GL11.glColor4f(1, 1, 1, 1);
        GL11.glPopMatrix();
    }

    private float fix1000Health(float original) {
        Score score = mc.world.getScoreboard().getOrCreateScore(entity.getScoreboardName(),
                mc.world.getScoreboard().getObjectiveInDisplaySlot(2));

        return userConnectedToFunTimeAndEntityIsPlayer() ? score.getScorePoints() : original;
    }


    private boolean userConnectedToFunTimeAndEntityIsPlayer() {
        String header = mc.ingameGUI.getTabList().header == null ? " " : mc.ingameGUI.getTabList().header.getString().toLowerCase();
        return (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.contains("funtime")
                && (header.contains("анархия") || header.contains("гриферский")) && entity instanceof PlayerEntity);
    }

    private void drawBackGround(float radius) {
        Vector4i vector4i = new Vector4i(HUD.getColor(50), HUD.getColor(160), HUD.getColor(100), HUD.getColor(80));
       // DisplayUtils.drawRoundedRect(posX + 1, posY + 1, width - 2, height - 2, radius, ColorUtils.rgba(0, 0, 0, 125));
        DisplayUtils.drawRoundedRect(posX + 2, posY + 1, 100.5f, 35, radius, (ColorUtils.rgba(25, 30, 30, 125)));


        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/hud/gradline.png"), posX + 15.5f, posY + 16 , width - 19, 1,ColorUtils.rgba(255,255,255,170));
}
    private void drawStyledRect(float x,
                                float y,
                                float width,
                                float height,
                                float radius, int alpha) {


    }
}
 
Сделал тх за минут 5-10, не больше, думаю многим зайдет.


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




TargetInfoRenderer:
Expand Collapse Copy
ывpackage im.NeverBels.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import im.NeverBels.NeverBels;
import im.NeverBels.events.EventDisplay;
import im.NeverBels.functions.impl.render.HUD;
import im.NeverBels.ui.display.elementRenderer;
import im.NeverBels.ui.styles.Style;
import im.NeverBels.utils.animations.Animation;
import im.NeverBels.utils.animations.Direction;
import im.NeverBels.utils.animations.impl.EaseBackIn;
import im.NeverBels.utils.drag.Dragging;
import im.NeverBels.utils.math.MathUtil;
import im.NeverBels.utils.math.StopWatch;
import im.NeverBels.utils.math.Vector4i;
import im.NeverBels.utils.render.ColorUtils;
import im.NeverBels.utils.render.DisplayUtils;
import im.NeverBels.utils.render.Scissor;
import im.NeverBels.utils.render.Stencil;
import im.NeverBels.utils.render.font.Fonts;
import lombok.AccessLevel;
import lombok.experimental.FieldDefaults;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.scoreboard.Score;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.util.text.TextFormatting;
import org.lwjgl.opengl.GL11;

@FieldDefaults(level = AccessLevel.PRIVATE)
public class TargetInfoRenderer12 implements elementRenderer {
    final StopWatch stopWatch = new StopWatch();
    final Dragging drag;
    LivingEntity entity = null;
    boolean shouldToBack;
    final Animation animation = new EaseBackIn(400, 1, 1);
    float healthAnimation = 0.0f, absorptionAnimation = 0.0f;
    float healthAnimation2 = 0.0f, absorptionAnimation2 = 0.0f;
    float posX, posY;

    static final float width = 102;
    static final float height = 38;
    static final float spacing = 4;
    static final float rounding = 4;
    static final float headSize = 22;

    public TargetInfoRenderer12(Dragging drag) {
        this.drag = drag;
    }

    @Override
    public void render(EventDisplay eventDisplay) {
        posX = drag.getX();
        posY = drag.getY();
        entity = getTarget(entity);
        boolean backAnimation = !shouldToBack || stopWatch.isReached(1000);
        animation.setDuration(backAnimation ?500 : 700);
        animation.setDirection(backAnimation ? Direction.BACKWARDS : Direction.FORWARDS);

        if (animation.getOutput() == 0.0f) {
            entity = null;
        }

        if (entity != null) {
            drag.setWidth(width);
            drag.setHeight(height);

            float health = fix1000Health(entity.getHealth());
            float maxHealth = MathHelper.clamp(entity.getMaxHealth(), 0, 24);
            float maxHealth2 = MathHelper.clamp(entity.getMaxHealth(), 0, 26);

            healthAnimation = MathUtil.fast(healthAnimation,
                    MathHelper.clamp(health / maxHealth, 0, 1), 2);
            absorptionAnimation = MathUtil.fast(absorptionAnimation,
                    MathHelper.clamp(entity.getAbsorptionAmount() / maxHealth, 0, 1), 2);

            healthAnimation2 = MathUtil.fast(healthAnimation2,        MathHelper.clamp(health / (maxHealth2 / 8), 0, 1), 1);
            absorptionAnimation2 = MathUtil.fast(absorptionAnimation2,        MathHelper.clamp(entity.getAbsorptionAmount() / (maxHealth2 / 4), 0, 1), 1);

            GlStateManager.pushMatrix();
            setSizeAnimation(animation.getOutput());
            drawBackGround(rounding);
            renderTextThatDisplaysTargetInfo(eventDisplay.getMatrixStack());
            drawTargetHead(entity, posX +  spacing, posY + spacing+2, headSize, headSize);
            renderHealthBar();
            GlStateManager.popMatrix();
        }
    }

    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity auraTarget = NeverBels.getInstance().getFunctionRegistry().getKillAura().getTarget();
        LivingEntity target = nullTarget;
        if (auraTarget != null) {
            stopWatch.reset();
            shouldToBack = true;
            target = auraTarget;
        } else if (mc.currentScreen instanceof ChatScreen) {
            stopWatch.reset();
            shouldToBack = true;
            target = mc.player;
        } else {
            shouldToBack = false;
        }
        return target;
    }

    public void drawTargetHead(LivingEntity entity, float x, float y, float width, float height) {
        if (entity != null) {
            EntityRenderer<? super LivingEntity> rendererManager = mc.getRenderManager().getRenderer(entity);
            drawFace(rendererManager.getEntityTexture(entity), x, y-3, 8F, 8F, 8F, 8F, width, height, 64F, 64F, entity);
        }
    }
    private void renderHealthBar() {
        Style style = NeverBels.getInstance().getStyleManager().getCurrentStyle();
        Vector4i vector4i = new Vector4i(HUD.getColor(0), HUD.getColor(90), HUD.getColor(180), HUD.getColor(170));
        DisplayUtils.drawRoundedRect(posX + 34 + headSize + spacing -32 + spacing, posY - 5.5f + height - spacing * 1 - 2, (width - 38) * healthAnimation, 3.5f, new Vector4f(3,3,3,3), (ColorUtils.setAlpha(ColorUtils.getColor(1), 255)));
    }


    private void renderTextThatDisplaysTargetInfo(MatrixStack matrixStack) {
        Style style = NeverBels.getInstance().getStyleManager().getCurrentStyle();
        float animationValue = (float) animation.getOutput();
        float halfAnimationValueRest = (1 - animationValue) / 2f;
        float testX = posX + (width * halfAnimationValueRest);
        float testY = posY + (height * halfAnimationValueRest);
        float testW = width * animationValue;
        float testH = height * animationValue;
        drawStyledRect(posX, posY, width, height, rounding, 195);
        //рендерится голова
        Stencil.initStencilToWrite();
        DisplayUtils.drawRoundedRect(posX + spacing, posY + spacing + 1, headSize, headSize,2, style.getSecondColor().getRGB() );
        Stencil.readStencilBuffer(1);
        drawTargetHead(entity, posX + spacing, posY + spacing + 2, headSize, headSize);
        Stencil.uninitStencilBuffer();
        Scissor.push();
        Scissor.setFromComponentCoordinates(testX, testY, testW - 1, testH);
        String hpText = "";
        if (entity.isInvisible() && userConnectedToFunTimeAndEntityIsPlayer()) {
            hpText = "Неизвестно";
        } else {
            float health = (float) MathUtil.round(healthAnimation * 20.0f, 0.1f);
            hpText = health * 5 + "%";
}

        Fonts.sfMedium.drawText(matrixStack, TextFormatting.getTextWithoutFormattingCodes(entity.getName().getString()), posX + 10 + headSize + spacing + spacing, posY + 2 + spacing + 1, -1, 8);
        Fonts.sfMedium.drawText(matrixStack, hpText, posX + 20 + headSize + spacing + spacing,
                posY + 5 + spacing + 1 + spacing + spacing, ColorUtils.rgba(255, 255, 255, 255), 6.5F);
        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/heart.png"), posX + 140 * healthAnimation2 / 1.5f , posY + 17 , 7, 7,ColorUtils.rgba(255,255,255,255));

        Scissor.unset();
        Scissor.pop();
    }


    public void setSizeAnimation(double scale) {
        GlStateManager.translated(posX + (width / 2), posY + (height / 2), 0);
        GlStateManager.scaled(scale, scale, scale);
        GlStateManager.translated(-(posX + (width / 2)), -(posY + (height / 2)), 0);
    }

    public void drawFace(ResourceLocation res, float d,
                         float y,
                         float u,
                         float v,
                         float uWidth,
                         float vHeight,
                         float width,
                         float height,
                         float tileWidth,
                         float tileHeight,
                         LivingEntity target) {
        GL11.glPushMatrix();
        GL11.glEnable(GL11.GL_BLEND);
        mc.getTextureManager().bindTexture(res);
        float hurtPercent = (target.hurtTime - (target.hurtTime != 0 ? mc.timer.renderPartialTicks : 0.0f)) / 8.0f;
        GL11.glColor4f(1, 1 - hurtPercent, 1 - hurtPercent, 1);
        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/hud/steve.png"), posX + 6 , posY + 6 , 24, 25,ColorUtils.rgba(255,255,255,255));
        GL11.glColor4f(1, 1, 1, 1);
        GL11.glPopMatrix();
    }

    private float fix1000Health(float original) {
        Score score = mc.world.getScoreboard().getOrCreateScore(entity.getScoreboardName(),
                mc.world.getScoreboard().getObjectiveInDisplaySlot(2));

        return userConnectedToFunTimeAndEntityIsPlayer() ? score.getScorePoints() : original;
    }


    private boolean userConnectedToFunTimeAndEntityIsPlayer() {
        String header = mc.ingameGUI.getTabList().header == null ? " " : mc.ingameGUI.getTabList().header.getString().toLowerCase();
        return (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.contains("funtime")
                && (header.contains("анархия") || header.contains("гриферский")) && entity instanceof PlayerEntity);
    }

    private void drawBackGround(float radius) {
        Vector4i vector4i = new Vector4i(HUD.getColor(50), HUD.getColor(160), HUD.getColor(100), HUD.getColor(80));
       // DisplayUtils.drawRoundedRect(posX + 1, posY + 1, width - 2, height - 2, radius, ColorUtils.rgba(0, 0, 0, 125));
        DisplayUtils.drawRoundedRect(posX + 2, posY + 1, 100.5f, 35, radius, (ColorUtils.rgba(25, 30, 30, 125)));


        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/hud/gradline.png"), posX + 15.5f, posY + 16 , width - 19, 1,ColorUtils.rgba(255,255,255,170));
}
    private void drawStyledRect(float x,
                                float y,
                                float width,
                                float height,
                                float radius, int alpha) {


    }
}
п.с я новичек и не стоит закидывать меня палками:)
 
Красива, маладец >3
 
Сделал тх за минут 5-10, не больше, думаю многим зайдет.


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




TargetInfoRenderer:
Expand Collapse Copy
ывpackage im.NeverBels.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import im.NeverBels.NeverBels;
import im.NeverBels.events.EventDisplay;
import im.NeverBels.functions.impl.render.HUD;
import im.NeverBels.ui.display.elementRenderer;
import im.NeverBels.ui.styles.Style;
import im.NeverBels.utils.animations.Animation;
import im.NeverBels.utils.animations.Direction;
import im.NeverBels.utils.animations.impl.EaseBackIn;
import im.NeverBels.utils.drag.Dragging;
import im.NeverBels.utils.math.MathUtil;
import im.NeverBels.utils.math.StopWatch;
import im.NeverBels.utils.math.Vector4i;
import im.NeverBels.utils.render.ColorUtils;
import im.NeverBels.utils.render.DisplayUtils;
import im.NeverBels.utils.render.Scissor;
import im.NeverBels.utils.render.Stencil;
import im.NeverBels.utils.render.font.Fonts;
import lombok.AccessLevel;
import lombok.experimental.FieldDefaults;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.scoreboard.Score;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.util.text.TextFormatting;
import org.lwjgl.opengl.GL11;

@FieldDefaults(level = AccessLevel.PRIVATE)
public class TargetInfoRenderer12 implements elementRenderer {
    final StopWatch stopWatch = new StopWatch();
    final Dragging drag;
    LivingEntity entity = null;
    boolean shouldToBack;
    final Animation animation = new EaseBackIn(400, 1, 1);
    float healthAnimation = 0.0f, absorptionAnimation = 0.0f;
    float healthAnimation2 = 0.0f, absorptionAnimation2 = 0.0f;
    float posX, posY;

    static final float width = 102;
    static final float height = 38;
    static final float spacing = 4;
    static final float rounding = 4;
    static final float headSize = 22;

    public TargetInfoRenderer12(Dragging drag) {
        this.drag = drag;
    }

    @Override
    public void render(EventDisplay eventDisplay) {
        posX = drag.getX();
        posY = drag.getY();
        entity = getTarget(entity);
        boolean backAnimation = !shouldToBack || stopWatch.isReached(1000);
        animation.setDuration(backAnimation ?500 : 700);
        animation.setDirection(backAnimation ? Direction.BACKWARDS : Direction.FORWARDS);

        if (animation.getOutput() == 0.0f) {
            entity = null;
        }

        if (entity != null) {
            drag.setWidth(width);
            drag.setHeight(height);

            float health = fix1000Health(entity.getHealth());
            float maxHealth = MathHelper.clamp(entity.getMaxHealth(), 0, 24);
            float maxHealth2 = MathHelper.clamp(entity.getMaxHealth(), 0, 26);

            healthAnimation = MathUtil.fast(healthAnimation,
                    MathHelper.clamp(health / maxHealth, 0, 1), 2);
            absorptionAnimation = MathUtil.fast(absorptionAnimation,
                    MathHelper.clamp(entity.getAbsorptionAmount() / maxHealth, 0, 1), 2);

            healthAnimation2 = MathUtil.fast(healthAnimation2,        MathHelper.clamp(health / (maxHealth2 / 8), 0, 1), 1);
            absorptionAnimation2 = MathUtil.fast(absorptionAnimation2,        MathHelper.clamp(entity.getAbsorptionAmount() / (maxHealth2 / 4), 0, 1), 1);

            GlStateManager.pushMatrix();
            setSizeAnimation(animation.getOutput());
            drawBackGround(rounding);
            renderTextThatDisplaysTargetInfo(eventDisplay.getMatrixStack());
            drawTargetHead(entity, posX +  spacing, posY + spacing+2, headSize, headSize);
            renderHealthBar();
            GlStateManager.popMatrix();
        }
    }

    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity auraTarget = NeverBels.getInstance().getFunctionRegistry().getKillAura().getTarget();
        LivingEntity target = nullTarget;
        if (auraTarget != null) {
            stopWatch.reset();
            shouldToBack = true;
            target = auraTarget;
        } else if (mc.currentScreen instanceof ChatScreen) {
            stopWatch.reset();
            shouldToBack = true;
            target = mc.player;
        } else {
            shouldToBack = false;
        }
        return target;
    }

    public void drawTargetHead(LivingEntity entity, float x, float y, float width, float height) {
        if (entity != null) {
            EntityRenderer<? super LivingEntity> rendererManager = mc.getRenderManager().getRenderer(entity);
            drawFace(rendererManager.getEntityTexture(entity), x, y-3, 8F, 8F, 8F, 8F, width, height, 64F, 64F, entity);
        }
    }
    private void renderHealthBar() {
        Style style = NeverBels.getInstance().getStyleManager().getCurrentStyle();
        Vector4i vector4i = new Vector4i(HUD.getColor(0), HUD.getColor(90), HUD.getColor(180), HUD.getColor(170));
        DisplayUtils.drawRoundedRect(posX + 34 + headSize + spacing -32 + spacing, posY - 5.5f + height - spacing * 1 - 2, (width - 38) * healthAnimation, 3.5f, new Vector4f(3,3,3,3), (ColorUtils.setAlpha(ColorUtils.getColor(1), 255)));
    }


    private void renderTextThatDisplaysTargetInfo(MatrixStack matrixStack) {
        Style style = NeverBels.getInstance().getStyleManager().getCurrentStyle();
        float animationValue = (float) animation.getOutput();
        float halfAnimationValueRest = (1 - animationValue) / 2f;
        float testX = posX + (width * halfAnimationValueRest);
        float testY = posY + (height * halfAnimationValueRest);
        float testW = width * animationValue;
        float testH = height * animationValue;
        drawStyledRect(posX, posY, width, height, rounding, 195);
        //рендерится голова
        Stencil.initStencilToWrite();
        DisplayUtils.drawRoundedRect(posX + spacing, posY + spacing + 1, headSize, headSize,2, style.getSecondColor().getRGB() );
        Stencil.readStencilBuffer(1);
        drawTargetHead(entity, posX + spacing, posY + spacing + 2, headSize, headSize);
        Stencil.uninitStencilBuffer();
        Scissor.push();
        Scissor.setFromComponentCoordinates(testX, testY, testW - 1, testH);
        String hpText = "";
        if (entity.isInvisible() && userConnectedToFunTimeAndEntityIsPlayer()) {
            hpText = "Неизвестно";
        } else {
            float health = (float) MathUtil.round(healthAnimation * 20.0f, 0.1f);
            hpText = health * 5 + "%";
}

        Fonts.sfMedium.drawText(matrixStack, TextFormatting.getTextWithoutFormattingCodes(entity.getName().getString()), posX + 10 + headSize + spacing + spacing, posY + 2 + spacing + 1, -1, 8);
        Fonts.sfMedium.drawText(matrixStack, hpText, posX + 20 + headSize + spacing + spacing,
                posY + 5 + spacing + 1 + spacing + spacing, ColorUtils.rgba(255, 255, 255, 255), 6.5F);
        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/heart.png"), posX + 140 * healthAnimation2 / 1.5f , posY + 17 , 7, 7,ColorUtils.rgba(255,255,255,255));

        Scissor.unset();
        Scissor.pop();
    }


    public void setSizeAnimation(double scale) {
        GlStateManager.translated(posX + (width / 2), posY + (height / 2), 0);
        GlStateManager.scaled(scale, scale, scale);
        GlStateManager.translated(-(posX + (width / 2)), -(posY + (height / 2)), 0);
    }

    public void drawFace(ResourceLocation res, float d,
                         float y,
                         float u,
                         float v,
                         float uWidth,
                         float vHeight,
                         float width,
                         float height,
                         float tileWidth,
                         float tileHeight,
                         LivingEntity target) {
        GL11.glPushMatrix();
        GL11.glEnable(GL11.GL_BLEND);
        mc.getTextureManager().bindTexture(res);
        float hurtPercent = (target.hurtTime - (target.hurtTime != 0 ? mc.timer.renderPartialTicks : 0.0f)) / 8.0f;
        GL11.glColor4f(1, 1 - hurtPercent, 1 - hurtPercent, 1);
        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/hud/steve.png"), posX + 6 , posY + 6 , 24, 25,ColorUtils.rgba(255,255,255,255));
        GL11.glColor4f(1, 1, 1, 1);
        GL11.glPopMatrix();
    }

    private float fix1000Health(float original) {
        Score score = mc.world.getScoreboard().getOrCreateScore(entity.getScoreboardName(),
                mc.world.getScoreboard().getObjectiveInDisplaySlot(2));

        return userConnectedToFunTimeAndEntityIsPlayer() ? score.getScorePoints() : original;
    }


    private boolean userConnectedToFunTimeAndEntityIsPlayer() {
        String header = mc.ingameGUI.getTabList().header == null ? " " : mc.ingameGUI.getTabList().header.getString().toLowerCase();
        return (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.contains("funtime")
                && (header.contains("анархия") || header.contains("гриферский")) && entity instanceof PlayerEntity);
    }

    private void drawBackGround(float radius) {
        Vector4i vector4i = new Vector4i(HUD.getColor(50), HUD.getColor(160), HUD.getColor(100), HUD.getColor(80));
       // DisplayUtils.drawRoundedRect(posX + 1, posY + 1, width - 2, height - 2, radius, ColorUtils.rgba(0, 0, 0, 125));
        DisplayUtils.drawRoundedRect(posX + 2, posY + 1, 100.5f, 35, radius, (ColorUtils.rgba(25, 30, 30, 125)));


        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/hud/gradline.png"), posX + 15.5f, posY + 16 , width - 19, 1,ColorUtils.rgba(255,255,255,170));
}
    private void drawStyledRect(float x,
                                float y,
                                float width,
                                float height,
                                float radius, int alpha) {


    }
}
/del сделал зиддер а ты 10 минут добавлял картинку и менял цвет :roflanEbalo:
 
Сделал тх за минут 5-10, не больше, думаю многим зайдет.


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




TargetInfoRenderer:
Expand Collapse Copy
ывpackage im.NeverBels.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import im.NeverBels.NeverBels;
import im.NeverBels.events.EventDisplay;
import im.NeverBels.functions.impl.render.HUD;
import im.NeverBels.ui.display.elementRenderer;
import im.NeverBels.ui.styles.Style;
import im.NeverBels.utils.animations.Animation;
import im.NeverBels.utils.animations.Direction;
import im.NeverBels.utils.animations.impl.EaseBackIn;
import im.NeverBels.utils.drag.Dragging;
import im.NeverBels.utils.math.MathUtil;
import im.NeverBels.utils.math.StopWatch;
import im.NeverBels.utils.math.Vector4i;
import im.NeverBels.utils.render.ColorUtils;
import im.NeverBels.utils.render.DisplayUtils;
import im.NeverBels.utils.render.Scissor;
import im.NeverBels.utils.render.Stencil;
import im.NeverBels.utils.render.font.Fonts;
import lombok.AccessLevel;
import lombok.experimental.FieldDefaults;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.scoreboard.Score;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.util.text.TextFormatting;
import org.lwjgl.opengl.GL11;

@FieldDefaults(level = AccessLevel.PRIVATE)
public class TargetInfoRenderer12 implements elementRenderer {
    final StopWatch stopWatch = new StopWatch();
    final Dragging drag;
    LivingEntity entity = null;
    boolean shouldToBack;
    final Animation animation = new EaseBackIn(400, 1, 1);
    float healthAnimation = 0.0f, absorptionAnimation = 0.0f;
    float healthAnimation2 = 0.0f, absorptionAnimation2 = 0.0f;
    float posX, posY;

    static final float width = 102;
    static final float height = 38;
    static final float spacing = 4;
    static final float rounding = 4;
    static final float headSize = 22;

    public TargetInfoRenderer12(Dragging drag) {
        this.drag = drag;
    }

    @Override
    public void render(EventDisplay eventDisplay) {
        posX = drag.getX();
        posY = drag.getY();
        entity = getTarget(entity);
        boolean backAnimation = !shouldToBack || stopWatch.isReached(1000);
        animation.setDuration(backAnimation ?500 : 700);
        animation.setDirection(backAnimation ? Direction.BACKWARDS : Direction.FORWARDS);

        if (animation.getOutput() == 0.0f) {
            entity = null;
        }

        if (entity != null) {
            drag.setWidth(width);
            drag.setHeight(height);

            float health = fix1000Health(entity.getHealth());
            float maxHealth = MathHelper.clamp(entity.getMaxHealth(), 0, 24);
            float maxHealth2 = MathHelper.clamp(entity.getMaxHealth(), 0, 26);

            healthAnimation = MathUtil.fast(healthAnimation,
                    MathHelper.clamp(health / maxHealth, 0, 1), 2);
            absorptionAnimation = MathUtil.fast(absorptionAnimation,
                    MathHelper.clamp(entity.getAbsorptionAmount() / maxHealth, 0, 1), 2);

            healthAnimation2 = MathUtil.fast(healthAnimation2,        MathHelper.clamp(health / (maxHealth2 / 8), 0, 1), 1);
            absorptionAnimation2 = MathUtil.fast(absorptionAnimation2,        MathHelper.clamp(entity.getAbsorptionAmount() / (maxHealth2 / 4), 0, 1), 1);

            GlStateManager.pushMatrix();
            setSizeAnimation(animation.getOutput());
            drawBackGround(rounding);
            renderTextThatDisplaysTargetInfo(eventDisplay.getMatrixStack());
            drawTargetHead(entity, posX +  spacing, posY + spacing+2, headSize, headSize);
            renderHealthBar();
            GlStateManager.popMatrix();
        }
    }

    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity auraTarget = NeverBels.getInstance().getFunctionRegistry().getKillAura().getTarget();
        LivingEntity target = nullTarget;
        if (auraTarget != null) {
            stopWatch.reset();
            shouldToBack = true;
            target = auraTarget;
        } else if (mc.currentScreen instanceof ChatScreen) {
            stopWatch.reset();
            shouldToBack = true;
            target = mc.player;
        } else {
            shouldToBack = false;
        }
        return target;
    }

    public void drawTargetHead(LivingEntity entity, float x, float y, float width, float height) {
        if (entity != null) {
            EntityRenderer<? super LivingEntity> rendererManager = mc.getRenderManager().getRenderer(entity);
            drawFace(rendererManager.getEntityTexture(entity), x, y-3, 8F, 8F, 8F, 8F, width, height, 64F, 64F, entity);
        }
    }
    private void renderHealthBar() {
        Style style = NeverBels.getInstance().getStyleManager().getCurrentStyle();
        Vector4i vector4i = new Vector4i(HUD.getColor(0), HUD.getColor(90), HUD.getColor(180), HUD.getColor(170));
        DisplayUtils.drawRoundedRect(posX + 34 + headSize + spacing -32 + spacing, posY - 5.5f + height - spacing * 1 - 2, (width - 38) * healthAnimation, 3.5f, new Vector4f(3,3,3,3), (ColorUtils.setAlpha(ColorUtils.getColor(1), 255)));
    }


    private void renderTextThatDisplaysTargetInfo(MatrixStack matrixStack) {
        Style style = NeverBels.getInstance().getStyleManager().getCurrentStyle();
        float animationValue = (float) animation.getOutput();
        float halfAnimationValueRest = (1 - animationValue) / 2f;
        float testX = posX + (width * halfAnimationValueRest);
        float testY = posY + (height * halfAnimationValueRest);
        float testW = width * animationValue;
        float testH = height * animationValue;
        drawStyledRect(posX, posY, width, height, rounding, 195);
        //рендерится голова
        Stencil.initStencilToWrite();
        DisplayUtils.drawRoundedRect(posX + spacing, posY + spacing + 1, headSize, headSize,2, style.getSecondColor().getRGB() );
        Stencil.readStencilBuffer(1);
        drawTargetHead(entity, posX + spacing, posY + spacing + 2, headSize, headSize);
        Stencil.uninitStencilBuffer();
        Scissor.push();
        Scissor.setFromComponentCoordinates(testX, testY, testW - 1, testH);
        String hpText = "";
        if (entity.isInvisible() && userConnectedToFunTimeAndEntityIsPlayer()) {
            hpText = "Неизвестно";
        } else {
            float health = (float) MathUtil.round(healthAnimation * 20.0f, 0.1f);
            hpText = health * 5 + "%";
}

        Fonts.sfMedium.drawText(matrixStack, TextFormatting.getTextWithoutFormattingCodes(entity.getName().getString()), posX + 10 + headSize + spacing + spacing, posY + 2 + spacing + 1, -1, 8);
        Fonts.sfMedium.drawText(matrixStack, hpText, posX + 20 + headSize + spacing + spacing,
                posY + 5 + spacing + 1 + spacing + spacing, ColorUtils.rgba(255, 255, 255, 255), 6.5F);
        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/heart.png"), posX + 140 * healthAnimation2 / 1.5f , posY + 17 , 7, 7,ColorUtils.rgba(255,255,255,255));

        Scissor.unset();
        Scissor.pop();
    }


    public void setSizeAnimation(double scale) {
        GlStateManager.translated(posX + (width / 2), posY + (height / 2), 0);
        GlStateManager.scaled(scale, scale, scale);
        GlStateManager.translated(-(posX + (width / 2)), -(posY + (height / 2)), 0);
    }

    public void drawFace(ResourceLocation res, float d,
                         float y,
                         float u,
                         float v,
                         float uWidth,
                         float vHeight,
                         float width,
                         float height,
                         float tileWidth,
                         float tileHeight,
                         LivingEntity target) {
        GL11.glPushMatrix();
        GL11.glEnable(GL11.GL_BLEND);
        mc.getTextureManager().bindTexture(res);
        float hurtPercent = (target.hurtTime - (target.hurtTime != 0 ? mc.timer.renderPartialTicks : 0.0f)) / 8.0f;
        GL11.glColor4f(1, 1 - hurtPercent, 1 - hurtPercent, 1);
        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/hud/steve.png"), posX + 6 , posY + 6 , 24, 25,ColorUtils.rgba(255,255,255,255));
        GL11.glColor4f(1, 1, 1, 1);
        GL11.glPopMatrix();
    }

    private float fix1000Health(float original) {
        Score score = mc.world.getScoreboard().getOrCreateScore(entity.getScoreboardName(),
                mc.world.getScoreboard().getObjectiveInDisplaySlot(2));

        return userConnectedToFunTimeAndEntityIsPlayer() ? score.getScorePoints() : original;
    }


    private boolean userConnectedToFunTimeAndEntityIsPlayer() {
        String header = mc.ingameGUI.getTabList().header == null ? " " : mc.ingameGUI.getTabList().header.getString().toLowerCase();
        return (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.contains("funtime")
                && (header.contains("анархия") || header.contains("гриферский")) && entity instanceof PlayerEntity);
    }

    private void drawBackGround(float radius) {
        Vector4i vector4i = new Vector4i(HUD.getColor(50), HUD.getColor(160), HUD.getColor(100), HUD.getColor(80));
       // DisplayUtils.drawRoundedRect(posX + 1, posY + 1, width - 2, height - 2, radius, ColorUtils.rgba(0, 0, 0, 125));
        DisplayUtils.drawRoundedRect(posX + 2, posY + 1, 100.5f, 35, radius, (ColorUtils.rgba(25, 30, 30, 125)));


        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/hud/gradline.png"), posX + 15.5f, posY + 16 , width - 19, 1,ColorUtils.rgba(255,255,255,170));
}
    private void drawStyledRect(float x,
                                float y,
                                float width,
                                float height,
                                float radius, int alpha) {


    }
}
Нормолдаки, даже на премку тянет
 
Если честно - то не плохо. Но могло быть и похуже.
Кнш без косяков, но если ты рил новичёк, то работа не плохая (только линию надо было правее подвинуть)
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Сделал тх за минут 5-10, не больше, думаю многим зайдет.


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




TargetInfoRenderer:
Expand Collapse Copy
ывpackage im.NeverBels.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import im.NeverBels.NeverBels;
import im.NeverBels.events.EventDisplay;
import im.NeverBels.functions.impl.render.HUD;
import im.NeverBels.ui.display.elementRenderer;
import im.NeverBels.ui.styles.Style;
import im.NeverBels.utils.animations.Animation;
import im.NeverBels.utils.animations.Direction;
import im.NeverBels.utils.animations.impl.EaseBackIn;
import im.NeverBels.utils.drag.Dragging;
import im.NeverBels.utils.math.MathUtil;
import im.NeverBels.utils.math.StopWatch;
import im.NeverBels.utils.math.Vector4i;
import im.NeverBels.utils.render.ColorUtils;
import im.NeverBels.utils.render.DisplayUtils;
import im.NeverBels.utils.render.Scissor;
import im.NeverBels.utils.render.Stencil;
import im.NeverBels.utils.render.font.Fonts;
import lombok.AccessLevel;
import lombok.experimental.FieldDefaults;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.scoreboard.Score;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.util.text.TextFormatting;
import org.lwjgl.opengl.GL11;

@FieldDefaults(level = AccessLevel.PRIVATE)
public class TargetInfoRenderer12 implements elementRenderer {
    final StopWatch stopWatch = new StopWatch();
    final Dragging drag;
    LivingEntity entity = null;
    boolean shouldToBack;
    final Animation animation = new EaseBackIn(400, 1, 1);
    float healthAnimation = 0.0f, absorptionAnimation = 0.0f;
    float healthAnimation2 = 0.0f, absorptionAnimation2 = 0.0f;
    float posX, posY;

    static final float width = 102;
    static final float height = 38;
    static final float spacing = 4;
    static final float rounding = 4;
    static final float headSize = 22;

    public TargetInfoRenderer12(Dragging drag) {
        this.drag = drag;
    }

    @Override
    public void render(EventDisplay eventDisplay) {
        posX = drag.getX();
        posY = drag.getY();
        entity = getTarget(entity);
        boolean backAnimation = !shouldToBack || stopWatch.isReached(1000);
        animation.setDuration(backAnimation ?500 : 700);
        animation.setDirection(backAnimation ? Direction.BACKWARDS : Direction.FORWARDS);

        if (animation.getOutput() == 0.0f) {
            entity = null;
        }

        if (entity != null) {
            drag.setWidth(width);
            drag.setHeight(height);

            float health = fix1000Health(entity.getHealth());
            float maxHealth = MathHelper.clamp(entity.getMaxHealth(), 0, 24);
            float maxHealth2 = MathHelper.clamp(entity.getMaxHealth(), 0, 26);

            healthAnimation = MathUtil.fast(healthAnimation,
                    MathHelper.clamp(health / maxHealth, 0, 1), 2);
            absorptionAnimation = MathUtil.fast(absorptionAnimation,
                    MathHelper.clamp(entity.getAbsorptionAmount() / maxHealth, 0, 1), 2);

            healthAnimation2 = MathUtil.fast(healthAnimation2,        MathHelper.clamp(health / (maxHealth2 / 8), 0, 1), 1);
            absorptionAnimation2 = MathUtil.fast(absorptionAnimation2,        MathHelper.clamp(entity.getAbsorptionAmount() / (maxHealth2 / 4), 0, 1), 1);

            GlStateManager.pushMatrix();
            setSizeAnimation(animation.getOutput());
            drawBackGround(rounding);
            renderTextThatDisplaysTargetInfo(eventDisplay.getMatrixStack());
            drawTargetHead(entity, posX +  spacing, posY + spacing+2, headSize, headSize);
            renderHealthBar();
            GlStateManager.popMatrix();
        }
    }

    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity auraTarget = NeverBels.getInstance().getFunctionRegistry().getKillAura().getTarget();
        LivingEntity target = nullTarget;
        if (auraTarget != null) {
            stopWatch.reset();
            shouldToBack = true;
            target = auraTarget;
        } else if (mc.currentScreen instanceof ChatScreen) {
            stopWatch.reset();
            shouldToBack = true;
            target = mc.player;
        } else {
            shouldToBack = false;
        }
        return target;
    }

    public void drawTargetHead(LivingEntity entity, float x, float y, float width, float height) {
        if (entity != null) {
            EntityRenderer<? super LivingEntity> rendererManager = mc.getRenderManager().getRenderer(entity);
            drawFace(rendererManager.getEntityTexture(entity), x, y-3, 8F, 8F, 8F, 8F, width, height, 64F, 64F, entity);
        }
    }
    private void renderHealthBar() {
        Style style = NeverBels.getInstance().getStyleManager().getCurrentStyle();
        Vector4i vector4i = new Vector4i(HUD.getColor(0), HUD.getColor(90), HUD.getColor(180), HUD.getColor(170));
        DisplayUtils.drawRoundedRect(posX + 34 + headSize + spacing -32 + spacing, posY - 5.5f + height - spacing * 1 - 2, (width - 38) * healthAnimation, 3.5f, new Vector4f(3,3,3,3), (ColorUtils.setAlpha(ColorUtils.getColor(1), 255)));
    }


    private void renderTextThatDisplaysTargetInfo(MatrixStack matrixStack) {
        Style style = NeverBels.getInstance().getStyleManager().getCurrentStyle();
        float animationValue = (float) animation.getOutput();
        float halfAnimationValueRest = (1 - animationValue) / 2f;
        float testX = posX + (width * halfAnimationValueRest);
        float testY = posY + (height * halfAnimationValueRest);
        float testW = width * animationValue;
        float testH = height * animationValue;
        drawStyledRect(posX, posY, width, height, rounding, 195);
        //рендерится голова
        Stencil.initStencilToWrite();
        DisplayUtils.drawRoundedRect(posX + spacing, posY + spacing + 1, headSize, headSize,2, style.getSecondColor().getRGB() );
        Stencil.readStencilBuffer(1);
        drawTargetHead(entity, posX + spacing, posY + spacing + 2, headSize, headSize);
        Stencil.uninitStencilBuffer();
        Scissor.push();
        Scissor.setFromComponentCoordinates(testX, testY, testW - 1, testH);
        String hpText = "";
        if (entity.isInvisible() && userConnectedToFunTimeAndEntityIsPlayer()) {
            hpText = "Неизвестно";
        } else {
            float health = (float) MathUtil.round(healthAnimation * 20.0f, 0.1f);
            hpText = health * 5 + "%";
}

        Fonts.sfMedium.drawText(matrixStack, TextFormatting.getTextWithoutFormattingCodes(entity.getName().getString()), posX + 10 + headSize + spacing + spacing, posY + 2 + spacing + 1, -1, 8);
        Fonts.sfMedium.drawText(matrixStack, hpText, posX + 20 + headSize + spacing + spacing,
                posY + 5 + spacing + 1 + spacing + spacing, ColorUtils.rgba(255, 255, 255, 255), 6.5F);
        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/heart.png"), posX + 140 * healthAnimation2 / 1.5f , posY + 17 , 7, 7,ColorUtils.rgba(255,255,255,255));

        Scissor.unset();
        Scissor.pop();
    }


    public void setSizeAnimation(double scale) {
        GlStateManager.translated(posX + (width / 2), posY + (height / 2), 0);
        GlStateManager.scaled(scale, scale, scale);
        GlStateManager.translated(-(posX + (width / 2)), -(posY + (height / 2)), 0);
    }

    public void drawFace(ResourceLocation res, float d,
                         float y,
                         float u,
                         float v,
                         float uWidth,
                         float vHeight,
                         float width,
                         float height,
                         float tileWidth,
                         float tileHeight,
                         LivingEntity target) {
        GL11.glPushMatrix();
        GL11.glEnable(GL11.GL_BLEND);
        mc.getTextureManager().bindTexture(res);
        float hurtPercent = (target.hurtTime - (target.hurtTime != 0 ? mc.timer.renderPartialTicks : 0.0f)) / 8.0f;
        GL11.glColor4f(1, 1 - hurtPercent, 1 - hurtPercent, 1);
        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/hud/steve.png"), posX + 6 , posY + 6 , 24, 25,ColorUtils.rgba(255,255,255,255));
        GL11.glColor4f(1, 1, 1, 1);
        GL11.glPopMatrix();
    }

    private float fix1000Health(float original) {
        Score score = mc.world.getScoreboard().getOrCreateScore(entity.getScoreboardName(),
                mc.world.getScoreboard().getObjectiveInDisplaySlot(2));

        return userConnectedToFunTimeAndEntityIsPlayer() ? score.getScorePoints() : original;
    }


    private boolean userConnectedToFunTimeAndEntityIsPlayer() {
        String header = mc.ingameGUI.getTabList().header == null ? " " : mc.ingameGUI.getTabList().header.getString().toLowerCase();
        return (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.contains("funtime")
                && (header.contains("анархия") || header.contains("гриферский")) && entity instanceof PlayerEntity);
    }

    private void drawBackGround(float radius) {
        Vector4i vector4i = new Vector4i(HUD.getColor(50), HUD.getColor(160), HUD.getColor(100), HUD.getColor(80));
       // DisplayUtils.drawRoundedRect(posX + 1, posY + 1, width - 2, height - 2, radius, ColorUtils.rgba(0, 0, 0, 125));
        DisplayUtils.drawRoundedRect(posX + 2, posY + 1, 100.5f, 35, radius, (ColorUtils.rgba(25, 30, 30, 125)));


        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/hud/gradline.png"), posX + 15.5f, posY + 16 , width - 19, 1,ColorUtils.rgba(255,255,255,170));
}
    private void drawStyledRect(float x,
                                float y,
                                float width,
                                float height,
                                float radius, int alpha) {


    }
}
хз типо норм но типо хуйня, 50\50
 
Если честно - то не плохо. Но могло быть и похуже.
Кнш без косяков, но если ты рил новичёк, то работа не плохая (только линию надо было правее подвинуть)
ок понял, учту в след.раз, да я новичек, практически моя 1 работ
 
Сделал тх за минут 5-10, не больше, думаю многим зайдет.


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




TargetInfoRenderer:
Expand Collapse Copy
ывpackage im.NeverBels.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import im.NeverBels.NeverBels;
import im.NeverBels.events.EventDisplay;
import im.NeverBels.functions.impl.render.HUD;
import im.NeverBels.ui.display.elementRenderer;
import im.NeverBels.ui.styles.Style;
import im.NeverBels.utils.animations.Animation;
import im.NeverBels.utils.animations.Direction;
import im.NeverBels.utils.animations.impl.EaseBackIn;
import im.NeverBels.utils.drag.Dragging;
import im.NeverBels.utils.math.MathUtil;
import im.NeverBels.utils.math.StopWatch;
import im.NeverBels.utils.math.Vector4i;
import im.NeverBels.utils.render.ColorUtils;
import im.NeverBels.utils.render.DisplayUtils;
import im.NeverBels.utils.render.Scissor;
import im.NeverBels.utils.render.Stencil;
import im.NeverBels.utils.render.font.Fonts;
import lombok.AccessLevel;
import lombok.experimental.FieldDefaults;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.scoreboard.Score;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.util.text.TextFormatting;
import org.lwjgl.opengl.GL11;

@FieldDefaults(level = AccessLevel.PRIVATE)
public class TargetInfoRenderer12 implements elementRenderer {
    final StopWatch stopWatch = new StopWatch();
    final Dragging drag;
    LivingEntity entity = null;
    boolean shouldToBack;
    final Animation animation = new EaseBackIn(400, 1, 1);
    float healthAnimation = 0.0f, absorptionAnimation = 0.0f;
    float healthAnimation2 = 0.0f, absorptionAnimation2 = 0.0f;
    float posX, posY;

    static final float width = 102;
    static final float height = 38;
    static final float spacing = 4;
    static final float rounding = 4;
    static final float headSize = 22;

    public TargetInfoRenderer12(Dragging drag) {
        this.drag = drag;
    }

    @Override
    public void render(EventDisplay eventDisplay) {
        posX = drag.getX();
        posY = drag.getY();
        entity = getTarget(entity);
        boolean backAnimation = !shouldToBack || stopWatch.isReached(1000);
        animation.setDuration(backAnimation ?500 : 700);
        animation.setDirection(backAnimation ? Direction.BACKWARDS : Direction.FORWARDS);

        if (animation.getOutput() == 0.0f) {
            entity = null;
        }

        if (entity != null) {
            drag.setWidth(width);
            drag.setHeight(height);

            float health = fix1000Health(entity.getHealth());
            float maxHealth = MathHelper.clamp(entity.getMaxHealth(), 0, 24);
            float maxHealth2 = MathHelper.clamp(entity.getMaxHealth(), 0, 26);

            healthAnimation = MathUtil.fast(healthAnimation,
                    MathHelper.clamp(health / maxHealth, 0, 1), 2);
            absorptionAnimation = MathUtil.fast(absorptionAnimation,
                    MathHelper.clamp(entity.getAbsorptionAmount() / maxHealth, 0, 1), 2);

            healthAnimation2 = MathUtil.fast(healthAnimation2,        MathHelper.clamp(health / (maxHealth2 / 8), 0, 1), 1);
            absorptionAnimation2 = MathUtil.fast(absorptionAnimation2,        MathHelper.clamp(entity.getAbsorptionAmount() / (maxHealth2 / 4), 0, 1), 1);

            GlStateManager.pushMatrix();
            setSizeAnimation(animation.getOutput());
            drawBackGround(rounding);
            renderTextThatDisplaysTargetInfo(eventDisplay.getMatrixStack());
            drawTargetHead(entity, posX +  spacing, posY + spacing+2, headSize, headSize);
            renderHealthBar();
            GlStateManager.popMatrix();
        }
    }

    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity auraTarget = NeverBels.getInstance().getFunctionRegistry().getKillAura().getTarget();
        LivingEntity target = nullTarget;
        if (auraTarget != null) {
            stopWatch.reset();
            shouldToBack = true;
            target = auraTarget;
        } else if (mc.currentScreen instanceof ChatScreen) {
            stopWatch.reset();
            shouldToBack = true;
            target = mc.player;
        } else {
            shouldToBack = false;
        }
        return target;
    }

    public void drawTargetHead(LivingEntity entity, float x, float y, float width, float height) {
        if (entity != null) {
            EntityRenderer<? super LivingEntity> rendererManager = mc.getRenderManager().getRenderer(entity);
            drawFace(rendererManager.getEntityTexture(entity), x, y-3, 8F, 8F, 8F, 8F, width, height, 64F, 64F, entity);
        }
    }
    private void renderHealthBar() {
        Style style = NeverBels.getInstance().getStyleManager().getCurrentStyle();
        Vector4i vector4i = new Vector4i(HUD.getColor(0), HUD.getColor(90), HUD.getColor(180), HUD.getColor(170));
        DisplayUtils.drawRoundedRect(posX + 34 + headSize + spacing -32 + spacing, posY - 5.5f + height - spacing * 1 - 2, (width - 38) * healthAnimation, 3.5f, new Vector4f(3,3,3,3), (ColorUtils.setAlpha(ColorUtils.getColor(1), 255)));
    }


    private void renderTextThatDisplaysTargetInfo(MatrixStack matrixStack) {
        Style style = NeverBels.getInstance().getStyleManager().getCurrentStyle();
        float animationValue = (float) animation.getOutput();
        float halfAnimationValueRest = (1 - animationValue) / 2f;
        float testX = posX + (width * halfAnimationValueRest);
        float testY = posY + (height * halfAnimationValueRest);
        float testW = width * animationValue;
        float testH = height * animationValue;
        drawStyledRect(posX, posY, width, height, rounding, 195);
        //рендерится голова
        Stencil.initStencilToWrite();
        DisplayUtils.drawRoundedRect(posX + spacing, posY + spacing + 1, headSize, headSize,2, style.getSecondColor().getRGB() );
        Stencil.readStencilBuffer(1);
        drawTargetHead(entity, posX + spacing, posY + spacing + 2, headSize, headSize);
        Stencil.uninitStencilBuffer();
        Scissor.push();
        Scissor.setFromComponentCoordinates(testX, testY, testW - 1, testH);
        String hpText = "";
        if (entity.isInvisible() && userConnectedToFunTimeAndEntityIsPlayer()) {
            hpText = "Неизвестно";
        } else {
            float health = (float) MathUtil.round(healthAnimation * 20.0f, 0.1f);
            hpText = health * 5 + "%";
}

        Fonts.sfMedium.drawText(matrixStack, TextFormatting.getTextWithoutFormattingCodes(entity.getName().getString()), posX + 10 + headSize + spacing + spacing, posY + 2 + spacing + 1, -1, 8);
        Fonts.sfMedium.drawText(matrixStack, hpText, posX + 20 + headSize + spacing + spacing,
                posY + 5 + spacing + 1 + spacing + spacing, ColorUtils.rgba(255, 255, 255, 255), 6.5F);
        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/heart.png"), posX + 140 * healthAnimation2 / 1.5f , posY + 17 , 7, 7,ColorUtils.rgba(255,255,255,255));

        Scissor.unset();
        Scissor.pop();
    }


    public void setSizeAnimation(double scale) {
        GlStateManager.translated(posX + (width / 2), posY + (height / 2), 0);
        GlStateManager.scaled(scale, scale, scale);
        GlStateManager.translated(-(posX + (width / 2)), -(posY + (height / 2)), 0);
    }

    public void drawFace(ResourceLocation res, float d,
                         float y,
                         float u,
                         float v,
                         float uWidth,
                         float vHeight,
                         float width,
                         float height,
                         float tileWidth,
                         float tileHeight,
                         LivingEntity target) {
        GL11.glPushMatrix();
        GL11.glEnable(GL11.GL_BLEND);
        mc.getTextureManager().bindTexture(res);
        float hurtPercent = (target.hurtTime - (target.hurtTime != 0 ? mc.timer.renderPartialTicks : 0.0f)) / 8.0f;
        GL11.glColor4f(1, 1 - hurtPercent, 1 - hurtPercent, 1);
        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/hud/steve.png"), posX + 6 , posY + 6 , 24, 25,ColorUtils.rgba(255,255,255,255));
        GL11.glColor4f(1, 1, 1, 1);
        GL11.glPopMatrix();
    }

    private float fix1000Health(float original) {
        Score score = mc.world.getScoreboard().getOrCreateScore(entity.getScoreboardName(),
                mc.world.getScoreboard().getObjectiveInDisplaySlot(2));

        return userConnectedToFunTimeAndEntityIsPlayer() ? score.getScorePoints() : original;
    }


    private boolean userConnectedToFunTimeAndEntityIsPlayer() {
        String header = mc.ingameGUI.getTabList().header == null ? " " : mc.ingameGUI.getTabList().header.getString().toLowerCase();
        return (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.contains("funtime")
                && (header.contains("анархия") || header.contains("гриферский")) && entity instanceof PlayerEntity);
    }

    private void drawBackGround(float radius) {
        Vector4i vector4i = new Vector4i(HUD.getColor(50), HUD.getColor(160), HUD.getColor(100), HUD.getColor(80));
       // DisplayUtils.drawRoundedRect(posX + 1, posY + 1, width - 2, height - 2, radius, ColorUtils.rgba(0, 0, 0, 125));
        DisplayUtils.drawRoundedRect(posX + 2, posY + 1, 100.5f, 35, radius, (ColorUtils.rgba(25, 30, 30, 125)));


        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/hud/gradline.png"), posX + 15.5f, posY + 16 , width - 19, 1,ColorUtils.rgba(255,255,255,170));
}
    private void drawStyledRect(float x,
                                float y,
                                float width,
                                float height,
                                float radius, int alpha) {


    }
}
зашло мне
 
1729274553300.png

1729274630987.png

1729274684104.png

1729274711608.png
 
будет анимация удара и точно спашю:roflanzdarova:
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Сделал тх за минут 5-10, не больше, думаю многим зайдет.


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




TargetInfoRenderer:
Expand Collapse Copy
ывpackage im.NeverBels.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import im.NeverBels.NeverBels;
import im.NeverBels.events.EventDisplay;
import im.NeverBels.functions.impl.render.HUD;
import im.NeverBels.ui.display.elementRenderer;
import im.NeverBels.ui.styles.Style;
import im.NeverBels.utils.animations.Animation;
import im.NeverBels.utils.animations.Direction;
import im.NeverBels.utils.animations.impl.EaseBackIn;
import im.NeverBels.utils.drag.Dragging;
import im.NeverBels.utils.math.MathUtil;
import im.NeverBels.utils.math.StopWatch;
import im.NeverBels.utils.math.Vector4i;
import im.NeverBels.utils.render.ColorUtils;
import im.NeverBels.utils.render.DisplayUtils;
import im.NeverBels.utils.render.Scissor;
import im.NeverBels.utils.render.Stencil;
import im.NeverBels.utils.render.font.Fonts;
import lombok.AccessLevel;
import lombok.experimental.FieldDefaults;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.scoreboard.Score;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.util.text.TextFormatting;
import org.lwjgl.opengl.GL11;

@FieldDefaults(level = AccessLevel.PRIVATE)
public class TargetInfoRenderer12 implements elementRenderer {
    final StopWatch stopWatch = new StopWatch();
    final Dragging drag;
    LivingEntity entity = null;
    boolean shouldToBack;
    final Animation animation = new EaseBackIn(400, 1, 1);
    float healthAnimation = 0.0f, absorptionAnimation = 0.0f;
    float healthAnimation2 = 0.0f, absorptionAnimation2 = 0.0f;
    float posX, posY;

    static final float width = 102;
    static final float height = 38;
    static final float spacing = 4;
    static final float rounding = 4;
    static final float headSize = 22;

    public TargetInfoRenderer12(Dragging drag) {
        this.drag = drag;
    }

    @Override
    public void render(EventDisplay eventDisplay) {
        posX = drag.getX();
        posY = drag.getY();
        entity = getTarget(entity);
        boolean backAnimation = !shouldToBack || stopWatch.isReached(1000);
        animation.setDuration(backAnimation ?500 : 700);
        animation.setDirection(backAnimation ? Direction.BACKWARDS : Direction.FORWARDS);

        if (animation.getOutput() == 0.0f) {
            entity = null;
        }

        if (entity != null) {
            drag.setWidth(width);
            drag.setHeight(height);

            float health = fix1000Health(entity.getHealth());
            float maxHealth = MathHelper.clamp(entity.getMaxHealth(), 0, 24);
            float maxHealth2 = MathHelper.clamp(entity.getMaxHealth(), 0, 26);

            healthAnimation = MathUtil.fast(healthAnimation,
                    MathHelper.clamp(health / maxHealth, 0, 1), 2);
            absorptionAnimation = MathUtil.fast(absorptionAnimation,
                    MathHelper.clamp(entity.getAbsorptionAmount() / maxHealth, 0, 1), 2);

            healthAnimation2 = MathUtil.fast(healthAnimation2,        MathHelper.clamp(health / (maxHealth2 / 8), 0, 1), 1);
            absorptionAnimation2 = MathUtil.fast(absorptionAnimation2,        MathHelper.clamp(entity.getAbsorptionAmount() / (maxHealth2 / 4), 0, 1), 1);

            GlStateManager.pushMatrix();
            setSizeAnimation(animation.getOutput());
            drawBackGround(rounding);
            renderTextThatDisplaysTargetInfo(eventDisplay.getMatrixStack());
            drawTargetHead(entity, posX +  spacing, posY + spacing+2, headSize, headSize);
            renderHealthBar();
            GlStateManager.popMatrix();
        }
    }

    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity auraTarget = NeverBels.getInstance().getFunctionRegistry().getKillAura().getTarget();
        LivingEntity target = nullTarget;
        if (auraTarget != null) {
            stopWatch.reset();
            shouldToBack = true;
            target = auraTarget;
        } else if (mc.currentScreen instanceof ChatScreen) {
            stopWatch.reset();
            shouldToBack = true;
            target = mc.player;
        } else {
            shouldToBack = false;
        }
        return target;
    }

    public void drawTargetHead(LivingEntity entity, float x, float y, float width, float height) {
        if (entity != null) {
            EntityRenderer<? super LivingEntity> rendererManager = mc.getRenderManager().getRenderer(entity);
            drawFace(rendererManager.getEntityTexture(entity), x, y-3, 8F, 8F, 8F, 8F, width, height, 64F, 64F, entity);
        }
    }
    private void renderHealthBar() {
        Style style = NeverBels.getInstance().getStyleManager().getCurrentStyle();
        Vector4i vector4i = new Vector4i(HUD.getColor(0), HUD.getColor(90), HUD.getColor(180), HUD.getColor(170));
        DisplayUtils.drawRoundedRect(posX + 34 + headSize + spacing -32 + spacing, posY - 5.5f + height - spacing * 1 - 2, (width - 38) * healthAnimation, 3.5f, new Vector4f(3,3,3,3), (ColorUtils.setAlpha(ColorUtils.getColor(1), 255)));
    }


    private void renderTextThatDisplaysTargetInfo(MatrixStack matrixStack) {
        Style style = NeverBels.getInstance().getStyleManager().getCurrentStyle();
        float animationValue = (float) animation.getOutput();
        float halfAnimationValueRest = (1 - animationValue) / 2f;
        float testX = posX + (width * halfAnimationValueRest);
        float testY = posY + (height * halfAnimationValueRest);
        float testW = width * animationValue;
        float testH = height * animationValue;
        drawStyledRect(posX, posY, width, height, rounding, 195);
        //рендерится голова
        Stencil.initStencilToWrite();
        DisplayUtils.drawRoundedRect(posX + spacing, posY + spacing + 1, headSize, headSize,2, style.getSecondColor().getRGB() );
        Stencil.readStencilBuffer(1);
        drawTargetHead(entity, posX + spacing, posY + spacing + 2, headSize, headSize);
        Stencil.uninitStencilBuffer();
        Scissor.push();
        Scissor.setFromComponentCoordinates(testX, testY, testW - 1, testH);
        String hpText = "";
        if (entity.isInvisible() && userConnectedToFunTimeAndEntityIsPlayer()) {
            hpText = "Неизвестно";
        } else {
            float health = (float) MathUtil.round(healthAnimation * 20.0f, 0.1f);
            hpText = health * 5 + "%";
}

        Fonts.sfMedium.drawText(matrixStack, TextFormatting.getTextWithoutFormattingCodes(entity.getName().getString()), posX + 10 + headSize + spacing + spacing, posY + 2 + spacing + 1, -1, 8);
        Fonts.sfMedium.drawText(matrixStack, hpText, posX + 20 + headSize + spacing + spacing,
                posY + 5 + spacing + 1 + spacing + spacing, ColorUtils.rgba(255, 255, 255, 255), 6.5F);
        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/heart.png"), posX + 140 * healthAnimation2 / 1.5f , posY + 17 , 7, 7,ColorUtils.rgba(255,255,255,255));

        Scissor.unset();
        Scissor.pop();
    }


    public void setSizeAnimation(double scale) {
        GlStateManager.translated(posX + (width / 2), posY + (height / 2), 0);
        GlStateManager.scaled(scale, scale, scale);
        GlStateManager.translated(-(posX + (width / 2)), -(posY + (height / 2)), 0);
    }

    public void drawFace(ResourceLocation res, float d,
                         float y,
                         float u,
                         float v,
                         float uWidth,
                         float vHeight,
                         float width,
                         float height,
                         float tileWidth,
                         float tileHeight,
                         LivingEntity target) {
        GL11.glPushMatrix();
        GL11.glEnable(GL11.GL_BLEND);
        mc.getTextureManager().bindTexture(res);
        float hurtPercent = (target.hurtTime - (target.hurtTime != 0 ? mc.timer.renderPartialTicks : 0.0f)) / 8.0f;
        GL11.glColor4f(1, 1 - hurtPercent, 1 - hurtPercent, 1);
        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/hud/steve.png"), posX + 6 , posY + 6 , 24, 25,ColorUtils.rgba(255,255,255,255));
        GL11.glColor4f(1, 1, 1, 1);
        GL11.glPopMatrix();
    }

    private float fix1000Health(float original) {
        Score score = mc.world.getScoreboard().getOrCreateScore(entity.getScoreboardName(),
                mc.world.getScoreboard().getObjectiveInDisplaySlot(2));

        return userConnectedToFunTimeAndEntityIsPlayer() ? score.getScorePoints() : original;
    }


    private boolean userConnectedToFunTimeAndEntityIsPlayer() {
        String header = mc.ingameGUI.getTabList().header == null ? " " : mc.ingameGUI.getTabList().header.getString().toLowerCase();
        return (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.contains("funtime")
                && (header.contains("анархия") || header.contains("гриферский")) && entity instanceof PlayerEntity);
    }

    private void drawBackGround(float radius) {
        Vector4i vector4i = new Vector4i(HUD.getColor(50), HUD.getColor(160), HUD.getColor(100), HUD.getColor(80));
       // DisplayUtils.drawRoundedRect(posX + 1, posY + 1, width - 2, height - 2, radius, ColorUtils.rgba(0, 0, 0, 125));
        DisplayUtils.drawRoundedRect(posX + 2, posY + 1, 100.5f, 35, radius, (ColorUtils.rgba(25, 30, 30, 125)));


        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/hud/gradline.png"), posX + 15.5f, posY + 16 , width - 19, 1,ColorUtils.rgba(255,255,255,170));
}
    private void drawStyledRect(float x,
                                float y,
                                float width,
                                float height,
                                float radius, int alpha) {


    }
}
ебучее говно
 
дай пж картинки
Сделал тх за минут 5-10, не больше, думаю многим зайдет.


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




TargetInfoRenderer:
Expand Collapse Copy
ывpackage im.NeverBels.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import im.NeverBels.NeverBels;
import im.NeverBels.events.EventDisplay;
import im.NeverBels.functions.impl.render.HUD;
import im.NeverBels.ui.display.elementRenderer;
import im.NeverBels.ui.styles.Style;
import im.NeverBels.utils.animations.Animation;
import im.NeverBels.utils.animations.Direction;
import im.NeverBels.utils.animations.impl.EaseBackIn;
import im.NeverBels.utils.drag.Dragging;
import im.NeverBels.utils.math.MathUtil;
import im.NeverBels.utils.math.StopWatch;
import im.NeverBels.utils.math.Vector4i;
import im.NeverBels.utils.render.ColorUtils;
import im.NeverBels.utils.render.DisplayUtils;
import im.NeverBels.utils.render.Scissor;
import im.NeverBels.utils.render.Stencil;
import im.NeverBels.utils.render.font.Fonts;
import lombok.AccessLevel;
import lombok.experimental.FieldDefaults;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.scoreboard.Score;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.util.text.TextFormatting;
import org.lwjgl.opengl.GL11;

@FieldDefaults(level = AccessLevel.PRIVATE)
public class TargetInfoRenderer12 implements elementRenderer {
    final StopWatch stopWatch = new StopWatch();
    final Dragging drag;
    LivingEntity entity = null;
    boolean shouldToBack;
    final Animation animation = new EaseBackIn(400, 1, 1);
    float healthAnimation = 0.0f, absorptionAnimation = 0.0f;
    float healthAnimation2 = 0.0f, absorptionAnimation2 = 0.0f;
    float posX, posY;

    static final float width = 102;
    static final float height = 38;
    static final float spacing = 4;
    static final float rounding = 4;
    static final float headSize = 22;

    public TargetInfoRenderer12(Dragging drag) {
        this.drag = drag;
    }

    @Override
    public void render(EventDisplay eventDisplay) {
        posX = drag.getX();
        posY = drag.getY();
        entity = getTarget(entity);
        boolean backAnimation = !shouldToBack || stopWatch.isReached(1000);
        animation.setDuration(backAnimation ?500 : 700);
        animation.setDirection(backAnimation ? Direction.BACKWARDS : Direction.FORWARDS);

        if (animation.getOutput() == 0.0f) {
            entity = null;
        }

        if (entity != null) {
            drag.setWidth(width);
            drag.setHeight(height);

            float health = fix1000Health(entity.getHealth());
            float maxHealth = MathHelper.clamp(entity.getMaxHealth(), 0, 24);
            float maxHealth2 = MathHelper.clamp(entity.getMaxHealth(), 0, 26);

            healthAnimation = MathUtil.fast(healthAnimation,
                    MathHelper.clamp(health / maxHealth, 0, 1), 2);
            absorptionAnimation = MathUtil.fast(absorptionAnimation,
                    MathHelper.clamp(entity.getAbsorptionAmount() / maxHealth, 0, 1), 2);

            healthAnimation2 = MathUtil.fast(healthAnimation2,        MathHelper.clamp(health / (maxHealth2 / 8), 0, 1), 1);
            absorptionAnimation2 = MathUtil.fast(absorptionAnimation2,        MathHelper.clamp(entity.getAbsorptionAmount() / (maxHealth2 / 4), 0, 1), 1);

            GlStateManager.pushMatrix();
            setSizeAnimation(animation.getOutput());
            drawBackGround(rounding);
            renderTextThatDisplaysTargetInfo(eventDisplay.getMatrixStack());
            drawTargetHead(entity, posX +  spacing, posY + spacing+2, headSize, headSize);
            renderHealthBar();
            GlStateManager.popMatrix();
        }
    }

    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity auraTarget = NeverBels.getInstance().getFunctionRegistry().getKillAura().getTarget();
        LivingEntity target = nullTarget;
        if (auraTarget != null) {
            stopWatch.reset();
            shouldToBack = true;
            target = auraTarget;
        } else if (mc.currentScreen instanceof ChatScreen) {
            stopWatch.reset();
            shouldToBack = true;
            target = mc.player;
        } else {
            shouldToBack = false;
        }
        return target;
    }

    public void drawTargetHead(LivingEntity entity, float x, float y, float width, float height) {
        if (entity != null) {
            EntityRenderer<? super LivingEntity> rendererManager = mc.getRenderManager().getRenderer(entity);
            drawFace(rendererManager.getEntityTexture(entity), x, y-3, 8F, 8F, 8F, 8F, width, height, 64F, 64F, entity);
        }
    }
    private void renderHealthBar() {
        Style style = NeverBels.getInstance().getStyleManager().getCurrentStyle();
        Vector4i vector4i = new Vector4i(HUD.getColor(0), HUD.getColor(90), HUD.getColor(180), HUD.getColor(170));
        DisplayUtils.drawRoundedRect(posX + 34 + headSize + spacing -32 + spacing, posY - 5.5f + height - spacing * 1 - 2, (width - 38) * healthAnimation, 3.5f, new Vector4f(3,3,3,3), (ColorUtils.setAlpha(ColorUtils.getColor(1), 255)));
    }


    private void renderTextThatDisplaysTargetInfo(MatrixStack matrixStack) {
        Style style = NeverBels.getInstance().getStyleManager().getCurrentStyle();
        float animationValue = (float) animation.getOutput();
        float halfAnimationValueRest = (1 - animationValue) / 2f;
        float testX = posX + (width * halfAnimationValueRest);
        float testY = posY + (height * halfAnimationValueRest);
        float testW = width * animationValue;
        float testH = height * animationValue;
        drawStyledRect(posX, posY, width, height, rounding, 195);
        //рендерится голова
        Stencil.initStencilToWrite();
        DisplayUtils.drawRoundedRect(posX + spacing, posY + spacing + 1, headSize, headSize,2, style.getSecondColor().getRGB() );
        Stencil.readStencilBuffer(1);
        drawTargetHead(entity, posX + spacing, posY + spacing + 2, headSize, headSize);
        Stencil.uninitStencilBuffer();
        Scissor.push();
        Scissor.setFromComponentCoordinates(testX, testY, testW - 1, testH);
        String hpText = "";
        if (entity.isInvisible() && userConnectedToFunTimeAndEntityIsPlayer()) {
            hpText = "Неизвестно";
        } else {
            float health = (float) MathUtil.round(healthAnimation * 20.0f, 0.1f);
            hpText = health * 5 + "%";
}

        Fonts.sfMedium.drawText(matrixStack, TextFormatting.getTextWithoutFormattingCodes(entity.getName().getString()), posX + 10 + headSize + spacing + spacing, posY + 2 + spacing + 1, -1, 8);
        Fonts.sfMedium.drawText(matrixStack, hpText, posX + 20 + headSize + spacing + spacing,
                posY + 5 + spacing + 1 + spacing + spacing, ColorUtils.rgba(255, 255, 255, 255), 6.5F);
        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/heart.png"), posX + 140 * healthAnimation2 / 1.5f , posY + 17 , 7, 7,ColorUtils.rgba(255,255,255,255));

        Scissor.unset();
        Scissor.pop();
    }


    public void setSizeAnimation(double scale) {
        GlStateManager.translated(posX + (width / 2), posY + (height / 2), 0);
        GlStateManager.scaled(scale, scale, scale);
        GlStateManager.translated(-(posX + (width / 2)), -(posY + (height / 2)), 0);
    }

    public void drawFace(ResourceLocation res, float d,
                         float y,
                         float u,
                         float v,
                         float uWidth,
                         float vHeight,
                         float width,
                         float height,
                         float tileWidth,
                         float tileHeight,
                         LivingEntity target) {
        GL11.glPushMatrix();
        GL11.glEnable(GL11.GL_BLEND);
        mc.getTextureManager().bindTexture(res);
        float hurtPercent = (target.hurtTime - (target.hurtTime != 0 ? mc.timer.renderPartialTicks : 0.0f)) / 8.0f;
        GL11.glColor4f(1, 1 - hurtPercent, 1 - hurtPercent, 1);
        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/hud/steve.png"), posX + 6 , posY + 6 , 24, 25,ColorUtils.rgba(255,255,255,255));
        GL11.glColor4f(1, 1, 1, 1);
        GL11.glPopMatrix();
    }

    private float fix1000Health(float original) {
        Score score = mc.world.getScoreboard().getOrCreateScore(entity.getScoreboardName(),
                mc.world.getScoreboard().getObjectiveInDisplaySlot(2));

        return userConnectedToFunTimeAndEntityIsPlayer() ? score.getScorePoints() : original;
    }


    private boolean userConnectedToFunTimeAndEntityIsPlayer() {
        String header = mc.ingameGUI.getTabList().header == null ? " " : mc.ingameGUI.getTabList().header.getString().toLowerCase();
        return (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.contains("funtime")
                && (header.contains("анархия") || header.contains("гриферский")) && entity instanceof PlayerEntity);
    }

    private void drawBackGround(float radius) {
        Vector4i vector4i = new Vector4i(HUD.getColor(50), HUD.getColor(160), HUD.getColor(100), HUD.getColor(80));
       // DisplayUtils.drawRoundedRect(posX + 1, posY + 1, width - 2, height - 2, radius, ColorUtils.rgba(0, 0, 0, 125));
        DisplayUtils.drawRoundedRect(posX + 2, posY + 1, 100.5f, 35, radius, (ColorUtils.rgba(25, 30, 30, 125)));


        DisplayUtils.drawImage(new ResourceLocation("NeverBels/images/hud/gradline.png"), posX + 15.5f, posY + 16 , width - 19, 1,ColorUtils.rgba(255,255,255,170));
}
    private void drawStyledRect(float x,
                                float y,
                                float width,
                                float height,
                                float radius, int alpha) {


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