Начинающий
- Статус
- Оффлайн
- Регистрация
- 12 Июн 2025
- Сообщения
- 118
- Реакции
- 0
- Выберите загрузчик игры
- Fabric
$$$ target esp:
package zenith.zov.client.modules.impl.render;
import com.darkmagician6.eventapi.EventTarget;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gl.ShaderProgramKeys;
import net.minecraft.client.render.*;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import org.joml.Matrix4f;
import org.joml.Quaternionf;
import zenith.zov.Zenith;
import zenith.zov.base.events.impl.player.EventUpdate;
import zenith.zov.base.events.impl.render.EventRender3D;
import zenith.zov.client.modules.api.Category;
import zenith.zov.client.modules.api.Module;
import zenith.zov.client.modules.api.ModuleAnnotation;
import zenith.zov.client.modules.api.setting.impl.BooleanSetting;
import zenith.zov.client.modules.api.setting.impl.ModeSetting;
import zenith.zov.client.modules.api.setting.impl.NumberSetting;
import zenith.zov.client.modules.impl.combat.Aura;
import zenith.zov.utility.render.display.base.color.ColorRGBA;
import java.util.ArrayList;
import java.util.List;
@ModuleAnnotation(name = "TargetESP", description = "Подсвечивает главного врага", category = Category.RENDER)
public class TargetESP extends Module {
public static final TargetESP INSTANCE = new TargetESP();
private final BooleanSetting aimEsp = new BooleanSetting("При наведении", false);
private final BooleanSetting throughWalls = new BooleanSetting("Через стены", false);
private final NumberSetting numSides = new NumberSetting("Количество граней", 8F, 4F, 24F, 1F);
private final BooleanSetting rotate = new BooleanSetting("Вращение", true);
private final NumberSetting rotateSpeed = new NumberSetting("Скорость вращения", 1.0F, 0.1F, 5.0F, 0.1F, rotate::isEnabled);
private final BooleanSetting pulseCrystal = new BooleanSetting("Пульсация", true);
private final NumberSetting pulseSpeed = new NumberSetting("Скорость пульсации", 1.0F, 0.1F, 3.0F, 0.1F, pulseCrystal::isEnabled);
private final NumberSetting pulseAmount = new NumberSetting("Сила пульсации", 0.1F, 0.05F, 0.3F, 0.01F, pulseCrystal::isEnabled);
private final BooleanSetting verticalWave = new BooleanSetting("Вертикальная волна", false);
private final NumberSetting waveAmplitude = new NumberSetting("Амплитуда волны", 0.3F, 0.1F, 1.0F, 0.05F, verticalWave::isEnabled);
private LivingEntity target;
private float rotationAngle = 0F;
private long lastUpdateTime = System.currentTimeMillis();
private final List<Crystal> crystalList = new ArrayList<>();
private TargetESP() {
}
@EventTarget
public void onUpdate(EventUpdate event) {
if (mc.player == null || mc.world == null) {
return;
}
if (rotate.isEnabled()) {
long currentTime = System.currentTimeMillis();
float deltaTime = (currentTime - lastUpdateTime) / 1000.0f;
lastUpdateTime = currentTime;
rotationAngle += rotateSpeed.getCurrent() * 50 * deltaTime;
if (rotationAngle >= 360) {
rotationAngle -= 360;
}
}
LivingEntity newTarget = Aura.INSTANCE.getTarget();
if (aimEsp.isEnabled() && mc.targetedEntity instanceof LivingEntity) {
LivingEntity living = (LivingEntity) mc.targetedEntity;
if (living.isAlive()) {
newTarget = living;
}
}
if (newTarget != this.target) {
this.target = newTarget;
crystalList.clear();
}
if (this.target != null && !this.target.isAlive()) {
crystalList.clear();
} else if (this.target != null && crystalList.isEmpty()) {
createCrystals();
}
}
@EventTarget
public void onRender3D(EventRender3D event) {
if (target == null || !target.isAlive()) {
return;
}
renderCrystals(event);
}
//кристалы,я потом призраки доделаю
private void createCrystals() {
crystalList.clear();
int sides = (int) numSides.getCurrent();
crystalList.add(new Crystal(new Vec3d(-0.6, 2, 0.4), -40, 0, -25, sides, 0));
crystalList.add(new Crystal(new Vec3d(0, 1, 0.8), -49, 0, 40, sides, 1));
crystalList.add(new Crystal(new Vec3d(0.2, 1, -0.675), 35, 0, -30, sides, 2));
crystalList.add(new Crystal(new Vec3d(0.6, 1.5, 0.6), -30, 0, 35, sides, 3));
crystalList.add(new Crystal(new Vec3d(-0.74, 1.2, 0.4), -25, 0, -30, sides, 4));
crystalList.add(new Crystal(new Vec3d(0.74, 1.1, -0.4), 0, 0, 0, sides, 5));
crystalList.add(new Crystal(new Vec3d(-0.475, 1, -0.375), 30, 0, -25, sides, 6));
crystalList.add(new Crystal(new Vec3d(0, 1.5, -0.6), 45, 0, 0, sides, 7));
crystalList.add(new Crystal(new Vec3d(0.85, 0.85, 0.1), -30, 0, 30, sides, 8));
crystalList.add(new Crystal(new Vec3d(-0.7, 1.5, -0.3), 0, 0, 0, sides, 9));
crystalList.add(new Crystal(new Vec3d(-0.3, 1.5, 0.55), 0, 0, 0, sides, 10));
crystalList.add(new Crystal(new Vec3d(-0.5, 0.85, 0.7), 0, 0, 0, sides, 11));
crystalList.add(new Crystal(new Vec3d(0.5, 0.85, 0.7), 0, 0, 0, sides, 12));
crystalList.add(new Crystal(new Vec3d(-0.7, 0.9, 0), 0, 0, 0, sides, 13));
crystalList.add(new Crystal(new Vec3d(-0.2, 0.8, -0.7), 0, 0, 0, sides, 14));
}
private void renderCrystals(EventRender3D event) {
if (crystalList.isEmpty()) {
return;
}
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.disableCull();
if (throughWalls.isEnabled()) {
RenderSystem.disableDepthTest();
} else {
RenderSystem.enableDepthTest();
}
float partialTicks = event.getPartialTicks();
double x = MathHelper.lerp(partialTicks, target.prevX, target.getX());
double y = MathHelper.lerp(partialTicks, target.prevY, target.getY());
double z = MathHelper.lerp(partialTicks, target.prevZ, target.getZ());
MatrixStack ms = event.getMatrix();
ms.push();
ms.translate(
x - mc.gameRenderer.getCamera().getPos().x,
y - mc.gameRenderer.getCamera().getPos().y,
z - mc.gameRenderer.getCamera().getPos().z
);
for (Crystal crystal : crystalList) {
crystal.render(ms);
}
ms.pop();
RenderSystem.enableCull();
RenderSystem.enableDepthTest();
RenderSystem.disableBlend();
}
private class Crystal {
private final Vec3d basePosition;
private final float rotX, rotY, rotZ;
private final int numSides;
private final int index;
public Crystal(Vec3d basePosition, float rotX, float rotY, float rotZ, int numSides, int index) {
this.basePosition = basePosition;
this.rotX = rotX;
this.rotY = rotY;
this.rotZ = rotZ;
this.numSides = numSides;
this.index = index;
}
public void render(MatrixStack ms) {
ms.push();
Vec3d position = calculatePosition();
ms.translate(position.x, position.y, position.z);
float pulsation = 1.0f;
if (pulseCrystal.isEnabled()) {
float pulseTime = (System.currentTimeMillis() + index * 100) / (1000.0f / pulseSpeed.getCurrent());
pulsation = 1.0f + (float) (Math.sin(pulseTime) * pulseAmount.getCurrent());
}
ms.scale(pulsation, pulsation, pulsation);
ms.multiply(new Quaternionf().rotateX((float) Math.toRadians(rotX)));
ms.multiply(new Quaternionf().rotateY((float) Math.toRadians(rotY + (rotate.isEnabled() ? rotationAngle : 0))));
ms.multiply(new Quaternionf().rotateZ((float) Math.toRadians(rotZ)));
ColorRGBA baseColor = Zenith.getInstance().getThemeManager().getClientColor(index * 30);
drawCrystal(ms, baseColor, 0.2f, true);
drawCrystal(ms, baseColor, 1.0f, false);
ms.pop();
}
private Vec3d calculatePosition() {
if (!rotate.isEnabled()) {
return basePosition;
}
float angle = (float) Math.toRadians(rotationAngle);
float cos = (float) Math.cos(angle);
float sin = (float) Math.sin(angle);
float newX = (float) (basePosition.x * cos - basePosition.z * sin);
float newZ = (float) (basePosition.x * sin + basePosition.z * cos);
float newY = (float) basePosition.y;
if (verticalWave.isEnabled()) {
float waveTime = (System.currentTimeMillis() + index * 200) / 1000.0f;
newY += (float) (Math.sin(waveTime * 2) * waveAmplitude.getCurrent());
}
return new Vec3d(newX, newY, newZ);
}
private void drawCrystal(MatrixStack ms, ColorRGBA baseColor, float alpha, boolean filled) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer;
if (filled) {
buffer = tessellator.begin(VertexFormat.DrawMode.TRIANGLES, VertexFormats.POSITION_COLOR);
} else {
buffer = tessellator.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION_COLOR);
}
float s = 0.09f;
float h_prism = s * 1f;
float h_pyramid = s * 1.5f;
List<Vec3d> topVertices = new ArrayList<>();
List<Vec3d> bottomVertices = new ArrayList<>();
for (int i = 0; i < numSides; i++) {
float angle = (float) (2 * Math.PI * i / numSides);
float x = (float) (s * Math.cos(angle));
float z = (float) (s * Math.sin(angle));
topVertices.add(new Vec3d(x, h_prism / 2, z));
bottomVertices.add(new Vec3d(x, -h_prism / 2, z));
}
Vec3d vTop = new Vec3d(0, h_prism / 2 + h_pyramid, 0);
Vec3d vBottom = new Vec3d(0, -h_prism / 2 - h_pyramid, 0);
Matrix4f matrix = ms.peek().getPositionMatrix();
int color = baseColor.withAlpha((int) (alpha * 255)).getRGB();
for (int i = 0; i < numSides; i++) {
Vec3d v1 = bottomVertices.get(i);
Vec3d v2 = bottomVertices.get((i + 1) % numSides);
Vec3d v3 = topVertices.get((i + 1) % numSides);
Vec3d v4 = topVertices.get(i);
drawQuad(matrix, buffer, v1, v2, v3, v4, color, filled);
}
for (int i = 0; i < numSides; i++) {
Vec3d v1 = topVertices.get(i);
Vec3d v2 = topVertices.get((i + 1) % numSides);
drawTriangle(matrix, buffer, vTop, v1, v2, color, filled);
}
for (int i = 0; i < numSides; i++) {
Vec3d v1 = bottomVertices.get(i);
Vec3d v2 = bottomVertices.get((i + 1) % numSides);
drawTriangle(matrix, buffer, vBottom, v2, v1, color, filled);
}
RenderSystem.setShader(ShaderProgramKeys.POSITION_COLOR);
BufferRenderer.drawWithGlobalProgram(buffer.end());
}
private void drawTriangle(Matrix4f matrix, BufferBuilder buffer, Vec3d v1, Vec3d v2, Vec3d v3, int color, boolean filled) {
int r = (color >> 16) & 0xFF;
int g = (color >> 8) & 0xFF;
int b = color & 0xFF;
int a = (color >> 24) & 0xFF;
if (filled) {
buffer.vertex(matrix, (float) v1.x, (float) v1.y, (float) v1.z).color(r, g, b, a);
buffer.vertex(matrix, (float) v2.x, (float) v2.y, (float) v2.z).color(r, g, b, a);
buffer.vertex(matrix, (float) v3.x, (float) v3.y, (float) v3.z).color(r, g, b, a);
} else {
buffer.vertex(matrix, (float) v1.x, (float) v1.y, (float) v1.z).color(r, g, b, a);
buffer.vertex(matrix, (float) v2.x, (float) v2.y, (float) v2.z).color(r, g, b, a);
buffer.vertex(matrix, (float) v2.x, (float) v2.y, (float) v2.z).color(r, g, b, a);
buffer.vertex(matrix, (float) v3.x, (float) v3.y, (float) v3.z).color(r, g, b, a);
buffer.vertex(matrix, (float) v3.x, (float) v3.y, (float) v3.z).color(r, g, b, a);
buffer.vertex(matrix, (float) v1.x, (float) v1.y, (float) v1.z).color(r, g, b, a);
}
}
private void drawQuad(Matrix4f matrix, BufferBuilder buffer, Vec3d v1, Vec3d v2, Vec3d v3, Vec3d v4, int color, boolean filled) {
if (filled) {
drawTriangle(matrix, buffer, v1, v2, v3, color, true);
drawTriangle(matrix, buffer, v1, v3, v4, color, true);
} else {
int r = (color >> 16) & 0xFF;
int g = (color >> 8) & 0xFF;
int b = color & 0xFF;
int a = (color >> 24) & 0xFF;
buffer.vertex(matrix, (float) v1.x, (float) v1.y, (float) v1.z).color(r, g, b, a);
buffer.vertex(matrix, (float) v2.x, (float) v2.y, (float) v2.z).color(r, g, b, a);
buffer.vertex(matrix, (float) v2.x, (float) v2.y, (float) v2.z).color(r, g, b, a);
buffer.vertex(matrix, (float) v3.x, (float) v3.y, (float) v3.z).color(r, g, b, a);
buffer.vertex(matrix, (float) v3.x, (float) v3.y, (float) v3.z).color(r, g, b, a);
buffer.vertex(matrix, (float) v4.x, (float) v4.y, (float) v4.z).color(r, g, b, a);
buffer.vertex(matrix, (float) v4.x, (float) v4.y, (float) v4.z).color(r, g, b, a);
buffer.vertex(matrix, (float) v1.x, (float) v1.y, (float) v1.z).color(r, g, b, a);
}
}
}
}
кто захочет доведет до ума
