Начинающий
- Статус
- Оффлайн
- Регистрация
- 16 Июл 2025
- Сообщения
- 10
- Реакции
- 0
- Выберите загрузчик игры
- Прочие моды
держите мой TargetHUD Если надо измените шрифты drawRoundedOutline есть в теме спастите или замените на drawRoundedRect ну или чо у вас там цвет ректа поменяете
присутсвует полоска геплов
Пожалуйста, авторизуйтесь для просмотра ссылки.
$elfcode:
package ware.leason.ui.display.impl;
import com.mojang.blaze3d.platform.GlStateManager;
import ware.leason.LeasonFree;
import ware.leason.events.EventDisplay;
import ware.leason.events.EventUpdate;
import ware.leason.functions.impl.render.Theme;
import ware.leason.ui.display.ElementRenderer;
import ware.leason.ui.styles.Style;
import ware.leason.utils.animations.Animation;
import ware.leason.utils.animations.Direction;
import ware.leason.utils.animations.impl.EaseBackIn;
import ware.leason.utils.client.ClientUtil;
import ware.leason.utils.drag.Dragging;
import ware.leason.utils.math.MathUtil;
import ware.leason.utils.math.StopWatch;
import ware.leason.utils.math.Vector4i;
import ware.leason.utils.render.ColorUtils;
import ware.leason.utils.render.DisplayUtils;
import ware.leason.utils.render.Scissor;
import ware.leason.utils.render.Stencil;
import ware.leason.utils.render.font.Fonts;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
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.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;
import static ware.leason.utils.render.DisplayUtils.drawRoundedRect;
import static ware.leason.utils.render.DisplayUtils.drawRectHorizontalW;
@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;
@Override
public void update(EventUpdate e) { }
@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 = 28;
float spacing = 5;
float width = 172 / 1.5f;
float height = 59 / 1.5f;
drag.setWidth(width);
drag.setHeight(height);
float hp = entity.getHealth();
float maxHp = entity.getMaxHealth();
float goldenHp = entity.getAbsorptionAmount();
healthAnimation = MathUtil.fast(healthAnimation, MathHelper.clamp(hp / maxHp, 0, 1), 10);
absorptionAnimation = MathUtil.fast(absorptionAnimation, MathHelper.clamp(goldenHp / maxHp, 0, 1), 10);
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;
GlStateManager.pushMatrix();
sizeAnimation(posX + (width / 2), posY + (height / 2), animationValue);
DisplayUtils.drawShadow(posX, posY, width, height, 23, ColorUtils.setAlpha(Theme.getColor(0), 180));
drawStyledRect(posX, posY, width, height, rounding, 255);
Stencil.initStencilToWrite();
drawRoundedRect(posX + spacing, posY + spacing + 1, headSize, headSize, 4, 0xFFFFFFFF);
Stencil.readStencilBuffer(1);
drawTargetHead(entity, posX + spacing, posY + spacing + 1, headSize, headSize);
Stencil.uninitStencilBuffer();
Scissor.push();
Scissor.setFromComponentCoordinates(testX, testY, testW - 6, testH);
Fonts.sfui.drawText(eventDisplay.getMatrixStack(), name, posX + headSize + spacing + spacing, posY + spacing + 1, -1, 8);
Fonts.sfMedium.drawText(eventDisplay.getMatrixStack(), "HP: " + ((int) hp), posX + headSize + spacing + spacing,
posY + spacing + 1 + spacing + spacing, ColorUtils.rgb(200, 200, 200), 7);
Fonts.sfMedium.drawText(eventDisplay.getMatrixStack(), "+ " + ((int) goldenHp), posX + headSize + spacing + 30 + spacing,
posY + spacing + 1 + spacing + spacing, ColorUtils.rgb(255, 200, 0), 7);
Scissor.unset();
Scissor.pop();
drawRoundedRect(posX + headSize + spacing + spacing, posY + height - spacing * 2 - 3, (width - 42), 7,
new Vector4f(1, 1, 1, 1), ColorUtils.rgb(21, 21, 21));
drawRectHorizontalW(posX + headSize + spacing + spacing, posY + height - spacing * 2 - 3, (width - 42) * healthAnimation, 7,
ColorUtils.setAlpha(Theme.getColor(0),180), ColorUtils.setAlpha(Theme.getColor(90), ColorUtils.setAlpha(Theme.getColor(180),180)));
drawRoundedRect(posX + headSize + spacing + spacing, posY + height - spacing * 2 - 3,
(width - 42) * absorptionAnimation, 7, new Vector4f(2, 2, 2, 2), ColorUtils.rgb(255, 200, 0));
DisplayUtils.drawShadow(posX + headSize + spacing + spacing, posY + height - spacing * 2 - 3, (width - 42) * absorptionAnimation, 7, 8, ColorUtils.rgb(255, 215, 0), ColorUtils.rgb(255, 215, 0));
DisplayUtils.drawShadow(posX + headSize + spacing + spacing + (width - 42) * absorptionAnimation, posY + height - spacing * 2 - 3,
(width - 42) * healthAnimation * (1 - absorptionAnimation), 7, 8,
ColorUtils.setAlpha(Theme.getColor(0),180), ColorUtils.setAlpha(Theme.getColor(90), ColorUtils.setAlpha(Theme.getColor(180),180)));
GlStateManager.popMatrix();
}
}
private LivingEntity getTarget(LivingEntity nullTarget) {
LivingEntity auraTarget = LeasonFree.getInstance().getFunctionRegistry().getAttackAura().getTarget();
LivingEntity target = nullTarget;
if (auraTarget != null) {
stopWatch.reset();
allow = true;
target = auraTarget;
} else if (mc.currentScreen instanceof ChatScreen) {
stopWatch.reset();
allow = true;
target = mc.player;
} else allow = false;
return target;
}
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, 8F, 8F, 8F, 8F, width, height, 64F, 64F, entity);
}
}
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);
}
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)) / 10.0f;
GL11.glColor4f(1, 1 - hurtPercent, 1 - hurtPercent, 1);
AbstractGui.drawScaledCustomSizeModalRect(d, y, u, v, uWidth, vHeight, width, height, tileWidth, tileHeight);
GL11.glColor4f(1, 1, 1, 1);
GL11.glPopMatrix();
}
private void drawStyledRect(float x, float y, float width, float height, float radius, int alpha) {
drawRoundedRect(x, y, width, height, radius, ColorUtils.rgba(48, 48, 48, alpha));
DisplayUtils.drawRoundedOutline(x, y , width, height, 6, 2.0f,
new java.awt.Color(Theme.getColor(0, 2.0f)));
}
}
присутсвует полоска геплов
