Исходник Вырвиглазный HUD exp 2.0

Пользователь
Статус
Оффлайн
Регистрация
13 Сен 2021
Сообщения
633
Реакции[?]
117
Поинты[?]
44K
Делал Я + ChatGPT
Пожалуйста, авторизуйтесь для просмотра ссылки.

Java:
package wtf.expensive.modules.impl.render;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.MainWindow;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.AirItem;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Team;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.util.text.ITextComponent;
import org.joml.Vector4i;
import wtf.expensive.Initilization;
import wtf.expensive.events.Event;
import wtf.expensive.events.impl.player.EventUpdate;
import wtf.expensive.events.impl.render.EventRender;
import wtf.expensive.managment.Managment;
import wtf.expensive.modules.Function;
import wtf.expensive.modules.FunctionAnnotation;
import wtf.expensive.modules.Type;
import wtf.expensive.modules.settings.imp.BooleanOption;
import wtf.expensive.modules.settings.imp.MultiBoxSetting;
import wtf.expensive.modules.settings.imp.SliderSetting;
import wtf.expensive.util.BetterText;
import wtf.expensive.util.ClientUtil;
import wtf.expensive.util.animations.Animation;
import wtf.expensive.util.animations.Direction;
import wtf.expensive.util.animations.impl.EaseBackIn;
import wtf.expensive.util.drag.Dragging;
import wtf.expensive.util.font.Fonts;
import wtf.expensive.util.font.styled.StyledFont;
import wtf.expensive.util.math.MathUtil;
import wtf.expensive.util.misc.HudUtil;
import wtf.expensive.util.render.BloomHelper;
import wtf.expensive.util.render.ColorUtil;
import wtf.expensive.util.render.RenderUtil;
import wtf.expensive.util.render.animation.AnimationMath;

import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;

import static wtf.expensive.util.render.RenderUtil.Render2D.drawFace;

@FunctionAnnotation(name = "HUD", type = Type.Render)
public class HUD2 extends Function {

public final MultiBoxSetting elements = new MultiBoxSetting("Элементы",
new BooleanOption("Ватермарка", true),
new BooleanOption("Активные функции", true),
new BooleanOption("Координаты", true),
new BooleanOption("Активный таргет", true),
new BooleanOption("Активные стаффы", true),
new BooleanOption("Активные бинды", true),
new BooleanOption("Активные эффекты", true),
new BooleanOption("Уведомления", true)
);

public final BooleanOption shadow = new BooleanOption("Тень", true);

private final SliderSetting offset = new SliderSetting("Отступ", 5, 1, 10, 1);

public HUD2() {
addSettings(elements, shadow, offset);
}

final float round_degree = 3;

final float cWidth = 4;

final Vector4f left_vec = new Vector4f(round_degree, round_degree, 0, 0);
final Vector4f right_vec = new Vector4f(0, 0, round_degree, round_degree);

final int b_color = new Color(0, 0, 0, 128).getRGB();
final int t_color = Color.WHITE.getRGB();

int[] colors = new int[360];

final StyledFont icons = Fonts.icons1[20];
final StyledFont medium = Fonts.msMedium[16];
final StyledFont small = Fonts.msMedium[14];

MainWindow window;

List<Function> functions = new ArrayList<>();

final Dragging keyBinds = Initilization.createDrag(this, "KeyBinds-new", 10, 100);
final Dragging staffList = Initilization.createDrag(this, "StaffList-new", 10, 200);

final Dragging targetHUD = Initilization.createDrag(this, "TargetHUD-new", 10, 300);
final Dragging timerHUD = Initilization.createDrag(this, "TimerHUD-new", 10, 400);

Animation tHudAnimation = new EaseBackIn(400, 1, 1.5f);
PlayerEntity target = null;

private final Pattern namePattern = Pattern.compile("^\\w{3,16}$");
private final Pattern prefixMatches = Pattern.compile(".*(mod|der|adm|help|wne|мод|хелп|помо|адм|владе|отри|таф|taf|curat|курато|dev|раз|supp|сапп|yt|ютуб).*");

private final Map<ITextComponent, String> staffPlayers = new LinkedHashMap<>();

@Override
public void onEvent(Event event) {
if (mc.player == null || mc.world == null) return;

if (event instanceof EventUpdate) {
staffPlayers.clear();

for (ScorePlayerTeam team : mc.world.getScoreboard().getTeams().stream().sorted(Comparator.comparing(Team::getName)).toList()) {
String name = team.getMembershipCollection().toString();
name = name.substring(1, name.length() - 1);
if (namePattern.matcher(name).matches()) {
if (prefixMatches.matcher(team.getPrefix().getString().toLowerCase(Locale.ROOT)).matches() || Managment.STAFF_MANAGER.isStaff(name)) {
staffPlayers.put(team.getPrefix(), name);
}
}
}

if (Managment.FUNCTION_MANAGER.getFunctions().isEmpty() || !functions.isEmpty()) return;
updateFunctions();
}

if (event instanceof EventRender e && e.isRender2D()) {
for (int i = 0; i < colors.length; i++) {
colors[i] = Managment.STYLE_MANAGER.getCurrentStyle().getColor(i);
}

window = e.scaledResolution;

final int offset = this.offset.getValue().intValue();
final MatrixStack matrixStack = e.matrixStack;

if (elements.get(0)) renderWatermark(matrixStack, offset);
if (elements.get(1)) renderFunctions(matrixStack, offset);
if (elements.get(2)) renderCoordinates(matrixStack, offset);
if (elements.get(3)) renderTarget(matrixStack);
if (elements.get(4)) renderStaffList(matrixStack);
if (elements.get(5)) renderKeyBinds(matrixStack);
if (elements.get(6)) renderPotions(matrixStack, offset);
}
}

BetterText betterText = new BetterText(List.of("",
"Лучший из лучших",
"Всегда на высоте",
"Наивысший стандарт качества",
"Лучший выбор",
"Всегда превосходно",
"Надежно и качественно"), 2000);

private void renderWatermark(MatrixStack matrixStack, int offset) {
float staticTextWidth = Fonts.msSemiBold[15].getWidth("Expensive");
float animatedTextWidth = Fonts.msSemiBold[15].getWidth(betterText.output);
float maxWidth = Math.max(staticTextWidth, animatedTextWidth);
float width = Math.max(80, maxWidth + 20);
float height = 28;

Vector4i gradientColors = new Vector4i(getColor(0), getColor(50), getColor(100), getColor(150));

RenderUtil.Render2D.drawGradientRound(offset, offset, width, height, 4.0f, gradientColors.x, gradientColors.y, gradientColors.z, gradientColors.w);

if (shadow.get()) {
RenderUtil.Render2D.drawShadow(offset - 1, offset - 1, width + 2, height + 2, 8, RenderUtil.reAlphaInt(b_color, 50));
}

Fonts.msSemiBold[15].drawString(matrixStack, "Expensive", offset + 10, offset + 6f, t_color);
Fonts.msSemiBold[15].drawString(matrixStack, betterText.output, offset + 10, offset + 18f, t_color);
}

private void renderFunctions(MatrixStack matrixStack, int offset) {
float padding = 4;
float dumbOffset = 1.5f;
float height = small.getFontHeight() - dumbOffset + padding;

List<Function> fs = new ArrayList<>();
for (Function f : functions) {
f.animation = AnimationMath.fast(f.animation, f.state ? 1 : 0, 15);
if (f.animation < 0.1) continue;
fs.add(f);
}

float index = 0;
for (Function f : fs) {
float width = small.getWidth(f.name) + (padding * 2);
float r_posX = window.scaledWidth() - offset - width;
float r_posY = offset + (index * height);

Vector4i gradientColors = new Vector4i(getColor(0), getColor(50), getColor(100), getColor(150));

RenderUtil.Render2D.drawGradientRound(r_posX - cWidth, r_posY, width, height, 4.0f, gradientColors.x, gradientColors.y, gradientColors.z, gradientColors.w);

if (shadow.get()) {
RenderUtil.Render2D.drawShadow(r_posX - cWidth - 1, r_posY - 1, width + 2, height + 2, 8, RenderUtil.reAlphaInt(b_color, 50));
}

small.drawCenteredString(matrixStack, f.name, r_posX + width / 2 - cWidth, r_posY - dumbOffset + (height / 2), -1);
index += f.animation;
}
}

private void renderPotions(MatrixStack matrixStack, int offset) {
float height = 12;
float posY = window.scaledHeight() - offset - height;

int index = 0;
for (EffectInstance eff : mc.player.getActivePotionEffects().stream().sorted(Comparator.comparing(EffectInstance::getDuration)).toList()) {
String text = I18n.format(eff.getEffectName()) + " " + I18n.format("enchantment.level." + (eff.getAmplifier() + 1)) + " - " + EffectUtils.getPotionDurationString(eff, 1);
float textWidth = small.getWidth(text) + 12;
float posX = window.scaledWidth() - offset - textWidth;

Vector4i gradientColors = new Vector4i(getColor(index * 30), getColor(index * 30 + 30), getColor(index * 30), getColor(index * 30 + 30));

RenderUtil.Render2D.drawGradientRound(posX, posY - (index * 16), textWidth, height, 4.0f, gradientColors.x, gradientColors.y, gradientColors.z, gradientColors.w);

if (shadow.get()) {
RenderUtil.Render2D.drawShadow(posX - 1, posY - (index * 16) - 1, textWidth + 2, height + 2, 8, RenderUtil.reAlphaInt(b_color, 50));
}

small.drawString(matrixStack, text, posX + 4, posY - (index * 16) + 4.5f, t_color);
index++;
}
}

float kbHeight = 0;
float kbWidth = 100;

float kbWidthAnimation = 0, kbHeightAnimation = 0;

private void renderKeyBinds(MatrixStack matrixStack) {
float posX = keyBinds.getX();
float posY = keyBinds.getY();
float roundDegree = 4.0f;

final Vector4i gradientColors = new Vector4i(getColor(0), getColor(50), getColor(100), getColor(150));

RenderUtil.Render2D.drawGradientRound(posX, posY, kbWidthAnimation, kbHeightAnimation, roundDegree, gradientColors.x, gradientColors.y, gradientColors.z, gradientColors.w);

if (shadow.get()) {
RenderUtil.Render2D.drawShadow(posX - 1, posY - 1, kbWidthAnimation + 2, kbHeightAnimation + 2, 8, RenderUtil.reAlphaInt(b_color, 50));
}

float titleWidth = Fonts.msSemiBold[15].getWidth("HotKeys");
Fonts.msSemiBold[15].drawCenteredString(matrixStack, "HotKeys", posX + kbWidthAnimation / 2, posY + 6, t_color);

RenderUtil.SmartScissor.push();
RenderUtil.SmartScissor.setFromComponentCoordinates(posX, posY, kbWidthAnimation, kbHeightAnimation);

int i = 0;
for (Function f : Managment.FUNCTION_MANAGER.getFunctions()) {
if (!f.state || f.bind == 0) continue;

String text = ClientUtil.getKey(f.bind);
if (text.length() > 4) {
text = text.substring(0, 4) + "..";
}
String bindText = "[" + text.toUpperCase() + "]";
float bindWidth = small.getWidth(bindText);
String name = f.name;
if (name.length() > 10) {
name = name.substring(0, 10) + "..";
}

kbWidth = Math.max(small.getWidth(bindText + f.bind + 5), 85);

Fonts.msMedium[12].drawString(matrixStack, name, posX + 4, posY + 18 + (i * 10), t_color);
Fonts.msMedium[12].drawString(matrixStack, bindText, posX + kbWidthAnimation - bindWidth - 5, posY + 20 + (i * 10), t_color);

i++;
}
RenderUtil.SmartScissor.unset();
RenderUtil.SmartScissor.pop();

kbHeight = 18 + (i * 10);
this.kbHeightAnimation = AnimationMath.fast(this.kbHeightAnimation, kbHeight, 10);
this.kbWidthAnimation = AnimationMath.fast(this.kbWidthAnimation, kbWidth, 10);

keyBinds.setWidth(kbWidth);
keyBinds.setHeight(kbHeight);
}

float slHeight = 0;
float lsWidth = 100;

private void renderStaffList(MatrixStack matrixStack) {
float posX = staffList.getX();
float posY = staffList.getY();

Vector4i gradientColors = new Vector4i(getColor(0), getColor(50), getColor(100), getColor(150));

RenderUtil.Render2D.drawGradientRound(posX, posY, lsWidth, slHeight, 4.0f, gradientColors.x, gradientColors.y, gradientColors.z, gradientColors.w);

if (shadow.get()) {
RenderUtil.Render2D.drawShadow(posX - 1, posY - 1, lsWidth + 2, slHeight + 2, 8, RenderUtil.reAlphaInt(b_color, 50));
}

Fonts.msSemiBold[15].drawCenteredString(matrixStack, "StaffList", posX + lsWidth / 2, posY + 6, t_color);

int i = 0;
for (Map.Entry<ITextComponent, String> entry : staffPlayers.entrySet()) {
ITextComponent p = entry.getKey();
String n = entry.getValue();

float len = Math.max(small.getWidth(p.getString() + n + cWidth), 85);

if (len > lsWidth) lsWidth = len;

small.drawString(matrixStack, p, posX + 4, posY + 18 + (i * 10), t_color);
small.drawString(matrixStack, n, posX + small.getWidth(p.getString()) + 4, posY + 18 + (i * 10), t_color);

i++;
}

slHeight = 18 + (i * 10);
staffList.setWidth(lsWidth);
staffList.setHeight(slHeight);
}

float health = 0;

private double scale = 0.0D;

private void renderTarget(MatrixStack matrixStack) {
float posX = targetHUD.getX();
float posY = targetHUD.getY();
targetHUD.setWidth(100);
targetHUD.setHeight(38);

this.target = getTarget(this.target);
this.scale = tHudAnimation.getOutput();

if (scale == 0.0F) {
target = null;
}

if (target == null) {
return;
}

String targetName = this.target.getName().getString();
String substring = targetName.substring(0, Math.min(targetName.length(), 10));
this.health = AnimationMath.fast(health, target.getHealth() / target.getMaxHealth(), 5);
this.health = MathHelper.clamp(this.health, 0, 1);
String healthValue = (int) MathUtil.round(this.health * 20 + target.getAbsorptionAmount(), 0.5f) + "";

Vector4i gradientColors = new Vector4i(getColor(0), getColor(50), getColor(100), getColor(150));

GlStateManager.pushMatrix();
AnimationMath.sizeAnimation(posX + (100 / 2), posY + (38 / 2), scale);
RenderUtil.Render2D.drawGradientRound(posX, posY, 100, 38, 4.0f, gradientColors.x, gradientColors.y, gradientColors.z, gradientColors.w);

if (shadow.get()) {
RenderUtil.Render2D.drawShadow(posX - 1, posY - 1, 100 + 2, 38 + 2, 8, RenderUtil.reAlphaInt(b_color, 50));
}

drawFace(posX + 4, posY + 4, 8F, 8F, 8F, 8F, 24, 24, 64F, 64F, (AbstractClientPlayerEntity) target);

medium.drawString(matrixStack, substring, posX + 32, posY + 6, t_color);
float distance = (float) MathUtil.round(mc.player.getDistance(target), 0.1f);
Fonts.msSemiBold[12].drawString(matrixStack, "Health: " + healthValue, posX + 32, posY + 16, t_color);
Fonts.msSemiBold[12].drawString(matrixStack, "Distance: " + distance, posX + 32, posY + 22, t_color);

int healthColor;
if (this.health > 0.5) {
healthColor = RenderUtil.IntColor.rgba(144, 238, 144, 255);
} else if (this.health > 0.2) {
healthColor = RenderUtil.IntColor.rgba(255, 223, 186, 255);
} else {
healthColor = RenderUtil.IntColor.rgba(255, 182, 193, 255);
}

RenderUtil.Render2D.drawRoundedCorner(posX + 1, posY + 38 - 6.5f, 98 * health, 4.3f, new Vector4f(4, 4, 4, 4), healthColor);
GlStateManager.popMatrix();
}

private void drawItemStack(float x, float y, float offset) {
List<ItemStack> stacks = new ArrayList<>(Arrays.asList(target.getHeldItemMainhand(), target.getHeldItemOffhand()));
target.getArmorInventoryList().forEach(stacks::add);
stacks.removeIf(w -> w.getItem() instanceof AirItem);
Collections.reverse(stacks);
final AtomicReference<Float> posX = new AtomicReference<>(x);

stacks.stream()
.filter(stack -> !stack.isEmpty())
.forEach(stack -> HudUtil.drawItemStack(stack,
posX.getAndAccumulate(offset, Float::sum),
y,
true,
true, 0.6f));
}

private float perc;

private void renderTimer(MatrixStack matrixStack) {
float posX = timerHUD.getX();
float posY = timerHUD.getY();

float quotient = Managment.FUNCTION_MANAGER.timerFunction.maxViolation / Managment.FUNCTION_MANAGER.timerFunction.timerAmount.getValue().floatValue();
float minimumValue = Math.min(Managment.FUNCTION_MANAGER.timerFunction.getViolation(), quotient);
perc = AnimationMath.lerp(perc, ((quotient - minimumValue) / quotient), 10);

String text = (int) (perc * 100) + "%";
float width = 100;
timerHUD.setWidth(width);
timerHUD.setHeight(20);

Vector4i gradientColors = new Vector4i(getColor(0), getColor(50), getColor(100), getColor(150));

RenderUtil.Render2D.drawGradientRound(posX, posY, width, 20, 4.0f, gradientColors.x, gradientColors.y, gradientColors.z, gradientColors.w);

if (shadow.get()) {
RenderUtil.Render2D.drawShadow(posX - 1, posY - 1, width + 2, 20 + 2, 8, RenderUtil.reAlphaInt(b_color, 50));
}

Fonts.msSemiBold[15].drawCenteredString(matrixStack, "Timer", posX + width / 2, posY + 5, t_color);
Fonts.msSemiBold[15].drawCenteredString(matrixStack, text, posX + width / 2, posY + 15, t_color);

RenderUtil.Render2D.drawRoundedCorner(posX, posY + 20 - 6, width * perc, 6, new Vector4f(0, round_degree, perc == 1 ? 0 : round_degree, round_degree), new Vector4i(getColor(100), getColor(100), getColor(0), getColor(0)));
}

private void renderCoordinates(MatrixStack matrixStack, int offset) {
String[] texts = new String[]{
"Coords: " + (int) mc.player.getPosX() + ", " + (int) mc.player.getPosY() + ", " + (int) mc.player.getPosZ(),
"BPS: " + (String.format("%.2f", Math.hypot(mc.player.getPosX() - mc.player.prevPosX, mc.player.getPosZ() - mc.player.prevPosZ) * 20))
};

float of = 0;
for (String text : texts) {
float textWidth = medium.getWidth(text) + 16;
float height = 16;
float posY = window.scaledHeight() - height - offset - of;

Vector4i gradientColors = new Vector4i(getColor(0), getColor(50), getColor(100), getColor(150));

RenderUtil.Render2D.drawGradientRound(offset, posY, textWidth, height, 4.0f, gradientColors.x, gradientColors.y, gradientColors.z, gradientColors.w);

if (shadow.get()) {
RenderUtil.Render2D.drawShadow(offset - 1, posY - 1, textWidth + 2, height + 2, 8, RenderUtil.reAlphaInt(b_color, 50));
}

Fonts.msSemiBold[15].drawCenteredString(matrixStack, text, offset + textWidth / 2, posY + 5.5f, t_color);
of += height + 3;
}
}

private PlayerEntity getTarget(PlayerEntity nullTarget) {
PlayerEntity target = nullTarget;

if (Managment.FUNCTION_MANAGER.auraFunction.getTarget() instanceof PlayerEntity) {
target = (PlayerEntity) Managment.FUNCTION_MANAGER.auraFunction.getTarget();
tHudAnimation.setDirection(Direction.FORWARDS);
} else if (mc.currentScreen instanceof ChatScreen) {
target = mc.player;
tHudAnimation.setDirection(Direction.FORWARDS);
} else {
tHudAnimation.setDirection(Direction.BACKWARDS);
}

return target;
}

private void updateFunctions() {
for (Function function : Managment.FUNCTION_MANAGER.getFunctions()) {
if (function.category == Type.Render) continue;

functions.add(function);
}

functions.sort((f1, f2) -> Float.compare(small.getWidth(f2.name), small.getWidth(f1.name)));
}

private int getColor(int index) {
return colors[index % colors.length];
}
}
 
Начинающий
Статус
Оффлайн
Регистрация
24 Окт 2021
Сообщения
179
Реакции[?]
1
Поинты[?]
1K
Начинающий
Статус
Оффлайн
Регистрация
23 Июн 2023
Сообщения
406
Реакции[?]
2
Поинты[?]
0
Делал Я + ChatGPT
Пожалуйста, авторизуйтесь для просмотра ссылки.

Java:
package wtf.expensive.modules.impl.render;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.MainWindow;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.AirItem;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectUtils;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Team;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.util.text.ITextComponent;
import org.joml.Vector4i;
import wtf.expensive.Initilization;
import wtf.expensive.events.Event;
import wtf.expensive.events.impl.player.EventUpdate;
import wtf.expensive.events.impl.render.EventRender;
import wtf.expensive.managment.Managment;
import wtf.expensive.modules.Function;
import wtf.expensive.modules.FunctionAnnotation;
import wtf.expensive.modules.Type;
import wtf.expensive.modules.settings.imp.BooleanOption;
import wtf.expensive.modules.settings.imp.MultiBoxSetting;
import wtf.expensive.modules.settings.imp.SliderSetting;
import wtf.expensive.util.BetterText;
import wtf.expensive.util.ClientUtil;
import wtf.expensive.util.animations.Animation;
import wtf.expensive.util.animations.Direction;
import wtf.expensive.util.animations.impl.EaseBackIn;
import wtf.expensive.util.drag.Dragging;
import wtf.expensive.util.font.Fonts;
import wtf.expensive.util.font.styled.StyledFont;
import wtf.expensive.util.math.MathUtil;
import wtf.expensive.util.misc.HudUtil;
import wtf.expensive.util.render.BloomHelper;
import wtf.expensive.util.render.ColorUtil;
import wtf.expensive.util.render.RenderUtil;
import wtf.expensive.util.render.animation.AnimationMath;

import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;

import static wtf.expensive.util.render.RenderUtil.Render2D.drawFace;

@FunctionAnnotation(name = "HUD", type = Type.Render)
public class HUD2 extends Function {

public final MultiBoxSetting elements = new MultiBoxSetting("Элементы",
new BooleanOption("Ватермарка", true),
new BooleanOption("Активные функции", true),
new BooleanOption("Координаты", true),
new BooleanOption("Активный таргет", true),
new BooleanOption("Активные стаффы", true),
new BooleanOption("Активные бинды", true),
new BooleanOption("Активные эффекты", true),
new BooleanOption("Уведомления", true)
);

public final BooleanOption shadow = new BooleanOption("Тень", true);

private final SliderSetting offset = new SliderSetting("Отступ", 5, 1, 10, 1);

public HUD2() {
addSettings(elements, shadow, offset);
}

final float round_degree = 3;

final float cWidth = 4;

final Vector4f left_vec = new Vector4f(round_degree, round_degree, 0, 0);
final Vector4f right_vec = new Vector4f(0, 0, round_degree, round_degree);

final int b_color = new Color(0, 0, 0, 128).getRGB();
final int t_color = Color.WHITE.getRGB();

int[] colors = new int[360];

final StyledFont icons = Fonts.icons1[20];
final StyledFont medium = Fonts.msMedium[16];
final StyledFont small = Fonts.msMedium[14];

MainWindow window;

List<Function> functions = new ArrayList<>();

final Dragging keyBinds = Initilization.createDrag(this, "KeyBinds-new", 10, 100);
final Dragging staffList = Initilization.createDrag(this, "StaffList-new", 10, 200);

final Dragging targetHUD = Initilization.createDrag(this, "TargetHUD-new", 10, 300);
final Dragging timerHUD = Initilization.createDrag(this, "TimerHUD-new", 10, 400);

Animation tHudAnimation = new EaseBackIn(400, 1, 1.5f);
PlayerEntity target = null;

private final Pattern namePattern = Pattern.compile("^\\w{3,16}$");
private final Pattern prefixMatches = Pattern.compile(".*(mod|der|adm|help|wne|мод|хелп|помо|адм|владе|отри|таф|taf|curat|курато|dev|раз|supp|сапп|yt|ютуб).*");

private final Map<ITextComponent, String> staffPlayers = new LinkedHashMap<>();

@Override
public void onEvent(Event event) {
if (mc.player == null || mc.world == null) return;

if (event instanceof EventUpdate) {
staffPlayers.clear();

for (ScorePlayerTeam team : mc.world.getScoreboard().getTeams().stream().sorted(Comparator.comparing(Team::getName)).toList()) {
String name = team.getMembershipCollection().toString();
name = name.substring(1, name.length() - 1);
if (namePattern.matcher(name).matches()) {
if (prefixMatches.matcher(team.getPrefix().getString().toLowerCase(Locale.ROOT)).matches() || Managment.STAFF_MANAGER.isStaff(name)) {
staffPlayers.put(team.getPrefix(), name);
}
}
}

if (Managment.FUNCTION_MANAGER.getFunctions().isEmpty() || !functions.isEmpty()) return;
updateFunctions();
}

if (event instanceof EventRender e && e.isRender2D()) {
for (int i = 0; i < colors.length; i++) {
colors[i] = Managment.STYLE_MANAGER.getCurrentStyle().getColor(i);
}

window = e.scaledResolution;

final int offset = this.offset.getValue().intValue();
final MatrixStack matrixStack = e.matrixStack;

if (elements.get(0)) renderWatermark(matrixStack, offset);
if (elements.get(1)) renderFunctions(matrixStack, offset);
if (elements.get(2)) renderCoordinates(matrixStack, offset);
if (elements.get(3)) renderTarget(matrixStack);
if (elements.get(4)) renderStaffList(matrixStack);
if (elements.get(5)) renderKeyBinds(matrixStack);
if (elements.get(6)) renderPotions(matrixStack, offset);
}
}

BetterText betterText = new BetterText(List.of("",
"Лучший из лучших",
"Всегда на высоте",
"Наивысший стандарт качества",
"Лучший выбор",
"Всегда превосходно",
"Надежно и качественно"), 2000);

private void renderWatermark(MatrixStack matrixStack, int offset) {
float staticTextWidth = Fonts.msSemiBold[15].getWidth("Expensive");
float animatedTextWidth = Fonts.msSemiBold[15].getWidth(betterText.output);
float maxWidth = Math.max(staticTextWidth, animatedTextWidth);
float width = Math.max(80, maxWidth + 20);
float height = 28;

Vector4i gradientColors = new Vector4i(getColor(0), getColor(50), getColor(100), getColor(150));

RenderUtil.Render2D.drawGradientRound(offset, offset, width, height, 4.0f, gradientColors.x, gradientColors.y, gradientColors.z, gradientColors.w);

if (shadow.get()) {
RenderUtil.Render2D.drawShadow(offset - 1, offset - 1, width + 2, height + 2, 8, RenderUtil.reAlphaInt(b_color, 50));
}

Fonts.msSemiBold[15].drawString(matrixStack, "Expensive", offset + 10, offset + 6f, t_color);
Fonts.msSemiBold[15].drawString(matrixStack, betterText.output, offset + 10, offset + 18f, t_color);
}

private void renderFunctions(MatrixStack matrixStack, int offset) {
float padding = 4;
float dumbOffset = 1.5f;
float height = small.getFontHeight() - dumbOffset + padding;

List<Function> fs = new ArrayList<>();
for (Function f : functions) {
f.animation = AnimationMath.fast(f.animation, f.state ? 1 : 0, 15);
if (f.animation < 0.1) continue;
fs.add(f);
}

float index = 0;
for (Function f : fs) {
float width = small.getWidth(f.name) + (padding * 2);
float r_posX = window.scaledWidth() - offset - width;
float r_posY = offset + (index * height);

Vector4i gradientColors = new Vector4i(getColor(0), getColor(50), getColor(100), getColor(150));

RenderUtil.Render2D.drawGradientRound(r_posX - cWidth, r_posY, width, height, 4.0f, gradientColors.x, gradientColors.y, gradientColors.z, gradientColors.w);

if (shadow.get()) {
RenderUtil.Render2D.drawShadow(r_posX - cWidth - 1, r_posY - 1, width + 2, height + 2, 8, RenderUtil.reAlphaInt(b_color, 50));
}

small.drawCenteredString(matrixStack, f.name, r_posX + width / 2 - cWidth, r_posY - dumbOffset + (height / 2), -1);
index += f.animation;
}
}

private void renderPotions(MatrixStack matrixStack, int offset) {
float height = 12;
float posY = window.scaledHeight() - offset - height;

int index = 0;
for (EffectInstance eff : mc.player.getActivePotionEffects().stream().sorted(Comparator.comparing(EffectInstance::getDuration)).toList()) {
String text = I18n.format(eff.getEffectName()) + " " + I18n.format("enchantment.level." + (eff.getAmplifier() + 1)) + " - " + EffectUtils.getPotionDurationString(eff, 1);
float textWidth = small.getWidth(text) + 12;
float posX = window.scaledWidth() - offset - textWidth;

Vector4i gradientColors = new Vector4i(getColor(index * 30), getColor(index * 30 + 30), getColor(index * 30), getColor(index * 30 + 30));

RenderUtil.Render2D.drawGradientRound(posX, posY - (index * 16), textWidth, height, 4.0f, gradientColors.x, gradientColors.y, gradientColors.z, gradientColors.w);

if (shadow.get()) {
RenderUtil.Render2D.drawShadow(posX - 1, posY - (index * 16) - 1, textWidth + 2, height + 2, 8, RenderUtil.reAlphaInt(b_color, 50));
}

small.drawString(matrixStack, text, posX + 4, posY - (index * 16) + 4.5f, t_color);
index++;
}
}

float kbHeight = 0;
float kbWidth = 100;

float kbWidthAnimation = 0, kbHeightAnimation = 0;

private void renderKeyBinds(MatrixStack matrixStack) {
float posX = keyBinds.getX();
float posY = keyBinds.getY();
float roundDegree = 4.0f;

final Vector4i gradientColors = new Vector4i(getColor(0), getColor(50), getColor(100), getColor(150));

RenderUtil.Render2D.drawGradientRound(posX, posY, kbWidthAnimation, kbHeightAnimation, roundDegree, gradientColors.x, gradientColors.y, gradientColors.z, gradientColors.w);

if (shadow.get()) {
RenderUtil.Render2D.drawShadow(posX - 1, posY - 1, kbWidthAnimation + 2, kbHeightAnimation + 2, 8, RenderUtil.reAlphaInt(b_color, 50));
}

float titleWidth = Fonts.msSemiBold[15].getWidth("HotKeys");
Fonts.msSemiBold[15].drawCenteredString(matrixStack, "HotKeys", posX + kbWidthAnimation / 2, posY + 6, t_color);

RenderUtil.SmartScissor.push();
RenderUtil.SmartScissor.setFromComponentCoordinates(posX, posY, kbWidthAnimation, kbHeightAnimation);

int i = 0;
for (Function f : Managment.FUNCTION_MANAGER.getFunctions()) {
if (!f.state || f.bind == 0) continue;

String text = ClientUtil.getKey(f.bind);
if (text.length() > 4) {
text = text.substring(0, 4) + "..";
}
String bindText = "[" + text.toUpperCase() + "]";
float bindWidth = small.getWidth(bindText);
String name = f.name;
if (name.length() > 10) {
name = name.substring(0, 10) + "..";
}

kbWidth = Math.max(small.getWidth(bindText + f.bind + 5), 85);

Fonts.msMedium[12].drawString(matrixStack, name, posX + 4, posY + 18 + (i * 10), t_color);
Fonts.msMedium[12].drawString(matrixStack, bindText, posX + kbWidthAnimation - bindWidth - 5, posY + 20 + (i * 10), t_color);

i++;
}
RenderUtil.SmartScissor.unset();
RenderUtil.SmartScissor.pop();

kbHeight = 18 + (i * 10);
this.kbHeightAnimation = AnimationMath.fast(this.kbHeightAnimation, kbHeight, 10);
this.kbWidthAnimation = AnimationMath.fast(this.kbWidthAnimation, kbWidth, 10);

keyBinds.setWidth(kbWidth);
keyBinds.setHeight(kbHeight);
}

float slHeight = 0;
float lsWidth = 100;

private void renderStaffList(MatrixStack matrixStack) {
float posX = staffList.getX();
float posY = staffList.getY();

Vector4i gradientColors = new Vector4i(getColor(0), getColor(50), getColor(100), getColor(150));

RenderUtil.Render2D.drawGradientRound(posX, posY, lsWidth, slHeight, 4.0f, gradientColors.x, gradientColors.y, gradientColors.z, gradientColors.w);

if (shadow.get()) {
RenderUtil.Render2D.drawShadow(posX - 1, posY - 1, lsWidth + 2, slHeight + 2, 8, RenderUtil.reAlphaInt(b_color, 50));
}

Fonts.msSemiBold[15].drawCenteredString(matrixStack, "StaffList", posX + lsWidth / 2, posY + 6, t_color);

int i = 0;
for (Map.Entry<ITextComponent, String> entry : staffPlayers.entrySet()) {
ITextComponent p = entry.getKey();
String n = entry.getValue();

float len = Math.max(small.getWidth(p.getString() + n + cWidth), 85);

if (len > lsWidth) lsWidth = len;

small.drawString(matrixStack, p, posX + 4, posY + 18 + (i * 10), t_color);
small.drawString(matrixStack, n, posX + small.getWidth(p.getString()) + 4, posY + 18 + (i * 10), t_color);

i++;
}

slHeight = 18 + (i * 10);
staffList.setWidth(lsWidth);
staffList.setHeight(slHeight);
}

float health = 0;

private double scale = 0.0D;

private void renderTarget(MatrixStack matrixStack) {
float posX = targetHUD.getX();
float posY = targetHUD.getY();
targetHUD.setWidth(100);
targetHUD.setHeight(38);

this.target = getTarget(this.target);
this.scale = tHudAnimation.getOutput();

if (scale == 0.0F) {
target = null;
}

if (target == null) {
return;
}

String targetName = this.target.getName().getString();
String substring = targetName.substring(0, Math.min(targetName.length(), 10));
this.health = AnimationMath.fast(health, target.getHealth() / target.getMaxHealth(), 5);
this.health = MathHelper.clamp(this.health, 0, 1);
String healthValue = (int) MathUtil.round(this.health * 20 + target.getAbsorptionAmount(), 0.5f) + "";

Vector4i gradientColors = new Vector4i(getColor(0), getColor(50), getColor(100), getColor(150));

GlStateManager.pushMatrix();
AnimationMath.sizeAnimation(posX + (100 / 2), posY + (38 / 2), scale);
RenderUtil.Render2D.drawGradientRound(posX, posY, 100, 38, 4.0f, gradientColors.x, gradientColors.y, gradientColors.z, gradientColors.w);

if (shadow.get()) {
RenderUtil.Render2D.drawShadow(posX - 1, posY - 1, 100 + 2, 38 + 2, 8, RenderUtil.reAlphaInt(b_color, 50));
}

drawFace(posX + 4, posY + 4, 8F, 8F, 8F, 8F, 24, 24, 64F, 64F, (AbstractClientPlayerEntity) target);

medium.drawString(matrixStack, substring, posX + 32, posY + 6, t_color);
float distance = (float) MathUtil.round(mc.player.getDistance(target), 0.1f);
Fonts.msSemiBold[12].drawString(matrixStack, "Health: " + healthValue, posX + 32, posY + 16, t_color);
Fonts.msSemiBold[12].drawString(matrixStack, "Distance: " + distance, posX + 32, posY + 22, t_color);

int healthColor;
if (this.health > 0.5) {
healthColor = RenderUtil.IntColor.rgba(144, 238, 144, 255);
} else if (this.health > 0.2) {
healthColor = RenderUtil.IntColor.rgba(255, 223, 186, 255);
} else {
healthColor = RenderUtil.IntColor.rgba(255, 182, 193, 255);
}

RenderUtil.Render2D.drawRoundedCorner(posX + 1, posY + 38 - 6.5f, 98 * health, 4.3f, new Vector4f(4, 4, 4, 4), healthColor);
GlStateManager.popMatrix();
}

private void drawItemStack(float x, float y, float offset) {
List<ItemStack> stacks = new ArrayList<>(Arrays.asList(target.getHeldItemMainhand(), target.getHeldItemOffhand()));
target.getArmorInventoryList().forEach(stacks::add);
stacks.removeIf(w -> w.getItem() instanceof AirItem);
Collections.reverse(stacks);
final AtomicReference<Float> posX = new AtomicReference<>(x);

stacks.stream()
.filter(stack -> !stack.isEmpty())
.forEach(stack -> HudUtil.drawItemStack(stack,
posX.getAndAccumulate(offset, Float::sum),
y,
true,
true, 0.6f));
}

private float perc;

private void renderTimer(MatrixStack matrixStack) {
float posX = timerHUD.getX();
float posY = timerHUD.getY();

float quotient = Managment.FUNCTION_MANAGER.timerFunction.maxViolation / Managment.FUNCTION_MANAGER.timerFunction.timerAmount.getValue().floatValue();
float minimumValue = Math.min(Managment.FUNCTION_MANAGER.timerFunction.getViolation(), quotient);
perc = AnimationMath.lerp(perc, ((quotient - minimumValue) / quotient), 10);

String text = (int) (perc * 100) + "%";
float width = 100;
timerHUD.setWidth(width);
timerHUD.setHeight(20);

Vector4i gradientColors = new Vector4i(getColor(0), getColor(50), getColor(100), getColor(150));

RenderUtil.Render2D.drawGradientRound(posX, posY, width, 20, 4.0f, gradientColors.x, gradientColors.y, gradientColors.z, gradientColors.w);

if (shadow.get()) {
RenderUtil.Render2D.drawShadow(posX - 1, posY - 1, width + 2, 20 + 2, 8, RenderUtil.reAlphaInt(b_color, 50));
}

Fonts.msSemiBold[15].drawCenteredString(matrixStack, "Timer", posX + width / 2, posY + 5, t_color);
Fonts.msSemiBold[15].drawCenteredString(matrixStack, text, posX + width / 2, posY + 15, t_color);

RenderUtil.Render2D.drawRoundedCorner(posX, posY + 20 - 6, width * perc, 6, new Vector4f(0, round_degree, perc == 1 ? 0 : round_degree, round_degree), new Vector4i(getColor(100), getColor(100), getColor(0), getColor(0)));
}

private void renderCoordinates(MatrixStack matrixStack, int offset) {
String[] texts = new String[]{
"Coords: " + (int) mc.player.getPosX() + ", " + (int) mc.player.getPosY() + ", " + (int) mc.player.getPosZ(),
"BPS: " + (String.format("%.2f", Math.hypot(mc.player.getPosX() - mc.player.prevPosX, mc.player.getPosZ() - mc.player.prevPosZ) * 20))
};

float of = 0;
for (String text : texts) {
float textWidth = medium.getWidth(text) + 16;
float height = 16;
float posY = window.scaledHeight() - height - offset - of;

Vector4i gradientColors = new Vector4i(getColor(0), getColor(50), getColor(100), getColor(150));

RenderUtil.Render2D.drawGradientRound(offset, posY, textWidth, height, 4.0f, gradientColors.x, gradientColors.y, gradientColors.z, gradientColors.w);

if (shadow.get()) {
RenderUtil.Render2D.drawShadow(offset - 1, posY - 1, textWidth + 2, height + 2, 8, RenderUtil.reAlphaInt(b_color, 50));
}

Fonts.msSemiBold[15].drawCenteredString(matrixStack, text, offset + textWidth / 2, posY + 5.5f, t_color);
of += height + 3;
}
}

private PlayerEntity getTarget(PlayerEntity nullTarget) {
PlayerEntity target = nullTarget;

if (Managment.FUNCTION_MANAGER.auraFunction.getTarget() instanceof PlayerEntity) {
target = (PlayerEntity) Managment.FUNCTION_MANAGER.auraFunction.getTarget();
tHudAnimation.setDirection(Direction.FORWARDS);
} else if (mc.currentScreen instanceof ChatScreen) {
target = mc.player;
tHudAnimation.setDirection(Direction.FORWARDS);
} else {
tHudAnimation.setDirection(Direction.BACKWARDS);
}

return target;
}

private void updateFunctions() {
for (Function function : Managment.FUNCTION_MANAGER.getFunctions()) {
if (function.category == Type.Render) continue;

functions.add(function);
}

functions.sort((f1, f2) -> Float.compare(small.getWidth(f2.name), small.getWidth(f1.name)));
}

private int getColor(int index) {
return colors[index % colors.length];
}
}
Максимум взял бы таргетхуд если не бы не наклепал свой
 
Сверху Снизу