Начинающий
- Статус
- Оффлайн
- Регистрация
- 12 Июн 2025
- Сообщения
- 113
- Реакции
- 0
- Выберите загрузчик игры
- Прочие моды
привет всем, в очередной раз заливаю скид кошки, в этот раз более менее подобрал по фону по размерам постарался сделать +- что то адекватное, также еще есть партиклы при ударах ну их почти не видно думаю если нужно кто то и доведет до идеала.
ss -
ps, фон светлей иза того что я в настройках клиента его таким сделал в основном его можно сделать темней
ss -
ps, фон светлей иза того что я в настройках клиента его таким сделал в основном его можно сделать темней
self$$code:
package sweetie.evaware.client.ui.widget.overlay;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.render.DiffuseLighting;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.math.MathHelper;
import sweetie.evaware.api.event.events.render.Render2DEvent;
import sweetie.evaware.api.utils.animation.AnimationUtil;
import sweetie.evaware.api.utils.color.ColorUtil;
import sweetie.evaware.api.utils.color.UIColors;
import sweetie.evaware.api.utils.math.MathUtil;
import sweetie.evaware.api.utils.render.RenderUtil;
import sweetie.evaware.api.utils.render.fonts.Fonts;
import sweetie.evaware.client.features.modules.combat.AuraModule;
import sweetie.evaware.client.ui.widget.Widget;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class TargetInfoClassicWidget extends Widget {
public TargetInfoClassicWidget() { super(30f, 30f); }
@Override public String getName() { return "Target info Classic"; }
private final AnimationUtil showAnimation = new AnimationUtil();
private float healthAnimation = 0f;
private LivingEntity target;
private DrawContext drawContext;
private float hitFlash = 0f;
private float lastHealth = -1f;
private final List<HitParticle> particles = new ArrayList<>();
private final Random random = new Random();
@Override
public void render(Render2DEvent.Render2DEventData event) {
this.drawContext = event.context();
render(event.matrixStack());
}
@Override
public void render(MatrixStack ms) {
update();
LivingEntity pretendTarget = getTarget();
if (pretendTarget != null) target = pretendTarget;
if (target == null) return;
float anim = (float) showAnimation.getValue();
if (anim <= 0.01f) return;
int fa = (int)(anim * 255f);
float currentHp = target.getHealth();
if (lastHealth > 0 && currentHp < lastHealth) {
hitFlash = 1f;
spawnHitParticles();
}
lastHealth = currentHp;
if (hitFlash > 0) hitFlash = Math.max(0f, hitFlash - 0.06f);
healthAnimation = MathHelper.clamp(
MathUtil.interpolate(healthAnimation, currentHp / target.getMaxHealth(), 0.1f), 0f, 1f);
float x = getDraggable().getX();
float y = getDraggable().getY();
float r = scaled(5f);
float pad = scaled(4f);
float gap = scaled(1f);
float itemGapV = scaled(0.5f);
float headSize = scaled(18f);
float barH = scaled(3f);
float nameFont = scaled(6f);
float hpFont = scaled(5.5f);
float itemSize = scaled(8f);
float itemGap = scaled(0.5f);
List<ItemStack> allItems = new ArrayList<>();
if (target instanceof PlayerEntity player) {
List<ItemStack> armor = player.getInventory().armor;
for (int i = armor.size() - 1; i >= 0; i--) {
ItemStack s = armor.get(i);
if (!s.isEmpty() && s.getItem() != Items.AIR) allItems.add(s);
}
if (!player.getMainHandStack().isEmpty()) allItems.add(player.getMainHandStack());
if (!player.getOffHandStack().isEmpty()) allItems.add(player.getOffHandStack());
}
String name = target.getName().getString();
float nameW = Fonts.SF_BOLD.getWidth(name, nameFont);
String hpPct = (int)(healthAnimation * 100) + "%";
float hpPctW = Fonts.SF_MEDIUM.getWidth(hpPct, hpFont);
float itemsRowW = allItems.isEmpty() ? 0f : allItems.size() * (itemSize + itemGap) - itemGap;
float minContentW = nameW + gap * 2f + hpPctW;
float contentW = Math.max(minContentW, itemsRowW);
float totalW = pad + headSize + pad + contentW + pad;
float contentH = nameFont + gap + itemSize;
float innerH = Math.max(headSize, contentH);
float totalH = pad + innerH + pad + barH + scaled(2f);
if (anim > 0.01f) {
Color clientColor = UIColors.primary();
Color bgColor = new Color(
Math.min(255, (int)(18 + clientColor.getRed() * 0.10f)),
Math.min(255, (int)(22 + clientColor.getGreen() * 0.10f)),
Math.min(255, (int)(28 + clientColor.getBlue() * 0.10f)),
(int)(220 * anim)
);
RenderUtil.BLUR_RECT.draw(ms, x, y, totalW, totalH, r, bgColor);
}
float headY = y + pad + (innerH - headSize) / 2f;
float headX = x + pad;
float headAlpha = anim;
int headFa = fa;
Color headTint;
if (hitFlash > 0) {
int red = (int)(255 * hitFlash);
headTint = new Color(255, Math.max(0, 255 - red), Math.max(0, 255 - red), headFa);
} else {
headTint = ColorUtil.setAlpha(Color.WHITE, headFa);
}
if (target instanceof PlayerEntity player) {
RenderUtil.TEXTURE_RECT.drawHead(ms, player, headX, headY, headSize, headSize,
scaled(0.5f), scaled(3f), headTint);
} else {
Fonts.SF_BOLD.drawCenteredText(ms, "?",
headX + headSize / 2f, headY + headSize / 2f - nameFont / 2f,
nameFont, UIColors.textColor(headFa));
}
updateParticles();
renderParticles(ms, headAlpha);
if (anim > 0.01f) {
float cx = headX + headSize + pad;
float topY = y + pad + (innerH - contentH) / 2f;
Fonts.SF_BOLD.drawText(ms, name, cx, topY, nameFont, UIColors.textColor(fa));
float hpPctX = x + totalW - pad - hpPctW;
Fonts.SF_MEDIUM.drawText(ms, hpPct, hpPctX, topY + nameFont / 2f - hpFont / 2f,
hpFont, UIColors.inactiveTextColor(fa));
float itemsY = topY + nameFont + gap;
if (!allItems.isEmpty() && drawContext != null) {
float scale = itemSize / 16f;
for (int i = 0; i < allItems.size(); i++) {
float ix = cx + i * (itemSize + itemGap);
ms.push();
ms.translate(ix, itemsY, 150f);
ms.scale(scale, scale, 1f);
DiffuseLighting.disableGuiDepthLighting();
RenderSystem.setShaderColor(1f, 1f, 1f, anim);
drawContext.drawItem(allItems.get(i), 0, 0);
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
ms.pop();
}
}
float barY = y + totalH - barH - scaled(3f);
float barX = x + scaled(3f);
float barW = totalW - scaled(6f);
Color barBg = new Color(0, 0, 0, (int)(60 * anim));
RenderUtil.RECT.draw(ms, barX, barY, barW, barH, barH / 2f, barBg);
if (healthAnimation > 0) {
Color c1 = UIColors.primary((int)(255 * anim));
Color c2 = UIColors.secondary((int)(255 * anim));
RenderUtil.GRADIENT_RECT.draw(ms, barX, barY, barW * healthAnimation, barH, barH / 2f,
c1, c2, c1, c2);
}
}
getDraggable().setWidth(totalW);
getDraggable().setHeight(totalH);
}
private void spawnHitParticles() {
float headX = getDraggable().getX() + scaled(4f);
float headY = getDraggable().getY() + scaled(4f);
float sz = scaled(22f);
for (int i = 0; i < 5; i++) {
particles.add(new HitParticle(
headX + random.nextFloat() * sz,
headY + random.nextFloat() * sz));
}
}
private void updateParticles() {
particles.removeIf(p -> { p.update(); return p.isDead(); });
}
private void renderParticles(MatrixStack ms, float anim) {
for (HitParticle p : particles) p.render(ms, anim);
}
private void update() {
showAnimation.update();
showAnimation.run(getTarget() != null ? 1.0 : 0.0, getDuration(), getEasing());
}
private LivingEntity getTarget() {
AuraModule aura = AuraModule.getInstance();
if (aura.isEnabled() && aura.target != null) return aura.target;
if (mc.currentScreen instanceof ChatScreen) return mc.player;
return null;
}
private static class HitParticle {
private float x, y;
private float vx, vy;
private float life;
private final float maxLife;
private final float size;
HitParticle(float x, float y) {
this.x = x; this.y = y;
double a = Math.random() * Math.PI * 2;
float spd = 0.1f + (float)Math.random() * 0.3f;
vx = (float)Math.cos(a) * spd;
vy = (float)Math.sin(a) * spd;
maxLife = 60f + (float)Math.random() * 40f;
life = maxLife;
size = 1f + (float)Math.random() * 1.2f;
}
void update() {
x += vx;
y += vy;
vx *= 0.95f;
vy *= 0.95f;
life--;
}
void render(MatrixStack ms, float anim) {
float alpha = (life / maxLife) * anim * 0.8f;
if (alpha <= 0) return;
Color c = ColorUtil.setAlpha(UIColors.primary(), (int)(255 * alpha));
RenderUtil.RECT.draw(ms, x - size / 2f, y - size / 2f, size, size, size / 2f, c);
Color glow = ColorUtil.setAlpha(UIColors.primary(), (int)(50 * alpha));
RenderUtil.RECT.draw(ms, x - size, y - size, size * 2f, size * 2f, size, glow);
}
boolean isDead() { return life <= 0; }
}
}