- Статус
- Оффлайн
- Регистрация
- 7 Дек 2025
- Сообщения
- 159
- Реакции
- 2
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
- Выберите загрузчик игры
- Forge
Заливаю вам TargetHUD Enough Visuals вроде красивый
ss - прикрепил
dw - код прикрепил
Пишите что вам еще слить из них (эти визуалы оч кривые и ужасные)
ss - прикрепил
dw - код прикрепил
TargetHUD:
package enough.module.hud;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import enough.Enough;
import enough.utils.RenderUtil;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.event.entity.player.AttackEntityEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import org.lwjgl.opengl.GL11;
import java.awt.Color;
import java.text.DecimalFormat;
@enough.module.base.ModuleAnnotation
@enough.module.base.Event
public class TargetHUD extends HUDComponent {
private LivingEntity targetEntity;
private LivingEntity renderTarget;
public static LivingEntity currentTarget;
private long targetTime = -1L;
private float opacity = 0.0f;
private float healthAnim = 0.0f;
private long lastUpdate = System.currentTimeMillis();
private final DecimalFormat decimalFormat = new DecimalFormat("0.0");
private static final int CORNER_RADIUS = 12;
public TargetHUD() {
super("TargetHUD", enough.module.base.Category.HUD, "Показывает информацию о цели", 300.0f, 300.0f);
}
private float getGuiScale() {
double scale = this.mc.getWindow().getGuiScale();
if (scale <= 1.0) {
return 1.3f;
}
if (scale <= 2.0) {
return 1.0f;
}
if (scale <= 3.0) {
return 0.8f;
}
return 0.65f;
}
private float getBaseWidth() {
return 115.0f;
}
private float getBaseHeight() {
return 40.0f;
}
@Override
public float getWidth() {
return this.getBaseWidth() * this.getGuiScale();
}
@Override
public float getHeight() {
return this.getBaseHeight() * this.getGuiScale();
}
@SubscribeEvent
public void onAttack(AttackEntityEvent event) {
if (event.getTarget() instanceof LivingEntity) {
this.renderTarget = this.targetEntity = (LivingEntity)event.getTarget();
this.targetTime = System.currentTimeMillis();
}
}
private int adjustAlpha(Color color, float alpha) {
int alphaValue = MathHelper.clamp((int)((float)color.getAlpha() * alpha), 0, 255);
return new Color(color.getRed(), color.getGreen(), color.getBlue(), alphaValue).getRGB();
}
@Override
public void render(MatrixStack matrixStack) {
long currentTime = System.currentTimeMillis();
float deltaTime = (float)(currentTime - this.lastUpdate) / 16.67f;
this.lastUpdate = currentTime;
if (this.targetEntity != null && (currentTime - this.targetTime > 3000L || this.targetEntity.isDead())) {
this.targetEntity = null;
}
boolean chatOpen = this.mc.currentScreen instanceof ChatScreen;
if (this.targetEntity == null && chatOpen) {
this.renderTarget = this.mc.player;
} else if (this.targetEntity != null) {
this.renderTarget = this.targetEntity;
}
boolean hasTarget = (this.targetEntity != null || chatOpen) && this.renderTarget != null;
float targetOpacity = hasTarget ? 1.0f : 0.0f;
this.opacity = RenderUtil.lerp(this.opacity, targetOpacity, 0.08f * deltaTime);
if (this.opacity < 0.01f) {
this.opacity = 0.0f;
return;
}
String playerName = this.renderTarget.getDisplayName().getString();
float currentHealth = this.renderTarget.getHealth();
float maxHealth = this.renderTarget.getMaxHealth();
this.healthAnim = RenderUtil.lerp(this.healthAnim, currentHealth, 0.15f * deltaTime);
float healthPercent = MathHelper.clamp(this.healthAnim / maxHealth, 0.0f, 1.0f);
float scale = this.getGuiScale();
float padding = 6.0f * scale;
float headSize = 28.0f * scale;
float width = this.getWidth();
float height = this.getHeight();
matrixStack.push();
RenderSystem.enableBlend();
RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
currentTarget = this.targetEntity;
int bgColor = adjustAlpha(new Color(15, 15, 20, 200), this.opacity);
int outlineColor = adjustAlpha(new Color(255, 255, 255, 25), this.opacity);
RenderUtil.drawRoundedRect(matrixStack, 0.0f, 0.0f, width, height, CORNER_RADIUS * scale, bgColor);
RenderUtil.drawRoundedOutline(matrixStack, 0.0f, 0.0f, width, height, CORNER_RADIUS * scale, 1.0f * scale, outlineColor);
float headX = padding;
float headY = (height - headSize) / 2.0f;
float cornerSize = 8.0f * scale;
RenderUtil.drawRoundedTexture(matrixStack, headX, headY, headSize, headSize, cornerSize, () -> {
if (this.renderTarget instanceof AbstractClientPlayerEntity) {
RenderUtil.drawFace(matrixStack, headX, headY, headSize, headSize, (AbstractClientPlayerEntity)this.renderTarget, this.opacity);
} else {
RenderUtil.drawRoundedRect(matrixStack, headX, headY, headSize, headSize, cornerSize, adjustAlpha(new Color(100, 100, 100), this.opacity));
Enough.instance.fontManager.drawCenteredString(matrixStack, "?", headX + headSize / 2.0f, headY + headSize / 2.0f - 5.0f * scale, adjustAlpha(Color.WHITE, this.opacity));
}
});
float textX = headX + headSize + padding;
float textY = headY;
matrixStack.push();
matrixStack.translate(textX, textY, 0.0);
matrixStack.scale(0.95f * scale, 0.95f * scale, 1.0f);
if (playerName.length() > 12) {
float charX = 0.0f;
for (int i = 0; i < playerName.length(); ++i) {
char c = playerName.charAt(i);
float charWidth = (float)Enough.instance.fontManager.drawString(String.valueOf(c));
float charAlpha = 1.0f;
if (i >= 9) {
int extra = i - 9;
charAlpha = 1.0f - (float)extra / 4.0f;
}
if (i >= 12) {
int extra = i - 12;
charAlpha = Math.max(0.0f, 0.5f - (float)extra * 0.2f);
}
charAlpha = MathHelper.clamp(charAlpha * this.opacity, 0.0f, 1.0f);
if (charAlpha > 0.01f) {
int color = adjustAlpha(Color.WHITE, charAlpha);
Enough.instance.fontManager.drawString(matrixStack, String.valueOf(c), charX, 0.0f, color);
}
charX += charWidth;
}
} else {
int color = adjustAlpha(Color.WHITE, this.opacity);
Enough.instance.fontManager.drawString(matrixStack, playerName, 0.0f, 0.0f, color);
}
matrixStack.pop();
String healthText = "HP: " + this.decimalFormat.format(this.healthAnim);
int healthColor = adjustAlpha(new Color(200, 200, 200), this.opacity);
matrixStack.push();
matrixStack.translate(textX, textY + 10.0f * scale, 0.0);
matrixStack.scale(0.75f * scale, 0.75f * scale, 1.0f);
Enough.instance.fontManager.drawString(matrixStack, healthText, 0.0f, 0.0f, healthColor);
matrixStack.pop();
float barX = textX + headSize + padding;
float barY = headY + headSize + 6.0f * scale;
float barWidth = width - barX - 3.0f * scale;
float barHeight = 6.0f * scale;
int barBgColor = adjustAlpha(new Color(40, 40, 40, 150), this.opacity);
RenderUtil.drawRoundedRect(matrixStack, barX, barY, barWidth, barHeight, 5.0f * scale, barBgColor);
if (healthPercent > 0.0f) {
int healthBarColor1, healthBarColor2;
if (healthPercent < 0.3f) {
healthBarColor1 = adjustAlpha(new Color(255, 80, 80), this.opacity);
healthBarColor2 = adjustAlpha(new Color(255, 150, 150), this.opacity);
} else {
healthBarColor1 = adjustAlpha(new Color(60, 120, 255), this.opacity);
healthBarColor2 = adjustAlpha(new Color(120, 180, 255), this.opacity);
}
float healthBarWidth = Math.max(barHeight, barWidth * healthPercent);
RenderUtil.drawGradientRoundedRect(matrixStack, barX, barY, healthBarWidth, barHeight, 5.0f * scale, healthBarColor1, healthBarColor2);
}
RenderSystem.disableBlend();
matrixStack.pop();
}
}
Пишите что вам еще слить из них (эти визуалы оч кривые и ужасные)