package client.main.module.impl.visuals;
import client.events.EventRenderer2D;
import client.events.EventUpdate;
import client.events.Render3DPosedEvent;
import client.main.Vesence;
import client.main.module.api.Category;
import client.main.module.api.Feature;
import client.main.module.api.FeatureInfo;
import client.main.module.impl.ui.Theme;
import client.main.module.settings.implObjects.CheckBoxObject;
import client.main.module.settings.implObjects.ColorSetObject;
import client.main.module.settings.implObjects.SelectObject;
import client.main.module.settings.implObjects.SliderObject;
import client.util.display.animations.Animation;
import client.util.display.animations.Direction;
import client.util.display.animations.impl.DecelerateAnimation;
import client.util.display.render.ColorUtil;
import client.util.display.render.RenderUtil;
import client.util.math.MathUtil;
import client.util.math.Vector4i;
import client.util.player.projections.ProjectionUtil;
import client.util.screenUtil.normalRect.RectUtil;
import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.*;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import static com.mojang.blaze3d.platform.GlStateManager.GL_QUADS;
import static com.mojang.blaze3d.systems.RenderSystem.depthMask;
import static java.lang.Math.cos;
import static java.lang.Math.sin;
import static net.minecraft.client.renderer.WorldRenderer.frustum;
import static net.minecraft.client.renderer.vertex.DefaultVertexFormats.POSITION_COLOR_TEX;
import static org.lwjgl.opengl.GL11.GL_ONE;
import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA;
@FeatureInfo(name = "Target ESP", desc = "Показывает на какую сущность нацелена AttackAura красивым визуальным эффектом", type = Category.Visual)
public class TargetESP extends Feature {
private SelectObject mode = new SelectObject("Вид", "Маркер", "Маркер", "Призраки", "Души", "Кольцо");
private SelectObject markerMode = new SelectObject("Вид маркера", "Ромб", "Ромб", "Маркер", "Квадрат").setVisible(() -> mode.is("Маркер"));
private SliderObject markerSize = new SliderObject("Размер маркера", 1.0f, 0.5f, 3.0f, 0.1f).setVisible(() -> mode.is("Маркер"));
public static SelectObject coloresp = new SelectObject("Цвет", "Из темы", "Из темы", "Свой");
public static ColorSetObject CustomColor = new ColorSetObject("Ваш цвет", ColorUtil.rgba(255, 255, 255, 255))
.setVisible(() -> coloresp.is("Свой"));
private CheckBoxObject walls = new CheckBoxObject("Отображать сквозь стены", false).setVisible(() -> mode.is("Призраки") || mode.is("Души") || mode.is("Кольцо"));
private CheckBoxObject redAttack = new CheckBoxObject("Краснеть при ударе", false);
private CheckBoxObject triggerESP = new CheckBoxObject("Отображать при TriggerBot", true);
private final Animation alpha = new DecelerateAnimation(600, 255);
private LivingEntity currentTarget;
private final Animation markerAlpha = new DecelerateAnimation(400, 255);
private final Animation markerScale = new DecelerateAnimation(400, 1.0);
private long lastTime = System.currentTimeMillis();
private static final float SOULS_SPEED = 38;
private static final float SOULS_SIZE = 0.5f;
private static final double SOULS_DISTANCE = 22;
private static final int SOULS_LENGTH = 95;
private static final int SOULS_MAX_ALPHA = 230;
private static final int SOULS_ALPHA_FACTOR = 18;
private static final double SOULS_RADIUS = 0.7f;
private static final float SOULS_TAPER = 5;
private long lastHitTime = 0L;
private float movingInterpolated = 0F, moving = 0F;
public TargetESP() {
addSettings(mode, markerMode, markerSize, coloresp, CustomColor, walls, redAttack, triggerESP);
}
public int getESPColor(int alphaOverride) {
if (coloresp.is("Свой")) {
return ColorUtil.setAlpha(CustomColor.get(), alphaOverride);
} else {
return ColorUtil.setAlpha(Theme.ClientColor(), alphaOverride);
}
}
@Subscribe
private void onUpdate(EventUpdate e) {
LivingEntity auraTarget = Vesence.getInstance().getModuleManager().getAura().getTarget();
LivingEntity triggerBotTarget = Vesence.getInstance().getModuleManager().getTriggerBot().getTarget();
// Обновляем текущую цель
if (auraTarget != null) {
currentTarget = auraTarget;
} else if (triggerBotTarget != null) {
currentTarget = triggerBotTarget;
}
// Проверяем условия для показа ESP
boolean auraESP = Vesence.getInstance().getModuleManager().getAura().isEnabled() && auraTarget != null;
boolean triggerBotESP = Vesence.getInstance().getModuleManager().getTriggerBot().isEnabled() &&
triggerBotTarget != null && triggerESP.get();
boolean shouldShow = auraESP || triggerBotESP;
// Управляем анимациями в зависимости от режима
if (mode.is("Маркер")) {
this.markerAlpha.setDirection(shouldShow ? Direction.FORWARDS : Direction.BACKWARDS);
this.markerScale.setDirection(shouldShow ? Direction.FORWARDS : Direction.BACKWARDS);
} else {
this.alpha.setDirection(shouldShow ? Direction.FORWARDS : Direction.BACKWARDS);
}
}
@Subscribe
public void onRender(Render3DPosedEvent e) {
if (this.alpha.finished(Direction.BACKWARDS)) {
return;
}
GlStateManager.pushMatrix();
if (mode.is("Кольцо")) {
drawCircleMarker(e);
}
if (mode.is("Призраки")) {
drawSoulsMarker(e.getMatrix(), e);
}
if (mode.is("Души")) {
drawPastaMarker(e.getMatrix(), e);
}
if (mode.is("Новый")) {
renderTriangleTrajectory(e.getMatrix());
}
GlStateManager.popMatrix();
}
@Subscribe
public void onDisplay(EventRenderer2D e) {
if (mc.world == null || e.getType() != EventRenderer2D.Type.PRE) {
return;
}
if (mode.is("Маркер")) {
drawImageMarker(e);
}
}
public static boolean isInView(Entity ent) {
assert mc.getRenderViewEntity() != null;
frustum.setCameraPosition(mc.getRenderManager().info.getProjectedView().x, mc.getRenderManager().info.getProjectedView().y, mc.getRenderManager().info.getProjectedView().z);
return frustum.isBoundingBoxInFrustum(ent.getBoundingBox()) || ent.ignoreFrustumCheck;
}
public double getScale(Vector3d position, double size) {
Vector3d cam = mc.getRenderManager().info.getProjectedView();
double distance = cam.distanceTo(position);
double fov = mc.gameRenderer.getFOVModifier(mc.getRenderManager().info, mc.getRenderPartialTicks(), true);
return Math.max(10f, 1000 / distance) * (size / 30f) / (fov == 70 ? 1 : fov / 70.0f);
}
public void drawPastaMarker(MatrixStack stack, Render3DPosedEvent e) {
Minecraft mc = Minecraft.getInstance();
if (this.currentTarget != null && this.currentTarget != mc.player) {
MatrixStack ms = stack;
ms.push();
RenderSystem.pushMatrix();
if (walls.get()) {
RenderSystem.disableDepthTest();
} else {
RenderSystem.enableDepthTest();
}
RenderSystem.disableLighting();
RenderSystem.depthMask(false);
RenderSystem.enableBlend();
RenderSystem.blendFuncSeparate(770, 1, 0, 1);
RenderSystem.shadeModel(7425);
RenderSystem.disableCull();
RenderSystem.disableAlphaTest();
double radius = 0.6F;
float speed = 10.0F;
float size = 0.3F;
double distance = 25.0F;
float lenght = 10.0F;
// --- ключевое: смещение камеры берём как в souls ---
ActiveRenderInfo camera = e.getActiveRenderInfo();
ms.translate(-camera.getProjectedView().x,
-camera.getProjectedView().y,
-camera.getProjectedView().z);
// Интерполированная позиция цели
Vector3d interpolated = MathUtil.interpolate(
this.currentTarget.getPositionVec(),
new Vector3d(this.currentTarget.lastTickPosX,
this.currentTarget.lastTickPosY,
this.currentTarget.lastTickPosZ),
e.getPartialTicks()
);
interpolated = interpolated.add(0.1, 1.25, 0.0); // твой оффсет
ms.translate(interpolated.x, interpolated.y, interpolated.z);
mc.getTextureManager().bindTexture(new ResourceLocation("vesencedlc/images/modules/glows/glow.png"));
boolean wasHitRecently = System.currentTimeMillis() - this.lastHitTime < 500L;
boolean isDamaged = this.currentTarget.hurtTime > 0;
int baseAlpha = (int) this.alpha.getOutput();
for (int j = 0; j < 3; ++j) {
for (int i = 0; (float) i < lenght; ++i) {
Quaternion r = camera.getRotation().copy();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX);
double angle = 0.05F * ((System.currentTimeMillis() - this.lastTime) - (i * distance)) / speed;
float shrinkFactor = 1.5F - (float) i / lenght;
float currentSize = size * shrinkFactor;
double s = sin(angle + j * 1.4f) * radius;
double c = cos(angle + j * 1.4f) * radius;
double verticalOffset = sin(angle * 1.05) * 0.3;
double yOffset = (j == 0 ? 0.4 : j == 1 ? -0.4 : 0.0);
ms.translate(0.0F, yOffset + verticalOffset, 0.0F);
ms.translate(s, 0.0F, -c);
ms.translate(-size / 2.0F, -size / 2.0F, 0.0F);
ms.rotate(r);
ms.translate(size / 2.0F, size / 2.0F, 0.0F);
int color;
if (!wasHitRecently && !isDamaged) {
color = ColorUtil.setAlpha(getESPColor(baseAlpha), baseAlpha);
} else {
color = new Color(255, 100, 100, baseAlpha).getRGB();
}
int themed = ColorUtil.setAlpha(getESPColor(baseAlpha), baseAlpha);
int drawColor = (Boolean) this.redAttack.get() ? color : themed;
buffer.pos(ms.getLast().getMatrix(), 0.0F, -currentSize, 0.0F).color(drawColor).tex(0.0F, 0.0F).endVertex();
buffer.pos(ms.getLast().getMatrix(), -currentSize, -currentSize, 0.0F).color(drawColor).tex(0.0F, 1.0F).endVertex();
buffer.pos(ms.getLast().getMatrix(), -currentSize, 0.0F, 0.0F).color(drawColor).tex(1.0F, 1.0F).endVertex();
buffer.pos(ms.getLast().getMatrix(), 0.0F, 0.0F, 0.0F).color(drawColor).tex(1.0F, 0.0F).endVertex();
tessellator.draw();
ms.translate(-size / 2.0F, -size / 2.0F, 0.0F);
r.conjugate();
ms.rotate(r);
ms.translate(size / 2.0F, size / 2.0F, 0.0F);
ms.translate(-s, 0.0F, c);
ms.translate(0.0F, -(yOffset + verticalOffset), 0.0F);
}
}
RenderSystem.defaultBlendFunc();
if (walls.get()) {
RenderSystem.disableDepthTest();
} else {
RenderSystem.enableDepthTest();
}
RenderSystem.depthMask(true);
RenderSystem.enableCull();
RenderSystem.enableAlphaTest();
RenderSystem.popMatrix();
ms.pop();
}
}
private float hurtProgress = 0f;
public void drawImageMarker(EventRenderer2D e) {
if (this.currentTarget != null && this.currentTarget != mc.player) {
double sin = sin(System.currentTimeMillis() / 1000.0);
double distance = mc.player.getDistance(currentTarget);
float maxSize = (float) getScale(currentTarget.getPositionVec(), 10);
float baseSize = Math.max(maxSize - (float) distance, 20.0F) * markerSize.get();
// Применяем анимацию scale для маркера
float animatedScale = (float) markerScale.getOutput();
float size = baseSize * animatedScale;
Vector3d interpolated = currentTarget.getPositon(e.getPartialTicks());
Vector2f pos = ProjectionUtil.project(interpolated.x, interpolated.y + currentTarget.getHeight() / 2f, interpolated.z);
if (pos != null) {
GlStateManager.pushMatrix();
GlStateManager.translatef(pos.x, pos.y, 0);
GlStateManager.rotatef((float) sin * 360, 0, 0, 1);
GlStateManager.translatef(-pos.x, -pos.y, 0);
// Применяем анимацию alpha для маркера
int baseAlpha = (int) markerAlpha.getOutput();
int normalColor = getESPColor(baseAlpha);
int baseColor = normalColor;
int normalColor2 = ColorUtil.multDark(getESPColor(baseAlpha), 0.3f);
int baseColor2 = normalColor2;
if (redAttack.get()) {
boolean isHurt = currentTarget.hurtTime > 0;
float targetHurt = isHurt ? 1.0f : 0.0f;
float transitionSpeed = 0.03f;
hurtProgress += (targetHurt - hurtProgress) * transitionSpeed;
int redColor = ColorUtil.setAlpha(ColorUtil.rgb(250, 113, 113), 1);
int redColor2 = ColorUtil.reAlphaInt(ColorUtil.multDark(ColorUtil.rgb(250, 113, 113), 0.3f), 1);
baseColor = ColorUtil.interpolateColor(normalColor, redColor, hurtProgress);
baseColor2 = ColorUtil.interpolateColor(normalColor, redColor, hurtProgress);
}
if (markerMode.is("Ромб")) {
RenderUtil.drawImageAlpha(new ResourceLocation("vesencedlc/images/modules/markers/marker.png"), pos.x - size / 2f, pos.y - size / 2f, size, size, new Vector4i(
ColorUtil.setAlpha(baseColor, (int) (markerAlpha.getOutput())),
ColorUtil.setAlpha(baseColor, (int) (markerAlpha.getOutput())),
ColorUtil.setAlpha(baseColor, (int) (markerAlpha.getOutput())),
ColorUtil.setAlpha(baseColor, (int) (markerAlpha.getOutput()))
));
}
if (markerMode.is("Маркер")) {
RenderUtil.drawImageAlpha(new ResourceLocation("vesencedlc/images/modules/markers/marker2.png"), pos.x - size / 2f, pos.y - size / 2f, size, size, new Vector4i(
ColorUtil.setAlpha(baseColor, (int) (markerAlpha.getOutput())),
ColorUtil.setAlpha(baseColor, (int) (markerAlpha.getOutput())),
ColorUtil.setAlpha(baseColor, (int) (markerAlpha.getOutput())),
ColorUtil.setAlpha(baseColor, (int) (markerAlpha.getOutput()))
));
RenderUtil.drawImageAlpha(new ResourceLocation("vesencedlc/images/modules/markers/marker2.png"), pos.x - size / 2f, pos.y - size / 2f, size, size, new Vector4i(
ColorUtil.setAlpha(baseColor, (int) (markerAlpha.getOutput())),
ColorUtil.setAlpha(baseColor, (int) (markerAlpha.getOutput())),
ColorUtil.setAlpha(baseColor, (int) (markerAlpha.getOutput())),
ColorUtil.setAlpha(baseColor, (int) (markerAlpha.getOutput()))
));
}
if (markerMode.is("Квадрат")) {
RenderUtil.drawImageAlpha(new ResourceLocation("vesencedlc/images/modules/markers/marker3.png"), pos.x - size / 2f, pos.y - size / 2f, size, size, new Vector4i(
ColorUtil.setAlpha(baseColor, (int) (markerAlpha.getOutput())),
ColorUtil.setAlpha(baseColor, (int) (markerAlpha.getOutput())),
ColorUtil.setAlpha(baseColor, (int) (markerAlpha.getOutput())),
ColorUtil.setAlpha(baseColor, (int) (markerAlpha.getOutput()))
));
RenderUtil.drawImageAlpha(new ResourceLocation("vesencedlc/images/modules/markers/marker3.png"), pos.x - size / 2f, pos.y - size / 2f, size, size, new Vector4i(
ColorUtil.setAlpha(baseColor, (int) (markerAlpha.getOutput())),
ColorUtil.setAlpha(baseColor, (int) (markerAlpha.getOutput())),
ColorUtil.setAlpha(baseColor, (int) (markerAlpha.getOutput())),
ColorUtil.setAlpha(baseColor, (int) (markerAlpha.getOutput()))
));
}
GlStateManager.popMatrix();
}
}
}
public int lerpColor(Color from, Color to, float progress) {
progress = Math.max(0f, Math.min(1f, progress));
int r = (int) (from.getRed() + (to.getRed() - from.getRed()) * progress);
int g = (int) (from.getGreen() + (to.getGreen() - from.getGreen()) * progress);
int b = (int) (from.getBlue() + (to.getBlue() - from.getBlue()) * progress);
return new Color(r, g, b).getRGB();
}
public void drawSoulsMarker(MatrixStack stack, Render3DPosedEvent e) {
if (this.currentTarget != null && this.currentTarget != mc.player) {
float alphaValue = (float) alpha.getOutput();
MatrixStack ms = stack;
ms.push();
RenderSystem.pushMatrix();
// --- Сохраняем GL-состояния ---
boolean blend = GL11.glIsEnabled(GL11.GL_BLEND);
boolean cull = GL11.glIsEnabled(GL11.GL_CULL_FACE);
boolean depthTest = GL11.glIsEnabled(GL11.GL_DEPTH_TEST);
boolean lighting = GL11.glIsEnabled(GL11.GL_LIGHTING);
if (walls.get()) {
RenderSystem.disableDepthTest();
} else {
RenderSystem.enableDepthTest();
}
RenderSystem.disableLighting();
depthMask(false);
RenderSystem.enableBlend();
RenderSystem.shadeModel(7425);
RenderSystem.disableCull();
RenderSystem.disableAlphaTest();
RenderSystem.blendFuncSeparate(GL_SRC_ALPHA, GL_ONE, 0, 1);
ActiveRenderInfo camera = mc.getRenderManager().info;
ms.translate(-camera.getProjectedView().x,
-camera.getProjectedView().y,
-camera.getProjectedView().z);
Vector3d interpolated = MathUtil.interpolate(currentTarget.getPositionVec(),
new Vector3d(currentTarget.lastTickPosX, currentTarget.lastTickPosY, currentTarget.lastTickPosZ),
e.getPartialTicks());
interpolated = interpolated.add(0.2f, 0.8f, 0.0f);
ms.translate(interpolated.x, interpolated.y + 0.5f, interpolated.z);
RenderUtil.bindTexture(new ResourceLocation("vesencedlc/images/modules/glows/glow.png"));
for (int i = 0; i < SOULS_LENGTH; i++) {
Quaternion r = camera.getRotation().copy();
buffer.begin(GL_QUADS, POSITION_COLOR_TEX);
double angle = 0.15f * (System.currentTimeMillis() - lastTime - (i * SOULS_DISTANCE)) / (SOULS_SPEED);
double s = sin(angle) * SOULS_RADIUS;
double c = cos(angle) * SOULS_RADIUS;
float currentSize = SOULS_SIZE * (1.0f - (i / (float) SOULS_LENGTH) * SOULS_TAPER);
ms.translate(s, (c), -c);
ms.translate(-currentSize / 2f, -currentSize / 2f, 0);
ms.rotate(r);
ms.translate(currentSize / 2f, currentSize / 2f, 0);
int baseAlpha = (int) this.alpha.getOutput();
Color normalColor = new Color(client.util.screenUtil.normalColor.ColorUtil.fade(10, 0, getESPColor(baseAlpha), getESPColor(baseAlpha)), true);
int baseColor = normalColor.getRGB();
if (redAttack.get()) {
boolean isHurt = currentTarget.hurtTime > 0;
float targetHurt = isHurt ? 1.0f : 0.0f;
float transitionSpeed = 0.02f;
hurtProgress += (targetHurt - hurtProgress) * transitionSpeed;
Color redColor = new Color(250, 113, 113);
baseColor = lerpColor(normalColor, redColor, hurtProgress);
}
int color = baseColor;
int alpha = (int) (MathHelper.clamp(SOULS_MAX_ALPHA - (i * SOULS_ALPHA_FACTOR), 0, SOULS_MAX_ALPHA) * (alphaValue / 255f));
buffer.pos(ms.getLast().getMatrix(), 0, -currentSize, 0)
.color(ColorUtil.reAlphaInt(color, alpha))
.tex(0, 0).endVertex();
buffer.pos(ms.getLast().getMatrix(), -currentSize, -currentSize, 0)
.color(ColorUtil.reAlphaInt(color, alpha))
.tex(0, 1).endVertex();
buffer.pos(ms.getLast().getMatrix(), -currentSize, 0, 0)
.color(ColorUtil.reAlphaInt(color, alpha))
.tex(1, 1).endVertex();
buffer.pos(ms.getLast().getMatrix(), 0, 0, 0)
.color(ColorUtil.reAlphaInt(color, alpha))
.tex(1, 0).endVertex();
tessellator.draw();
ms.translate(-currentSize / 2f, -currentSize / 2f, 0);
r.conjugate();
ms.rotate(r);
ms.translate(currentSize / 2f, currentSize / 2f, 0);
ms.translate(-(s), -(c), (c));
}
for (int i = 0; i < SOULS_LENGTH; i++) {
Quaternion r = camera.getRotation().copy();
buffer.begin(GL_QUADS, POSITION_COLOR_TEX);
double angle = 0.15f * (System.currentTimeMillis() - lastTime - (i * SOULS_DISTANCE)) / (SOULS_SPEED);
double s = sin(angle) * SOULS_RADIUS;
double c = cos(angle) * SOULS_RADIUS;
float currentSize = SOULS_SIZE * (1.0f - (i / (float) SOULS_LENGTH) * SOULS_TAPER);
ms.translate(-s, s, -c);
ms.translate(-currentSize / 2f, -currentSize / 2f, 0);
ms.rotate(r);
ms.translate(currentSize / 2f, currentSize / 2f, 0);
int baseAlpha = (int) this.alpha.getOutput();
Color normalColor = new Color(client.util.screenUtil.normalColor.ColorUtil.fade(10, 0, getESPColor(baseAlpha), getESPColor(baseAlpha)), true);
int baseColor = normalColor.getRGB();
if (redAttack.get()) {
boolean isHurt = currentTarget.hurtTime > 0;
float targetHurt = isHurt ? 1.0f : 0.0f;
float transitionSpeed = 0.02f;
hurtProgress += (targetHurt - hurtProgress) * transitionSpeed;
Color redColor = new Color(250, 113, 113);
baseColor = lerpColor(normalColor, redColor, hurtProgress);
}
int color = baseColor;
int alpha = (int) (MathHelper.clamp(SOULS_MAX_ALPHA - (i * SOULS_ALPHA_FACTOR), 0, SOULS_MAX_ALPHA) * (alphaValue / 255f));
buffer.pos(ms.getLast().getMatrix(), 0, -currentSize, 0)
.color(ColorUtil.reAlphaInt(color, alpha))
.tex(0, 0).endVertex();
buffer.pos(ms.getLast().getMatrix(), -currentSize, -currentSize, 0)
.color(ColorUtil.reAlphaInt(color, alpha))
.tex(0, 1).endVertex();
buffer.pos(ms.getLast().getMatrix(), -currentSize, 0, 0)
.color(ColorUtil.reAlphaInt(color, alpha))
.tex(1, 1).endVertex();
buffer.pos(ms.getLast().getMatrix(), 0, 0, 0)
.color(ColorUtil.reAlphaInt(color, alpha))
.tex(1, 0).endVertex();
tessellator.draw();
ms.translate(-currentSize / 2f, -currentSize / 2f, 0);
r.conjugate();
ms.rotate(r);
ms.translate(currentSize / 2f, currentSize / 2f, 0);
ms.translate((s), -(s), (c));
}
for (int i = 0; i < SOULS_LENGTH; i++) {
Quaternion r = camera.getRotation().copy();
buffer.begin(GL_QUADS, POSITION_COLOR_TEX);
double angle = 0.15f * (System.currentTimeMillis() - lastTime - (i * SOULS_DISTANCE)) / (SOULS_SPEED);
double s = sin(angle) * SOULS_RADIUS;
double c = cos(angle) * SOULS_RADIUS;
float currentSize = SOULS_SIZE * (1.0f - (i / (float) SOULS_LENGTH) * SOULS_TAPER);
ms.translate(-(s), -(s), (c));
ms.translate(-currentSize / 2f, -currentSize / 2f, 0);
ms.rotate(r);
ms.translate(currentSize / 2f, currentSize / 2f, 0);
int baseAlpha = (int) this.alpha.getOutput();
Color normalColor = new Color(client.util.screenUtil.normalColor.ColorUtil.fade(10, 0, getESPColor(baseAlpha), getESPColor(baseAlpha)), true);
int baseColor = normalColor.getRGB();
if (redAttack.get()) {
boolean isHurt = currentTarget.hurtTime > 0;
float targetHurt = isHurt ? 1.0f : 0.0f;
float transitionSpeed = 0.02f;
hurtProgress += (targetHurt - hurtProgress) * transitionSpeed;
Color redColor = new Color(250, 113, 113);
baseColor = lerpColor(normalColor, redColor, hurtProgress);
}
int color = baseColor;
int alpha = (int) (MathHelper.clamp(SOULS_MAX_ALPHA - (i * SOULS_ALPHA_FACTOR), 0, SOULS_MAX_ALPHA) * (alphaValue / 255f));
buffer.pos(ms.getLast().getMatrix(), 0, -currentSize, 0)
.color(ColorUtil.reAlphaInt(color, alpha))
.tex(0, 0).endVertex();
buffer.pos(ms.getLast().getMatrix(), -currentSize, -currentSize, 0)
.color(ColorUtil.reAlphaInt(color, alpha))
.tex(0, 1).endVertex();
buffer.pos(ms.getLast().getMatrix(), -currentSize, 0, 0)
.color(ColorUtil.reAlphaInt(color, alpha))
.tex(1, 1).endVertex();
buffer.pos(ms.getLast().getMatrix(), 0, 0, 0)
.color(ColorUtil.reAlphaInt(color, alpha))
.tex(1, 0).endVertex();
tessellator.draw();
ms.translate(-currentSize / 2f, -currentSize / 2f, 0);
r.conjugate();
ms.rotate(r);
ms.translate(currentSize / 2f, currentSize / 2f, 0);
ms.translate((s), (s), -(c));
}
if (walls.get()) {
RenderSystem.disableDepthTest();
} else {
RenderSystem.enableDepthTest();
}
if (!blend) GL11.glDisable(GL11.GL_BLEND);
if (cull) GL11.glEnable(GL11.GL_CULL_FACE);
else GL11.glDisable(GL11.GL_CULL_FACE);
if (depthTest) GL11.glEnable(GL11.GL_DEPTH_TEST);
else GL11.glDisable(GL11.GL_DEPTH_TEST);
if (lighting) RenderSystem.enableLighting();
else RenderSystem.disableLighting();
depthMask(true);
RenderSystem.enableCull();
RenderSystem.enableAlphaTest();
RenderSystem.disableBlend();
ms.pop();
RenderSystem.popMatrix();
}
}
private void drawSoul(MatrixStack ms, double x, double y, double z, float size, int color) {
ms.push();
ms.translate(x, y, z);
ms.rotate(mc.getRenderManager().info.getRotation());
int fadedColor = ColorUtil.reAlphaInt(color, (int) (0.05f * alpha.getOutput()));
int mainColor = ColorUtil.reAlphaInt(color, (int) alpha.getOutput());
ms.translate(-size / 2, -size / 2, 0);
RectUtil.drawRect(ms, 0, 0, size, size, fadedColor, fadedColor, fadedColor, fadedColor, true, true);
RectUtil.drawRect(ms, 0, 0, size, size, mainColor, mainColor, mainColor, mainColor, true, true);
ms.pop();
}
private void renderTriangleTrajectory(MatrixStack ms) {
float width = currentTarget.getWidth() * 1.6f;
float val = (float) Math.max(0.5f, 0.7f + 0.5f - 0.5f * alpha.getOutput());
float radius = width * val;
int trailLength = 49;
final float size = 0.05f;
float iSpeed = (10F / Minecraft.getInstance().getDebugFPS()) * 2F;
movingInterpolated = MathHelper.lerp(iSpeed, this.movingInterpolated, this.moving);
MatrixStack tempStack = new MatrixStack();
tempStack.push();
tempStack.translate(0, currentTarget.getHeight() / 2f, 0);
tempStack.rotate(Vector3f.YP.rotationDegrees(-movingInterpolated));
tempStack.rotate(Vector3f.XP.rotationDegrees(20.5f * (float) sin(Math.toRadians(movingInterpolated / 15f))));
Matrix4f transform = tempStack.getLast().getMatrix();
tempStack.pop();
for (int j = 0; j < 3; j++) {
for (int segment = 0; segment < trailLength; segment += 3) {
float bigSize = size + 0.007f * (trailLength - segment);
float baseAngleDeg = j * 120;
float segmentAngleRad = (float) Math.toRadians(baseAngleDeg - segment);
float x_p = radius * (float) cos(segmentAngleRad);
float z_p = radius * (float) sin(segmentAngleRad);
Vector4f pos = new Vector4f(x_p, 0, z_p, 1);
pos.transform(transform);
int color = Theme.ClientColor();
drawSoul(ms, pos.getX(), pos.getY(), pos.getZ(), bigSize, color);
}
}
}
public void drawCircleMarker(Render3DPosedEvent e) {
Minecraft mc = Minecraft.getInstance();
if (currentTarget == null) return;
// Получаем интерполированную позицию цели
Vector3d interpolated = MathUtil.interpolate(
currentTarget.getPositionVec(),
new Vector3d(currentTarget.lastTickPosX, currentTarget.lastTickPosY, currentTarget.lastTickPosZ),
e.getPartialTicks()
);
// Вычитаем позицию камеры для правильного отображения
ActiveRenderInfo camera = e.getActiveRenderInfo();
double x = interpolated.x - camera.getProjectedView().x;
double y = interpolated.y - camera.getProjectedView().y;
double z = interpolated.z - camera.getProjectedView().z;
float height = currentTarget.getHeight();
double duration = 2000;
double elapsed = (System.currentTimeMillis() % duration);
boolean side = elapsed > (duration / 2);
double progress = elapsed / (duration / 2);
if (side) progress -= 1;
else progress = 1 - progress;
progress = (progress < 0.5) ? 2 * progress * progress : 1 - Math.pow((-2 * progress + 2), 2) / 2;
double eased = (height / 2) * ((progress > 0.5) ? 1 - progress : progress) * ((side) ? -1 : 1);
MatrixStack matrixStack = e.getMatrix();
matrixStack.push();
RenderSystem.pushMatrix();
// Используем матрицу из события для правильного преобразования
RenderSystem.multMatrix(matrixStack.getLast().getMatrix());
GL11.glDepthMask(false);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
RenderSystem.disableTexture();
RenderSystem.enableBlend();
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
RenderSystem.disableAlphaTest();
RenderSystem.shadeModel(GL11.GL_SMOOTH);
RenderSystem.disableCull();
RenderSystem.lineWidth(1);
RenderSystem.color4f(-1f, -1f, -1f, -1f);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
buffer.begin(GL11.GL_QUAD_STRIP, DefaultVertexFormats.POSITION_COLOR);
for (int i = 0; i <= 360; i++) {
double cos = Math.cos(Math.toRadians(i)) * currentTarget.getWidth() * 1;
double sin = Math.sin(Math.toRadians(i)) * currentTarget.getWidth() * 1;
double yPos = y + (height * progress);
buffer.pos(x + cos, yPos, z + sin)
.color(ColorUtil.setAlpha(Theme.ClientColorSecondary(), (int) 1)).endVertex();
buffer.pos(x + cos, yPos + eased, z + sin)
.color(ColorUtil.setAlpha(Theme.ClientColorOne(), (int) alpha.getOutput())).endVertex();
}
tessellator.draw();
RenderSystem.color4f(-1f, -1f, -1f, -1f);
buffer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR);
tessellator.draw();
RenderSystem.enableCull();
RenderSystem.disableBlend();
RenderSystem.enableTexture();
RenderSystem.enableAlphaTest();
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
RenderSystem.shadeModel(GL11.GL_FLAT);
RenderSystem.popMatrix();
matrixStack.pop();
}
}