Подпишитесь на наш Telegram-канал, чтобы всегда быть в курсе важных обновлений! Перейти

Визуальная часть TargetHud | Exp 3.1

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
12 Июн 2025
Сообщения
35
Реакции
0
Выберите загрузчик игры
  1. Прочие моды
Попытка скида диклиента не увенчалась успехом, может кому зайдет думаю если доделать будет нормас
Код:
Expand Collapse Copy
package im.expensive.ui.display.impl;

import com.mojang.blaze3d.platform.GlStateManager;
import im.expensive.Expensive;
import im.expensive.events.EventDisplay;
import im.expensive.ui.display.ElementRenderer;
import im.expensive.ui.styles.Style;
import im.expensive.utils.animations.Animation;
import im.expensive.utils.animations.Direction;
import im.expensive.utils.animations.impl.EaseBackIn;
import im.expensive.utils.client.ClientUtil;
import im.expensive.utils.drag.Dragging;
import im.expensive.utils.math.MathUtil;
import im.expensive.utils.math.StopWatch;
import im.expensive.utils.math.Vector4i;
import im.expensive.utils.render.ColorUtils;
import im.expensive.utils.render.DisplayUtils;
import im.expensive.utils.render.RenderUtil;
import im.expensive.utils.render.Scissor;
import im.expensive.utils.render.font.Fonts;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
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 org.lwjgl.opengl.GL11;

@FieldDefaults(level = AccessLevel.PRIVATE)
@RequiredArgsConstructor
public class TargetInfoRenderer implements ElementRenderer {
    final StopWatch stopWatch = new StopWatch();
    final Dragging drag;
    LivingEntity entity = null;
    boolean allow;
    final Animation animation = new EaseBackIn(400, 1, 1);
    float healthAnimation = 0.0f;
    float absorptionAnimation = 0.0f;
    float damageAnimation = 0.0f;
    float lastHealth = 0.0f;

    @Override
    public void render(EventDisplay eventDisplay) {
        entity = getTarget(entity);

        float rounding = 6;
        boolean out = !allow || stopWatch.isReached(1000);
        animation.setDuration(out ? 400 : 300);
        animation.setDirection(out ? Direction.BACKWARDS : Direction.FORWARDS);

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

        if (entity != null) {
            String name = entity.getName().getString();

            float posX = drag.getX();
            float posY = drag.getY();

            float headSize = 32;
            float spacing = 5;

            float width = 120;
            float height = 42;
            drag.setWidth(width);
            drag.setHeight(height);
            float shrinking = 1.5f;
            Score score = mc.world.getScoreboard().getOrCreateScore(entity.getScoreboardName(), mc.world.getScoreboard().getObjectiveInDisplaySlot(2));


            float hp = entity.getHealth();
            float maxHp = entity.getMaxHealth();
            String header = mc.ingameGUI.getTabList().header == null ? " " : mc.ingameGUI.getTabList().header.getString().toLowerCase();

            if (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.contains("funtime")
                    && (header.contains("анархия") || header.contains("гриферский")) && entity instanceof PlayerEntity) {
                hp = score.getScorePoints();
                maxHp = 20;
            }
            float currentHealthPercent = MathHelper.clamp(hp / maxHp, 0, 1);
            float absorptionPercent = MathHelper.clamp(entity.getAbsorptionAmount() / maxHp, 0, 1);
        
            if (hp < lastHealth) {
                damageAnimation = MathHelper.clamp(lastHealth / maxHp, 0, 1);
            }
            damageAnimation = MathUtil.fast(damageAnimation, currentHealthPercent, 4);
            lastHealth = hp;
        
            healthAnimation = MathUtil.fast(healthAnimation, currentHealthPercent, 10);
            absorptionAnimation = MathUtil.fast(absorptionAnimation, absorptionPercent, 10);


            if (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.contains("funtime")
                    && (header.contains("анархия") || header.contains("гриферский")) && entity instanceof PlayerEntity) {
                hp = score.getScorePoints();
                maxHp = 20;
            }


            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;
            int windowWidth = ClientUtil.calc(mc.getMainWindow().getScaledWidth());

            GlStateManager.pushMatrix();
            Style style = Expensive.getInstance().getStyleManager().getCurrentStyle();

            sizeAnimation(posX + (width / 2), posY + (height / 2), animation.getOutput());
            DisplayUtils.drawShadow(posX, posY, width, height, 10, style.getFirstColor().getRGB(), style.getSecondColor().getRGB());
            drawStyledRect(posX, posY, width, height, rounding, 255);
            float hurtPercent = (entity.hurtTime - (entity.hurtTime != 0 ? mc.timer.renderPartialTicks : 0.0f)) / 10.0f;
            String rs = EntityType.getKey(((Entity)entity).getType()).getPath();
            ResourceLocation skin = entity instanceof AbstractClientPlayerEntity e ? (e).getLocationSkin() : new ResourceLocation("textures/entity/"+rs+".png");
            RenderUtil.drawHead(skin, posX + spacing - 2, posY + (height - headSize) / 2 - 3, headSize + 5, headSize + 5, 4, 1, hurtPercent);
            Scissor.push();
            Scissor.setFromComponentCoordinates(testX, testY, testW - 3, testH);
            Fonts.sfui.drawText(eventDisplay.getMatrixStack(), entity.getName().getString(), posX + headSize + spacing + spacing, posY + (height - headSize) / 2 + 2, -1, 8);
            String mainHpText = "HP: " + String.format("%.1f", hp);
            Fonts.sfui.drawText(eventDisplay.getMatrixStack(), mainHpText, posX + headSize + spacing + spacing,
                    posY + (height - headSize) / 2 + 12, ColorUtils.rgb(200, 200, 200), 7);
        
            if (entity.getAbsorptionAmount() > 0) {
                String absorptionText = "HP: " + String.format("%.1f", entity.getAbsorptionAmount());
                float absorptionTextWidth = Fonts.sfui.getWidth(absorptionText, 7);
                float absorptionX = posX + width - spacing - absorptionTextWidth;
            
                int brightYellow = ColorUtils.rgb(255, 255, 0);
                Fonts.sfui.drawText(eventDisplay.getMatrixStack(), absorptionText, absorptionX,
                        posY + (height - headSize) / 2 + 12, brightYellow, 7);
            }
        
            Scissor.unset();
            Scissor.pop();

            Vector4i vector4i = new Vector4i(style.getFirstColor().getRGB(), style.getFirstColor().getRGB(), style.getSecondColor().getRGB(), style.getSecondColor().getRGB());

            float barX = posX + headSize + spacing + spacing;
            float barY = posY + height - spacing - 10;
            float barWidth = width - headSize - spacing * 3;
            float barHeight = 8;
        
        
            DisplayUtils.drawRoundedRect(barX, barY, barWidth, barHeight, new Vector4f(4, 4, 4, 4), ColorUtils.rgb(32, 32, 32));
        
            if (damageAnimation > healthAnimation) {
                DisplayUtils.drawRoundedRect(barX, barY, barWidth * damageAnimation, barHeight,
                    new Vector4f(4, 4, 4, 4), ColorUtils.rgba(160, 160, 160, 255));
            }
        
            DisplayUtils.drawRoundedRect(barX, barY, barWidth * healthAnimation, barHeight,
                new Vector4f(4, 4, 4, 4), vector4i);
            
            if (absorptionAnimation > 0) {
                float absorptionWidth = barWidth * absorptionAnimation;
                float absorptionX = barX + barWidth - absorptionWidth;
            
                int brightYellow = ColorUtils.rgba(255, 255, 0, 200);
            
                DisplayUtils.drawRoundedRect(absorptionX, barY, absorptionWidth, barHeight,
                    new Vector4f(4, 4, 4, 4), brightYellow);
            }

            GlStateManager.popMatrix();
        }
    }


    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity killAuraTarget = Expensive.getInstance().getFunctionRegistry().getKillAura().getTarget();
    
        LivingEntity lgauraTarget = null;
        try {
            lgauraTarget = im.expensive.functions.impl.combat.Lgaura.target;
        } catch (Exception ignored) {}
    
        LivingEntity target = nullTarget;
        if (lgauraTarget != null) {
            stopWatch.reset();
            allow = true;
            target = lgauraTarget;
        } else if (killAuraTarget != null) {
            stopWatch.reset();
            allow = true;
            target = killAuraTarget;
        } else if (mc.currentScreen instanceof ChatScreen) {
            stopWatch.reset();
            allow = true;
            target = mc.player;
        } else {
            allow = false;
        }
        return target;
    }


    public static void sizeAnimation(double width, double height, double scale) {
        GlStateManager.translated(width, height, 0);
        GlStateManager.scaled(scale, scale, scale);
        GlStateManager.translated(-width, -height, 0);
    }


    private void drawStyledRect(float x,
                                float y,
                                float width,
                                float height,
                                float radius, int alpha) {
        Style style = Expensive.getInstance().getStyleManager().getCurrentStyle();

        DisplayUtils.drawRoundedRect(x - 0.5f, y - 0.5f, width + 1, height + 1, radius + 0.5f, ColorUtils.setAlpha(ColorUtils.getColor(0), alpha)); // outline
        DisplayUtils.drawRoundedRect(x, y, width, height, radius, ColorUtils.rgba(21, 21, 21, alpha));
    }
}
 

Вложения

  • Снимок.PNG
    Снимок.PNG
    93.3 KB · Просмотры: 451
  • Снимок.PNG
    Снимок.PNG
    60.7 KB · Просмотры: 444
Последнее редактирование:
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
бляяя какое же дерьмо /del
 
Попытка скида диклиента не увенчалась успехом, может кому зайдет думаю если доделать будет нормас
Код:
Expand Collapse Copy
package im.expensive.ui.display.impl;

import com.mojang.blaze3d.platform.GlStateManager;
import im.expensive.Expensive;
import im.expensive.events.EventDisplay;
import im.expensive.ui.display.ElementRenderer;
import im.expensive.ui.styles.Style;
import im.expensive.utils.animations.Animation;
import im.expensive.utils.animations.Direction;
import im.expensive.utils.animations.impl.EaseBackIn;
import im.expensive.utils.client.ClientUtil;
import im.expensive.utils.drag.Dragging;
import im.expensive.utils.math.MathUtil;
import im.expensive.utils.math.StopWatch;
import im.expensive.utils.math.Vector4i;
import im.expensive.utils.render.ColorUtils;
import im.expensive.utils.render.DisplayUtils;
import im.expensive.utils.render.RenderUtil;
import im.expensive.utils.render.Scissor;
import im.expensive.utils.render.font.Fonts;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
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 org.lwjgl.opengl.GL11;

@FieldDefaults(level = AccessLevel.PRIVATE)
@RequiredArgsConstructor
public class TargetInfoRenderer implements ElementRenderer {
    final StopWatch stopWatch = new StopWatch();
    final Dragging drag;
    LivingEntity entity = null;
    boolean allow;
    final Animation animation = new EaseBackIn(400, 1, 1);
    float healthAnimation = 0.0f;
    float absorptionAnimation = 0.0f;
    float damageAnimation = 0.0f;
    float lastHealth = 0.0f;

    @Override
    public void render(EventDisplay eventDisplay) {
        entity = getTarget(entity);

        float rounding = 6;
        boolean out = !allow || stopWatch.isReached(1000);
        animation.setDuration(out ? 400 : 300);
        animation.setDirection(out ? Direction.BACKWARDS : Direction.FORWARDS);

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

        if (entity != null) {
            String name = entity.getName().getString();

            float posX = drag.getX();
            float posY = drag.getY();

            float headSize = 32;
            float spacing = 5;

            float width = 120;
            float height = 42;
            drag.setWidth(width);
            drag.setHeight(height);
            float shrinking = 1.5f;
            Score score = mc.world.getScoreboard().getOrCreateScore(entity.getScoreboardName(), mc.world.getScoreboard().getObjectiveInDisplaySlot(2));


            float hp = entity.getHealth();
            float maxHp = entity.getMaxHealth();
            String header = mc.ingameGUI.getTabList().header == null ? " " : mc.ingameGUI.getTabList().header.getString().toLowerCase();

            if (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.contains("funtime")
                    && (header.contains("анархия") || header.contains("гриферский")) && entity instanceof PlayerEntity) {
                hp = score.getScorePoints();
                maxHp = 20;
            }
            float currentHealthPercent = MathHelper.clamp(hp / maxHp, 0, 1);
            float absorptionPercent = MathHelper.clamp(entity.getAbsorptionAmount() / maxHp, 0, 1);
       
            if (hp < lastHealth) {
                damageAnimation = MathHelper.clamp(lastHealth / maxHp, 0, 1);
            }
            damageAnimation = MathUtil.fast(damageAnimation, currentHealthPercent, 4);
            lastHealth = hp;
       
            healthAnimation = MathUtil.fast(healthAnimation, currentHealthPercent, 10);
            absorptionAnimation = MathUtil.fast(absorptionAnimation, absorptionPercent, 10);


            if (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.contains("funtime")
                    && (header.contains("анархия") || header.contains("гриферский")) && entity instanceof PlayerEntity) {
                hp = score.getScorePoints();
                maxHp = 20;
            }


            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;
            int windowWidth = ClientUtil.calc(mc.getMainWindow().getScaledWidth());

            GlStateManager.pushMatrix();
            Style style = Expensive.getInstance().getStyleManager().getCurrentStyle();

            sizeAnimation(posX + (width / 2), posY + (height / 2), animation.getOutput());
            DisplayUtils.drawShadow(posX, posY, width, height, 10, style.getFirstColor().getRGB(), style.getSecondColor().getRGB());
            drawStyledRect(posX, posY, width, height, rounding, 255);
            float hurtPercent = (entity.hurtTime - (entity.hurtTime != 0 ? mc.timer.renderPartialTicks : 0.0f)) / 10.0f;
            String rs = EntityType.getKey(((Entity)entity).getType()).getPath();
            ResourceLocation skin = entity instanceof AbstractClientPlayerEntity e ? (e).getLocationSkin() : new ResourceLocation("textures/entity/"+rs+".png");
            RenderUtil.drawHead(skin, posX + spacing - 2, posY + (height - headSize) / 2 - 3, headSize + 5, headSize + 5, 4, 1, hurtPercent);
            Scissor.push();
            Scissor.setFromComponentCoordinates(testX, testY, testW - 3, testH);
            Fonts.sfui.drawText(eventDisplay.getMatrixStack(), entity.getName().getString(), posX + headSize + spacing + spacing, posY + (height - headSize) / 2 + 2, -1, 8);
            String mainHpText = "HP: " + String.format("%.1f", hp);
            Fonts.sfui.drawText(eventDisplay.getMatrixStack(), mainHpText, posX + headSize + spacing + spacing,
                    posY + (height - headSize) / 2 + 12, ColorUtils.rgb(200, 200, 200), 7);
       
            if (entity.getAbsorptionAmount() > 0) {
                String absorptionText = "HP: " + String.format("%.1f", entity.getAbsorptionAmount());
                float absorptionTextWidth = Fonts.sfui.getWidth(absorptionText, 7);
                float absorptionX = posX + width - spacing - absorptionTextWidth;
           
                int brightYellow = ColorUtils.rgb(255, 255, 0);
                Fonts.sfui.drawText(eventDisplay.getMatrixStack(), absorptionText, absorptionX,
                        posY + (height - headSize) / 2 + 12, brightYellow, 7);
            }
       
            Scissor.unset();
            Scissor.pop();

            Vector4i vector4i = new Vector4i(style.getFirstColor().getRGB(), style.getFirstColor().getRGB(), style.getSecondColor().getRGB(), style.getSecondColor().getRGB());

            float barX = posX + headSize + spacing + spacing;
            float barY = posY + height - spacing - 10;
            float barWidth = width - headSize - spacing * 3;
            float barHeight = 8;
       
       
            DisplayUtils.drawRoundedRect(barX, barY, barWidth, barHeight, new Vector4f(4, 4, 4, 4), ColorUtils.rgb(32, 32, 32));
       
            if (damageAnimation > healthAnimation) {
                DisplayUtils.drawRoundedRect(barX, barY, barWidth * damageAnimation, barHeight,
                    new Vector4f(4, 4, 4, 4), ColorUtils.rgba(160, 160, 160, 255));
            }
       
            DisplayUtils.drawRoundedRect(barX, barY, barWidth * healthAnimation, barHeight,
                new Vector4f(4, 4, 4, 4), vector4i);
           
            if (absorptionAnimation > 0) {
                float absorptionWidth = barWidth * absorptionAnimation;
                float absorptionX = barX + barWidth - absorptionWidth;
           
                int brightYellow = ColorUtils.rgba(255, 255, 0, 200);
           
                DisplayUtils.drawRoundedRect(absorptionX, barY, absorptionWidth, barHeight,
                    new Vector4f(4, 4, 4, 4), brightYellow);
            }

            GlStateManager.popMatrix();
        }
    }


    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity killAuraTarget = Expensive.getInstance().getFunctionRegistry().getKillAura().getTarget();
   
        LivingEntity lgauraTarget = null;
        try {
            lgauraTarget = im.expensive.functions.impl.combat.Lgaura.target;
        } catch (Exception ignored) {}
   
        LivingEntity target = nullTarget;
        if (lgauraTarget != null) {
            stopWatch.reset();
            allow = true;
            target = lgauraTarget;
        } else if (killAuraTarget != null) {
            stopWatch.reset();
            allow = true;
            target = killAuraTarget;
        } else if (mc.currentScreen instanceof ChatScreen) {
            stopWatch.reset();
            allow = true;
            target = mc.player;
        } else {
            allow = false;
        }
        return target;
    }


    public static void sizeAnimation(double width, double height, double scale) {
        GlStateManager.translated(width, height, 0);
        GlStateManager.scaled(scale, scale, scale);
        GlStateManager.translated(-width, -height, 0);
    }


    private void drawStyledRect(float x,
                                float y,
                                float width,
                                float height,
                                float radius, int alpha) {
        Style style = Expensive.getInstance().getStyleManager().getCurrentStyle();

        DisplayUtils.drawRoundedRect(x - 0.5f, y - 0.5f, width + 1, height + 1, radius + 0.5f, ColorUtils.setAlpha(ColorUtils.getColor(0), alpha)); // outline
        DisplayUtils.drawRoundedRect(x, y, width, height, radius, ColorUtils.rgba(21, 21, 21, alpha));
    }
}
зач ты это выкладываеш если его делать не сложно так ты еще его и криво сделал
 
Попытка скида диклиента не увенчалась успехом, может кому зайдет думаю если доделать будет нормас
Код:
Expand Collapse Copy
package im.expensive.ui.display.impl;

import com.mojang.blaze3d.platform.GlStateManager;
import im.expensive.Expensive;
import im.expensive.events.EventDisplay;
import im.expensive.ui.display.ElementRenderer;
import im.expensive.ui.styles.Style;
import im.expensive.utils.animations.Animation;
import im.expensive.utils.animations.Direction;
import im.expensive.utils.animations.impl.EaseBackIn;
import im.expensive.utils.client.ClientUtil;
import im.expensive.utils.drag.Dragging;
import im.expensive.utils.math.MathUtil;
import im.expensive.utils.math.StopWatch;
import im.expensive.utils.math.Vector4i;
import im.expensive.utils.render.ColorUtils;
import im.expensive.utils.render.DisplayUtils;
import im.expensive.utils.render.RenderUtil;
import im.expensive.utils.render.Scissor;
import im.expensive.utils.render.font.Fonts;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
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 org.lwjgl.opengl.GL11;

@FieldDefaults(level = AccessLevel.PRIVATE)
@RequiredArgsConstructor
public class TargetInfoRenderer implements ElementRenderer {
    final StopWatch stopWatch = new StopWatch();
    final Dragging drag;
    LivingEntity entity = null;
    boolean allow;
    final Animation animation = new EaseBackIn(400, 1, 1);
    float healthAnimation = 0.0f;
    float absorptionAnimation = 0.0f;
    float damageAnimation = 0.0f;
    float lastHealth = 0.0f;

    @Override
    public void render(EventDisplay eventDisplay) {
        entity = getTarget(entity);

        float rounding = 6;
        boolean out = !allow || stopWatch.isReached(1000);
        animation.setDuration(out ? 400 : 300);
        animation.setDirection(out ? Direction.BACKWARDS : Direction.FORWARDS);

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

        if (entity != null) {
            String name = entity.getName().getString();

            float posX = drag.getX();
            float posY = drag.getY();

            float headSize = 32;
            float spacing = 5;

            float width = 120;
            float height = 42;
            drag.setWidth(width);
            drag.setHeight(height);
            float shrinking = 1.5f;
            Score score = mc.world.getScoreboard().getOrCreateScore(entity.getScoreboardName(), mc.world.getScoreboard().getObjectiveInDisplaySlot(2));


            float hp = entity.getHealth();
            float maxHp = entity.getMaxHealth();
            String header = mc.ingameGUI.getTabList().header == null ? " " : mc.ingameGUI.getTabList().header.getString().toLowerCase();

            if (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.contains("funtime")
                    && (header.contains("анархия") || header.contains("гриферский")) && entity instanceof PlayerEntity) {
                hp = score.getScorePoints();
                maxHp = 20;
            }
            float currentHealthPercent = MathHelper.clamp(hp / maxHp, 0, 1);
            float absorptionPercent = MathHelper.clamp(entity.getAbsorptionAmount() / maxHp, 0, 1);
       
            if (hp < lastHealth) {
                damageAnimation = MathHelper.clamp(lastHealth / maxHp, 0, 1);
            }
            damageAnimation = MathUtil.fast(damageAnimation, currentHealthPercent, 4);
            lastHealth = hp;
       
            healthAnimation = MathUtil.fast(healthAnimation, currentHealthPercent, 10);
            absorptionAnimation = MathUtil.fast(absorptionAnimation, absorptionPercent, 10);


            if (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.contains("funtime")
                    && (header.contains("анархия") || header.contains("гриферский")) && entity instanceof PlayerEntity) {
                hp = score.getScorePoints();
                maxHp = 20;
            }


            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;
            int windowWidth = ClientUtil.calc(mc.getMainWindow().getScaledWidth());

            GlStateManager.pushMatrix();
            Style style = Expensive.getInstance().getStyleManager().getCurrentStyle();

            sizeAnimation(posX + (width / 2), posY + (height / 2), animation.getOutput());
            DisplayUtils.drawShadow(posX, posY, width, height, 10, style.getFirstColor().getRGB(), style.getSecondColor().getRGB());
            drawStyledRect(posX, posY, width, height, rounding, 255);
            float hurtPercent = (entity.hurtTime - (entity.hurtTime != 0 ? mc.timer.renderPartialTicks : 0.0f)) / 10.0f;
            String rs = EntityType.getKey(((Entity)entity).getType()).getPath();
            ResourceLocation skin = entity instanceof AbstractClientPlayerEntity e ? (e).getLocationSkin() : new ResourceLocation("textures/entity/"+rs+".png");
            RenderUtil.drawHead(skin, posX + spacing - 2, posY + (height - headSize) / 2 - 3, headSize + 5, headSize + 5, 4, 1, hurtPercent);
            Scissor.push();
            Scissor.setFromComponentCoordinates(testX, testY, testW - 3, testH);
            Fonts.sfui.drawText(eventDisplay.getMatrixStack(), entity.getName().getString(), posX + headSize + spacing + spacing, posY + (height - headSize) / 2 + 2, -1, 8);
            String mainHpText = "HP: " + String.format("%.1f", hp);
            Fonts.sfui.drawText(eventDisplay.getMatrixStack(), mainHpText, posX + headSize + spacing + spacing,
                    posY + (height - headSize) / 2 + 12, ColorUtils.rgb(200, 200, 200), 7);
       
            if (entity.getAbsorptionAmount() > 0) {
                String absorptionText = "HP: " + String.format("%.1f", entity.getAbsorptionAmount());
                float absorptionTextWidth = Fonts.sfui.getWidth(absorptionText, 7);
                float absorptionX = posX + width - spacing - absorptionTextWidth;
           
                int brightYellow = ColorUtils.rgb(255, 255, 0);
                Fonts.sfui.drawText(eventDisplay.getMatrixStack(), absorptionText, absorptionX,
                        posY + (height - headSize) / 2 + 12, brightYellow, 7);
            }
       
            Scissor.unset();
            Scissor.pop();

            Vector4i vector4i = new Vector4i(style.getFirstColor().getRGB(), style.getFirstColor().getRGB(), style.getSecondColor().getRGB(), style.getSecondColor().getRGB());

            float barX = posX + headSize + spacing + spacing;
            float barY = posY + height - spacing - 10;
            float barWidth = width - headSize - spacing * 3;
            float barHeight = 8;
       
       
            DisplayUtils.drawRoundedRect(barX, barY, barWidth, barHeight, new Vector4f(4, 4, 4, 4), ColorUtils.rgb(32, 32, 32));
       
            if (damageAnimation > healthAnimation) {
                DisplayUtils.drawRoundedRect(barX, barY, barWidth * damageAnimation, barHeight,
                    new Vector4f(4, 4, 4, 4), ColorUtils.rgba(160, 160, 160, 255));
            }
       
            DisplayUtils.drawRoundedRect(barX, barY, barWidth * healthAnimation, barHeight,
                new Vector4f(4, 4, 4, 4), vector4i);
           
            if (absorptionAnimation > 0) {
                float absorptionWidth = barWidth * absorptionAnimation;
                float absorptionX = barX + barWidth - absorptionWidth;
           
                int brightYellow = ColorUtils.rgba(255, 255, 0, 200);
           
                DisplayUtils.drawRoundedRect(absorptionX, barY, absorptionWidth, barHeight,
                    new Vector4f(4, 4, 4, 4), brightYellow);
            }

            GlStateManager.popMatrix();
        }
    }


    private LivingEntity getTarget(LivingEntity nullTarget) {
        LivingEntity killAuraTarget = Expensive.getInstance().getFunctionRegistry().getKillAura().getTarget();
   
        LivingEntity lgauraTarget = null;
        try {
            lgauraTarget = im.expensive.functions.impl.combat.Lgaura.target;
        } catch (Exception ignored) {}
   
        LivingEntity target = nullTarget;
        if (lgauraTarget != null) {
            stopWatch.reset();
            allow = true;
            target = lgauraTarget;
        } else if (killAuraTarget != null) {
            stopWatch.reset();
            allow = true;
            target = killAuraTarget;
        } else if (mc.currentScreen instanceof ChatScreen) {
            stopWatch.reset();
            allow = true;
            target = mc.player;
        } else {
            allow = false;
        }
        return target;
    }


    public static void sizeAnimation(double width, double height, double scale) {
        GlStateManager.translated(width, height, 0);
        GlStateManager.scaled(scale, scale, scale);
        GlStateManager.translated(-width, -height, 0);
    }


    private void drawStyledRect(float x,
                                float y,
                                float width,
                                float height,
                                float radius, int alpha) {
        Style style = Expensive.getInstance().getStyleManager().getCurrentStyle();

        DisplayUtils.drawRoundedRect(x - 0.5f, y - 0.5f, width + 1, height + 1, radius + 0.5f, ColorUtils.setAlpha(ColorUtils.getColor(0), alpha)); // outline
        DisplayUtils.drawRoundedRect(x, y, width, height, radius, ColorUtils.rgba(21, 21, 21, alpha));
    }
}
бля глаза
 
Назад
Сверху Снизу