Начинающий
- Статус
- Оффлайн
- Регистрация
- 18 Май 2023
- Сообщения
- 69
- Реакции
- 0
- Выберите загрузчик игры
- Vanilla
Слил чисто по приколу 
ВАЖНО!
сразу говорю надо добавить шейдер на закругление бошки с этой темы -> Закругление головы шейдером в TargetHUD
Но я думаю вам лень так что краткий гайд..
Этап 1.
создаём файл с названием HeadGlsl путь примерно такой: src\main\eva\utils\render\shader\shaders\
В созданном файле пишем:
Этап 2.
заходим в Shaders.java
туда добавляем эту строку:
Этап 3.
Заходим в ShaderUtility.java
туда добавляем это:
И:
И ВРОДЕ ВСЁ
ТЕПЕРЬ ВЫ ПАСТЕР

Пожалуйста, авторизуйтесь для просмотра ссылки.
TargetHud:
package main.lotex.ui.clienthud.impl;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import main.eva.Evaware;
import main.eva.events.AttackEvent;
import main.eva.events.EventRender2D;
import main.eva.ui.clienthud.updater.ElementRenderer;
import main.eva.manager.Theme;
import main.eva.utils.animations.AnimationUtility;
import main.eva.utils.animations.Direction;
import main.eva.utils.animations.impl.DecelerateAnimation;
import main.eva.utils.animations.impl.EaseBackIn;
import main.eva.manager.drag.Dragging;
import main.eva.utils.client.ClientUtility;
import main.eva.utils.math.MathUtility;
import main.eva.utils.math.TimerUtility;
import main.eva.utils.math.Vector4i;
import main.eva.utils.render.color.ColorUtility;
import main.eva.utils.render.font.Fonts;
import main.eva.utils.render.other.Scissor;
import main.eva.utils.render.engine2d.RenderUtility;
import main.eva.utils.render.engine2d.RectUtility;
import main.eva.utils.text.font.ClientFonts;
import lombok.AccessLevel;
import lombok.Getter;
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.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.scoreboard.Score;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector3d;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicReference;
import static main.lotex.utils.render.shader.ShaderUtility.head;
@FieldDefaults(level = AccessLevel.PRIVATE)
@RequiredArgsConstructor
public class TargetHud implements ElementRenderer {
final TimerUtility timerUtility = new TimerUtility();
[USER=270918]@Getter[/USER]
final Dragging drag;
[USER=270918]@Getter[/USER]
LivingEntity entity = null;
boolean allow;
private final AnimationUtility alpha = new DecelerateAnimation(600, 1);
final AnimationUtility animation = new EaseBackIn(400, 1, 1);
float healthAnimation = 0.0f;
float absorptionAnimation = 0.0f;
private float targetHealth = 0f;
private float animatedHealth = 0f;
float width = 168 / 1.5f;
float height = 55 / 1.5f;
int headSize = 25;
float spacing = 5;
public void onAttack(AttackEvent e) {
if (e.entity == mc.player) {
return;
}
if (entity == null) {
return;
}
if (e.entity instanceof LivingEntity) {
for (int i = 0; i < 15; ++i) {
lotex.getInst().getModuleManager().getHud().getParticles().add(new HeadParticle(new Vector3d(drag.getX() + spacing + headSize / 2f, drag.getY() + spacing + headSize / 2f, 0.0)));
}
}
}
[USER=1367676]@override[/USER]
public void render(EventRender2D eventRender2D) {
MatrixStack ms = eventRender2D.getMatrixStack();
entity = getTarget(entity);
float size;
boolean nigggerBotIsState = lotex.getInst().getModuleManager().getTriggerbot().isEnabled();
boolean AuraIsState = lotex.getInst().getModuleManager().getAura().isEnabled();
boolean out = nigggerBotIsState && !AuraIsState ? timerUtility.isReached(500) : !allow;
alpha.setDuration(out ? 450 : 300);
alpha.setDirection(out ? Direction.BACKWARDS : Direction.FORWARDS);
animation.setDuration(out ? 300 : 200);
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();
drag.setWidth(width);
drag.setHeight(height);
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 (entity instanceof PlayerEntity) {
if (ClientUtility.isConnectedToServer("funtime") && (header.contains("анархия") || header.contains("гриферский"))) {
hp = score.getScorePoints();
maxHp = 20;
}
}
if (targetHealth != hp) {
targetHealth = hp;
}
animatedHealth = MathUtility.fast(animatedHealth, targetHealth, 5);
healthAnimation = MathUtility.fast(healthAnimation, MathHelper.clamp(animatedHealth / maxHp, 0, 1), 10);
absorptionAnimation = MathUtility.fast(absorptionAnimation, MathHelper.clamp(entity.getAbsorptionAmount() / maxHp, 0, 1), 10);
String healthText = String.format("%.1f", animatedHealth);
GlStateManager.pushMatrix();
if (is("Обычный")) {
Vector4i colors = null;
if (hp >= 13) {
colors = new Vector4i(ColorUtility.rgba(0, 255, 0, (int) (255 * alpha.getOutput())), ColorUtility.rgba(0, 255, 0, (int) (255 * alpha.getOutput())), ColorUtility.rgba(0, 150, 0, (int) (255 * alpha.getOutput())), ColorUtility.rgba(0, 150, 0, (int) (255 * alpha.getOutput())));
} else if (hp <= 13 && hp >= 6) {
colors = new Vector4i(ColorUtility.rgba(255, 150, 0, (int) (255 * alpha.getOutput())), ColorUtility.rgba(255, 150, 0, (int) (255 * alpha.getOutput())), ColorUtility.rgba(140, 80, 0, (int) (255 * alpha.getOutput())), ColorUtility.rgba(140, 80, 0, (int) (255 * alpha.getOutput())));
} else {
colors = new Vector4i(ColorUtility.rgba(255, 0, 0, (int) (255 * alpha.getOutput())), ColorUtility.rgba(255, 0, 0, (int) (255 * alpha.getOutput())), ColorUtility.rgba(140, 1, 1, (int) (255 * alpha.getOutput())), ColorUtility.rgba(140, 1, 1, (int) (255 * alpha.getOutput())));
}
height = 55 / 1.5f;
width = 165 / 1.5f;
headSize = 20;
RenderUtility.drawRoundedRect(posX, posY, width, height, 5, ColorUtility.rgba(21, 21, 21, (int) (215 * alpha.getOutput())));
drawHead(ms, entity, posX + spacing + 0.5f, posY + spacing, headSize);
Scissor.push();
Scissor.setFromComponentCoordinates(posX, posY, width, height);
Fonts.montserrat.drawText(ms, name, posX - 2 + headSize + spacing + spacing, posY + 1.5f + spacing, ColorUtility.rgba(255, 255, 255, (int) (255 * alpha.getOutput())), 8, .07f);
Fonts.montserrat.drawText(ms, "Здоровья: " + healthText, posX - 2 + headSize + spacing + spacing, posY + 2f + spacing + spacing + spacing, ColorUtility.rgba(255, 255, 255, (int) (255 * alpha.getOutput())), 6, .05f);
RenderUtility.drawRoundedRect(posX + 5, posY + height - spacing * 2 + 1, width - 10, 5, 1.5f, ColorUtility.rgba(35, 35, 35, (int) (255 * alpha.getOutput())));
RenderUtility.drawRoundedRect(posX + 5, posY + height - spacing * 2 + 1, (width - 10) * healthAnimation, 5, 1.5f, colors);
Scissor.unset();
Scissor.pop();
}
drawItemStack(posX + 5, posY - 11, 8, 0.5f);
GlStateManager.popMatrix();
}
if (lotex.getInst().getModuleManager().getAura().getTarget() != null) {
if (lotex.getInst().getModuleManager().getHud().particlesOnTarget.getValue()) {
for (HeadParticle p : lotex.getInst().getModuleManager().getHud().getParticles()) {
if (System.currentTimeMillis() - p.time > 1500L) {
lotex.getInst().getModuleManager().getHud().getParticles().remove(p);
}
p.update();
size = 1.0f - (float) (System.currentTimeMillis() - p.time) / 1500.0f;
for (int i = 0; i < 10; i++) {
float offsetX = (float) (Math.random() - 0.5f) * 2.5f;
float offsetY = (float) (Math.random() - 0.5f) * 2.5f;
float alphaMultiplier = 0.3f;
RenderUtility.drawCircle(
(float) p.pos.x + offsetX,
(float) p.pos.y + offsetY,
3f,
ColorUtility.setAlpha(
ColorUtility.rgba(255, 255, 255, 10),
(int) (255.0f * p.alpha * size * alphaMultiplier)
)
);
}
}
}
}
}
private LivingEntity getTarget(LivingEntity nullTarget) {
boolean AuraIsState = lotex.getInst().getModuleManager().getAura().isEnabled();
LivingEntity niggerBotTarget = lotex.getInst().getModuleManager().getTriggerbot().getTarget();
LivingEntity finalTarget = AuraIsState ? lotex.getInst().getModuleManager().getAura().getTarget() : niggerBotTarget;
LivingEntity target = nullTarget;
if (finalTarget != null) {
timerUtility.reset();
allow = true;
target = finalTarget;
} else if (mc.currentScreen instanceof ChatScreen) {
timerUtility.reset();
allow = true;
target = mc.player;
} else {
allow = false;
}
return target;
}
private void drawHead(MatrixStack matrix, final Entity entity, final double x, final double y, final int size) {
if (entity instanceof AbstractClientPlayerEntity player) {
String rs = EntityType.getKey(((Entity)entity).getType()).getPath();
ResourceLocation skin = entity instanceof AbstractClientPlayerEntity e ? (e).getLocationSkin() : new ResourceLocation("textures/entity/"+rs+".png");
float hurtPercent = (((AbstractClientPlayerEntity) entity).hurtTime - (((AbstractClientPlayerEntity) entity).hurtTime != 0 ? mc.timer.renderPartialTicks : 0.0f)) / 10.0f;
mc.getTextureManager().bindTexture(skin);
RenderSystem.pushMatrix();
RenderSystem.enableBlend();
head.attach();
head.setUniformf("size", size,size);
head.setUniformf("radius", 4);
head.setUniformf("hurt_time", hurtPercent);
head.setUniformf("alpha", 1 * alpha.getOutput());
head.setUniformf("startX", 4);
head.setUniformf("startY", 4);
head.setUniformf("endX", 8);
head.setUniformf("endY", 8);
head.setUniformf("texXSize", 32);
head.setUniformf("texYSize", 32);
head.drawQuads((float) x, (float) y, size, size);
head.detach();
RenderSystem.disableBlend();
RenderSystem.popMatrix();
} else {
RectUtility.getInstance().drawRoundedRectShadowed(matrix, (float) x, (float) y, (float) (x + size), (float) (y + size - 1.5f), 5F, 1, ColorUtility.getColor(20, (int) (128 * alpha.getOutput())), ColorUtility.getColor(20, (int) (128 * alpha.getOutput())), ColorUtility.getColor(20, (int) (128 * alpha.getOutput())), ColorUtility.getColor(20, (int) (128 * alpha.getOutput())), false, false, true, true);
ClientFonts.icon_nur[25].drawCenteredString(matrix, "N", (float) (x + (size / 2F) ), (float) (y +(size) - 2f - (ClientFonts.interRegular[size * 2].getFontHeight() / 2F)), ColorUtility.rgba(255,255,255, (int) (255 * alpha.getOutput())));
}
}
private void drawItemStack(float x, float y, float offset, float scale) {
ArrayList<ItemStack> stackList = new ArrayList(Arrays.asList(this.entity.getHeldItemMainhand(), this.entity.getHeldItemOffhand()));
stackList.addAll((Collection)this.entity.getArmorInventoryList());
AtomicReference<Float> posX = new AtomicReference(x);
stackList.stream().filter((stack) -> {
return !stack.isEmpty();
}).forEach((stack) -> {
drawItemStack(stack, (Float)posX.getAndAccumulate(offset, Float::sum), y, true, true, scale);
});
}
public void drawItemStack(ItemStack stack, float x, float y, boolean withoutOverlay, boolean scale, float scaleValue) {
RenderUtility.sizeAnimation(x , y, animation.getOutput());
RenderSystem renderSystem = new RenderSystem();
renderSystem.pushMatrix();
renderSystem.translatef(x, y, 0.0F);
if (scale) {
GL11.glScaled((double)scaleValue, (double)scaleValue, (double)scaleValue);
}
mc.getItemRenderer().renderItemAndEffectIntoGUI(stack, 0, 0);
if (withoutOverlay) {
mc.getItemRenderer().renderItemOverlays(mc.fontRenderer, stack, 0, 0);
}
renderSystem.popMatrix();
}
public static boolean is(String name) {
return lotex.getInst().getModuleManager().getHud().tHudMode.is(name);
}
public class FloatFormatter {
public float format(float value) {
float multiplier = (float) Math.pow(10, 1);
return Math.round(value * multiplier) / multiplier;
}
}
public static class HeadParticle {
private Vector3d pos;
private final Vector3d end;
private final long time;
private float alpha;
public HeadParticle(Vector3d pos) {
this.pos = pos;
this.end = pos.add((double)(-ThreadLocalRandom.current().nextFloat(-200, 200)), (double)(-ThreadLocalRandom.current().nextFloat(-200, 200)), (double)(-ThreadLocalRandom.current().nextFloat(-200, 200)));
this.time = System.currentTimeMillis();
}
public void update() {
this.alpha = MathUtility.lerp(this.alpha, 1.0F, 10.0F);
this.pos = MathUtility.fast(this.pos, this.end, 0.5F);
}
}
}
ВАЖНО!
сразу говорю надо добавить шейдер на закругление бошки с этой темы -> Закругление головы шейдером в TargetHUD
Но я думаю вам лень так что краткий гайд..
Этап 1.
создаём файл с названием HeadGlsl путь примерно такой: src\main\eva\utils\render\shader\shaders\
В созданном файле пишем:
HeadGlsl:
package main.eva.utils.render.shader.shaders;
import main.eva.utils.render.shader.IShader;
public class HeadGlsl implements IShader {
[USER=1367676]@override[/USER]
public String glsl() {
return """
#version 120
uniform sampler2D texture;
uniform vec2 size;
uniform float radius;
uniform float hurt_time;
uniform float alpha;
uniform float startX, endX;
uniform float startY, endY;
uniform float texXSize;
uniform float texYSize;
float signedDistanceField(vec2 p, vec2 b, float r) {
return length(max(abs(p) - b, 0.0)) - r;
}
void main() {
vec2 tex = gl_TexCoord[0].st;
vec2 clippedTexCoord = vec2(
mix(startX / texXSize, endX / texXSize, tex.x),
mix(startY / texYSize, endY / texYSize, tex.y)
);
vec4 smpl = texture2D(texture, clippedTexCoord);
vec2 pixel = tex * size;
vec2 centre = 0.5 * size;
float sa = smoothstep(0.0, 1, signedDistanceField(centre - pixel, centre - radius - 1, radius));
vec4 c = mix(vec4(smpl.rgb, smpl.a), vec4(smpl.rgb, 0), sa);
gl_FragColor = vec4(mix(smpl.rgb, vec3(1.0, 0.0, 0.0), hurt_time), c.a * alpha);
}""";
}
}
Этап 2.
заходим в Shaders.java
туда добавляем эту строку:
private final IShader head = new HeadGlsl();Этап 3.
Заходим в ShaderUtility.java
туда добавляем это:
public static ShaderUtility head = new ShaderUtility("round-head");И:
case "round-head" -> createShader(Shaders.getInstance().getHead(), GL_FRAGMENT_SHADER);И ВРОДЕ ВСЁ
ТЕПЕРЬ ВЫ ПАСТЕР
