Подписывайтесь на наш Telegram и не пропускайте важные новости! Перейти

Визуальная часть TargetESP Cube | ZENITH RECODE 1.21.4

Начинающий
Начинающий
Статус
Онлайн
Регистрация
4 Апр 2024
Сообщения
50
Реакции
0
Выберите загрузчик игры
  1. Fabric
Привет всем! Сделал вот такие таргет исп в виде кубиков, вдохновляясь кристалами из Rockstar client =).

Сделал ползунки регулирующие скорость, размеры и т.д , а так же сделал чекбокс на краснение при ударе.

SS:
1769878634938.png
1769878776770.png

DW:
Код:
Expand Collapse Copy
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.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.Vec3d;
import org.joml.Matrix4f;
import org.joml.Quaternionf;

import zenith.zov.Zenith;
import zenith.zov.base.animations.base.Animation;
import zenith.zov.base.animations.base.Easing;
import zenith.zov.base.events.impl.render.EventRender3D;
import zenith.zov.base.theme.Theme;
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.NumberSetting;
import zenith.zov.client.modules.impl.combat.Aura;
import zenith.zov.utility.render.display.base.color.ColorRGBA;
import zenith.zov.utility.interfaces.IMinecraft;

@ModuleAnnotation(name = "TargetESP", category = Category.RENDER, description = "Рендер целей с кубами")
public class TargetESP extends Module implements IMinecraft {
    public static final TargetESP INSTANCE = new TargetESP();

    private final NumberSetting cubeSize = new NumberSetting("Размер кубов", 0.12F, 0.05F, 0.5F, 0.01F);
    private final NumberSetting cubeCount = new NumberSetting("Кол-во кубов", 20.0F, 8.0F, 30.0F, 1.0F);
    private final NumberSetting rotationSpeed = new NumberSetting("Скорость вращения оси", 4.0F, 0.5F, 15.0F, 0.5F);
    private final NumberSetting orbitSpeed = new NumberSetting("Скорость орбиты", 1.0F, 0.2F, 3.0F, 0.1F);
    private final BooleanSetting redOnHit = new BooleanSetting("Краснеть при ударе", true);
  
    private final Animation cubesAnimation = new Animation(300, 0.0F, Easing.SINE_OUT);
    private LivingEntity lastTarget = null;
    private float rotationY = 0.0F;
    private float rotationX = 0.0F;

    @EventTarget
    public void onRender3D(EventRender3D event) {
        LivingEntity target = Aura.INSTANCE.getTarget();

        if (target != null) {
            this.lastTarget = target;
            this.cubesAnimation.update(true);
        } else {
            this.cubesAnimation.update(false);
            if (this.cubesAnimation.getValue() == 0.0F) {
                this.lastTarget = null;
                return;
            }
        }

        // Update rotation angles
        this.rotationY += this.rotationSpeed.getCurrent();
        this.rotationX += this.rotationSpeed.getCurrent() * 0.375F;

        if (this.lastTarget != null) {
            renderCubes(event, this.lastTarget);
        }
    }

    private void renderCubes(EventRender3D event, LivingEntity target) {
        float alpha = this.cubesAnimation.getValue();
        if (alpha <= 0.0F) return;

        MatrixStack matrices = event.getMatrix();
        float partialTicks = event.getPartialTicks();

        Vec3d targetPos = target.getLerpedPos(partialTicks);
        Vec3d cameraPos = mc.gameRenderer.getCamera().getPos();
        Vec3d renderPos = targetPos.subtract(cameraPos);

        matrices.push();
        matrices.translate(renderPos.x, renderPos.y, renderPos.z);

        RenderSystem.enableBlend();
        RenderSystem.blendFuncSeparate(770, 1, 1, 0);
        RenderSystem.disableCull();
        RenderSystem.enableDepthTest();
        RenderSystem.depthMask(false);
        RenderSystem.setShader(ShaderProgramKeys.POSITION_COLOR);

        int count = (int) this.cubeCount.getCurrent();
        float size = this.cubeSize.getCurrent();
        float time = (mc.player.age + partialTicks) * 0.15f;
        float entityHeight = target.getHeight();
        float entityWidth = target.getWidth();
        float halfWidth = entityWidth * 0.5f;

        int colorInt = this.getCurrentColor().getRGB();

        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder buffer = tessellator.begin(VertexFormat.DrawMode.TRIANGLES, VertexFormats.POSITION_COLOR);

        for (int i = 0; i < count; i++) {
            float seed1 = (float) Math.sin(i * 1.7f + 0.3f) * 0.5f + 0.5f;
            float seed2 = (float) Math.cos(i * 2.3f + 0.7f) * 0.5f + 0.5f;
            float seed3 = (float) Math.sin(i * 3.1f + 1.1f) * 0.5f + 0.5f;

            float angleOffset = i * (360f / count) + seed1 * 12f;
            float angle = (time + mc.player.age) * this.orbitSpeed.getCurrent() + angleOffset;
            float orbitRadius = halfWidth + 0.25f + seed3 * 0.15f;

            float x = orbitRadius * (float) Math.cos(Math.toRadians(angle));
            float z = orbitRadius * (float) Math.sin(Math.toRadians(angle));
            float bobbing = (float) Math.sin(time * 0.05f + i * 0.3f) * 0.1f;
            float y = seed2 * entityHeight * 1.05f + bobbing;

            addCubeVertices(buffer, matrices, x, y, z, size, colorInt, alpha * 0.5F, this.rotationY, this.rotationX);
        }

        BufferRenderer.drawWithGlobalProgram(buffer.end());

        RenderSystem.defaultBlendFunc();
        RenderSystem.depthMask(true);
        RenderSystem.enableCull();
        matrices.pop();
    }

    private void drawCube(MatrixStack matrices, float x, float y, float z, float size, float yaw, int color, float alpha) {
        matrices.push();
        matrices.translate(x, y, z);

        Matrix4f matrix = matrices.peek().getPositionMatrix();

        int r = (color >> 16) & 0xFF;
        int g = (color >> 8) & 0xFF;
        int b = color & 0xFF;
        int a = (int) (((color >> 24) & 0xFF) * alpha);

        float s = size / 2f;

        // Лицевые треугольники куба с затенением
        // Передняя грань (яркая)
        addQuad(matrices, matrix, -s, -s, s, s, -s, s, s, s, s, -s, s, s, r, g, b, a);
        // Задняя грань (темнее)
        addQuad(matrices, matrix, -s, -s, -s, -s, s, -s, s, s, -s, s, -s, -s, (int)(r*0.9), (int)(g*0.9), (int)(b*0.9), a);
        // Левая грань
        addQuad(matrices, matrix, -s, -s, -s, -s, -s, s, -s, s, s, -s, s, -s, (int)(r*0.8), (int)(g*0.8), (int)(b*0.8), a);
        // Правая грань
        addQuad(matrices, matrix, s, -s, -s, s, s, -s, s, s, s, s, -s, s, (int)(r*0.8), (int)(g*0.8), (int)(b*0.8), a);
        // Верхняя грань (светлее)
        addQuad(matrices, matrix, -s, s, -s, -s, s, s, s, s, s, s, s, -s, (int)Math.min(255, r*1.1), (int)Math.min(255, g*1.1), (int)Math.min(255, b*1.1), a);
        // Нижняя грань (темнее)
        addQuad(matrices, matrix, -s, -s, -s, s, -s, -s, s, -s, s, -s, -s, s, (int)(r*0.7), (int)(g*0.7), (int)(b*0.7), a);

        matrices.pop();
    }

    private void addCubeVertices(BufferBuilder buffer, MatrixStack matrices, float x, float y, float z, float size, int color, float alpha, float rotY, float rotX) {
        matrices.push();
        matrices.translate(x, y, z);
        matrices.multiply(new Quaternionf().rotationY((float) Math.toRadians(rotY)));
        matrices.multiply(new Quaternionf().rotationX((float) Math.toRadians(rotX)));

        Matrix4f matrix = matrices.peek().getPositionMatrix();

        int r = (color >> 16) & 0xFF;
        int g = (color >> 8) & 0xFF;
        int b = color & 0xFF;
        int a = (int) (((color >> 24) & 0xFF) * alpha);

        float s = size / 2f;

        // Лицевые треугольники куба с затенением
        // Передняя грань (яркая)
        addQuad(buffer, matrix, -s, -s, s, s, -s, s, s, s, s, -s, s, s, r, g, b, a);
        // Задняя грань (темнее)
        addQuad(buffer, matrix, -s, -s, -s, -s, s, -s, s, s, -s, s, -s, -s, (int)(r*0.9), (int)(g*0.9), (int)(b*0.9), a);
        // Левая грань
        addQuad(buffer, matrix, -s, -s, -s, -s, -s, s, -s, s, s, -s, s, -s, (int)(r*0.8), (int)(g*0.8), (int)(b*0.8), a);
        // Правая грань
        addQuad(buffer, matrix, s, -s, -s, s, s, -s, s, s, s, s, -s, s, (int)(r*0.8), (int)(g*0.8), (int)(b*0.8), a);
        // Верхняя грань (светлее)
        addQuad(buffer, matrix, -s, s, -s, -s, s, s, s, s, s, s, s, -s, (int)Math.min(255, r*1.1), (int)Math.min(255, g*1.1), (int)Math.min(255, b*1.1), a);
        // Нижняя грань (темнее)
        addQuad(buffer, matrix, -s, -s, -s, s, -s, -s, s, -s, s, -s, -s, s, (int)(r*0.7), (int)(g*0.7), (int)(b*0.7), a);

        matrices.pop();
    }

    private void addQuad(BufferBuilder buffer, Matrix4f matrix, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, int r, int g, int b, int a) {
        buffer.vertex(matrix, x1, y1, z1).color(r, g, b, a);
        buffer.vertex(matrix, x2, y2, z2).color(r, g, b, a);
        buffer.vertex(matrix, x3, y3, z3).color(r, g, b, a);

        buffer.vertex(matrix, x1, y1, z1).color(r, g, b, a);
        buffer.vertex(matrix, x3, y3, z3).color(r, g, b, a);
        buffer.vertex(matrix, x4, y4, z4).color(r, g, b, a);
    }

    private void addQuad(MatrixStack matrices, Matrix4f matrix, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, int r, int g, int b, int a) {
        // Вспомогательный метод для совместимости
    }

    public static double interpolate(double current, double old, double scale) {
        return old + (current - old) * scale;
    }

    private ColorRGBA getCurrentColor() {
        Theme theme = Zenith.getInstance().getThemeManager().getCurrentTheme();
        ColorRGBA themeColor = theme.getColor();

        if (!this.redOnHit.isEnabled() || this.lastTarget == null || !(this.lastTarget instanceof LivingEntity)) {
            return themeColor;
        }

        LivingEntity entity = (LivingEntity) this.lastTarget;
        if (entity.hurtTime > 0) {
            ColorRGBA redColor = new ColorRGBA(255, 50, 50, 255);
            float hitProgress = (float) entity.hurtTime / 10.0F;
          
            int r = (int)(redColor.getRed() * hitProgress + themeColor.getRed() * (1 - hitProgress));
            int g = (int)(redColor.getGreen() * hitProgress + themeColor.getGreen() * (1 - hitProgress));
            int b = (int)(redColor.getBlue() * hitProgress + themeColor.getBlue() * (1 - hitProgress));

            return new ColorRGBA(r, g, b, 255);
        }

        return themeColor;
    }
}
p.S: СДЕЛАЛ ЭТО ВСЕ ЧИСТА НА + ВАЙБЕ ЗА МИНУТ 30. комментраии писал мой бизкий друг под именем haiku chan <3 который помогал делать эти таргет есп <3
 
Привет всем! Сделал вот такие таргет исп в виде кубиков, вдохновляясь кристалами из Rockstar client =).

Сделал ползунки регулирующие скорость, размеры и т.д , а так же сделал чекбокс на краснение при ударе.

SS:Посмотреть вложение 326255Посмотреть вложение 326256
DW:
Код:
Expand Collapse Copy
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.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.Vec3d;
import org.joml.Matrix4f;
import org.joml.Quaternionf;

import zenith.zov.Zenith;
import zenith.zov.base.animations.base.Animation;
import zenith.zov.base.animations.base.Easing;
import zenith.zov.base.events.impl.render.EventRender3D;
import zenith.zov.base.theme.Theme;
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.NumberSetting;
import zenith.zov.client.modules.impl.combat.Aura;
import zenith.zov.utility.render.display.base.color.ColorRGBA;
import zenith.zov.utility.interfaces.IMinecraft;

@ModuleAnnotation(name = "TargetESP", category = Category.RENDER, description = "Рендер целей с кубами")
public class TargetESP extends Module implements IMinecraft {
    public static final TargetESP INSTANCE = new TargetESP();

    private final NumberSetting cubeSize = new NumberSetting("Размер кубов", 0.12F, 0.05F, 0.5F, 0.01F);
    private final NumberSetting cubeCount = new NumberSetting("Кол-во кубов", 20.0F, 8.0F, 30.0F, 1.0F);
    private final NumberSetting rotationSpeed = new NumberSetting("Скорость вращения оси", 4.0F, 0.5F, 15.0F, 0.5F);
    private final NumberSetting orbitSpeed = new NumberSetting("Скорость орбиты", 1.0F, 0.2F, 3.0F, 0.1F);
    private final BooleanSetting redOnHit = new BooleanSetting("Краснеть при ударе", true);
 
    private final Animation cubesAnimation = new Animation(300, 0.0F, Easing.SINE_OUT);
    private LivingEntity lastTarget = null;
    private float rotationY = 0.0F;
    private float rotationX = 0.0F;

    @EventTarget
    public void onRender3D(EventRender3D event) {
        LivingEntity target = Aura.INSTANCE.getTarget();

        if (target != null) {
            this.lastTarget = target;
            this.cubesAnimation.update(true);
        } else {
            this.cubesAnimation.update(false);
            if (this.cubesAnimation.getValue() == 0.0F) {
                this.lastTarget = null;
                return;
            }
        }

        // Update rotation angles
        this.rotationY += this.rotationSpeed.getCurrent();
        this.rotationX += this.rotationSpeed.getCurrent() * 0.375F;

        if (this.lastTarget != null) {
            renderCubes(event, this.lastTarget);
        }
    }

    private void renderCubes(EventRender3D event, LivingEntity target) {
        float alpha = this.cubesAnimation.getValue();
        if (alpha <= 0.0F) return;

        MatrixStack matrices = event.getMatrix();
        float partialTicks = event.getPartialTicks();

        Vec3d targetPos = target.getLerpedPos(partialTicks);
        Vec3d cameraPos = mc.gameRenderer.getCamera().getPos();
        Vec3d renderPos = targetPos.subtract(cameraPos);

        matrices.push();
        matrices.translate(renderPos.x, renderPos.y, renderPos.z);

        RenderSystem.enableBlend();
        RenderSystem.blendFuncSeparate(770, 1, 1, 0);
        RenderSystem.disableCull();
        RenderSystem.enableDepthTest();
        RenderSystem.depthMask(false);
        RenderSystem.setShader(ShaderProgramKeys.POSITION_COLOR);

        int count = (int) this.cubeCount.getCurrent();
        float size = this.cubeSize.getCurrent();
        float time = (mc.player.age + partialTicks) * 0.15f;
        float entityHeight = target.getHeight();
        float entityWidth = target.getWidth();
        float halfWidth = entityWidth * 0.5f;

        int colorInt = this.getCurrentColor().getRGB();

        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder buffer = tessellator.begin(VertexFormat.DrawMode.TRIANGLES, VertexFormats.POSITION_COLOR);

        for (int i = 0; i < count; i++) {
            float seed1 = (float) Math.sin(i * 1.7f + 0.3f) * 0.5f + 0.5f;
            float seed2 = (float) Math.cos(i * 2.3f + 0.7f) * 0.5f + 0.5f;
            float seed3 = (float) Math.sin(i * 3.1f + 1.1f) * 0.5f + 0.5f;

            float angleOffset = i * (360f / count) + seed1 * 12f;
            float angle = (time + mc.player.age) * this.orbitSpeed.getCurrent() + angleOffset;
            float orbitRadius = halfWidth + 0.25f + seed3 * 0.15f;

            float x = orbitRadius * (float) Math.cos(Math.toRadians(angle));
            float z = orbitRadius * (float) Math.sin(Math.toRadians(angle));
            float bobbing = (float) Math.sin(time * 0.05f + i * 0.3f) * 0.1f;
            float y = seed2 * entityHeight * 1.05f + bobbing;

            addCubeVertices(buffer, matrices, x, y, z, size, colorInt, alpha * 0.5F, this.rotationY, this.rotationX);
        }

        BufferRenderer.drawWithGlobalProgram(buffer.end());

        RenderSystem.defaultBlendFunc();
        RenderSystem.depthMask(true);
        RenderSystem.enableCull();
        matrices.pop();
    }

    private void drawCube(MatrixStack matrices, float x, float y, float z, float size, float yaw, int color, float alpha) {
        matrices.push();
        matrices.translate(x, y, z);

        Matrix4f matrix = matrices.peek().getPositionMatrix();

        int r = (color >> 16) & 0xFF;
        int g = (color >> 8) & 0xFF;
        int b = color & 0xFF;
        int a = (int) (((color >> 24) & 0xFF) * alpha);

        float s = size / 2f;

        // Лицевые треугольники куба с затенением
        // Передняя грань (яркая)
        addQuad(matrices, matrix, -s, -s, s, s, -s, s, s, s, s, -s, s, s, r, g, b, a);
        // Задняя грань (темнее)
        addQuad(matrices, matrix, -s, -s, -s, -s, s, -s, s, s, -s, s, -s, -s, (int)(r*0.9), (int)(g*0.9), (int)(b*0.9), a);
        // Левая грань
        addQuad(matrices, matrix, -s, -s, -s, -s, -s, s, -s, s, s, -s, s, -s, (int)(r*0.8), (int)(g*0.8), (int)(b*0.8), a);
        // Правая грань
        addQuad(matrices, matrix, s, -s, -s, s, s, -s, s, s, s, s, -s, s, (int)(r*0.8), (int)(g*0.8), (int)(b*0.8), a);
        // Верхняя грань (светлее)
        addQuad(matrices, matrix, -s, s, -s, -s, s, s, s, s, s, s, s, -s, (int)Math.min(255, r*1.1), (int)Math.min(255, g*1.1), (int)Math.min(255, b*1.1), a);
        // Нижняя грань (темнее)
        addQuad(matrices, matrix, -s, -s, -s, s, -s, -s, s, -s, s, -s, -s, s, (int)(r*0.7), (int)(g*0.7), (int)(b*0.7), a);

        matrices.pop();
    }

    private void addCubeVertices(BufferBuilder buffer, MatrixStack matrices, float x, float y, float z, float size, int color, float alpha, float rotY, float rotX) {
        matrices.push();
        matrices.translate(x, y, z);
        matrices.multiply(new Quaternionf().rotationY((float) Math.toRadians(rotY)));
        matrices.multiply(new Quaternionf().rotationX((float) Math.toRadians(rotX)));

        Matrix4f matrix = matrices.peek().getPositionMatrix();

        int r = (color >> 16) & 0xFF;
        int g = (color >> 8) & 0xFF;
        int b = color & 0xFF;
        int a = (int) (((color >> 24) & 0xFF) * alpha);

        float s = size / 2f;

        // Лицевые треугольники куба с затенением
        // Передняя грань (яркая)
        addQuad(buffer, matrix, -s, -s, s, s, -s, s, s, s, s, -s, s, s, r, g, b, a);
        // Задняя грань (темнее)
        addQuad(buffer, matrix, -s, -s, -s, -s, s, -s, s, s, -s, s, -s, -s, (int)(r*0.9), (int)(g*0.9), (int)(b*0.9), a);
        // Левая грань
        addQuad(buffer, matrix, -s, -s, -s, -s, -s, s, -s, s, s, -s, s, -s, (int)(r*0.8), (int)(g*0.8), (int)(b*0.8), a);
        // Правая грань
        addQuad(buffer, matrix, s, -s, -s, s, s, -s, s, s, s, s, -s, s, (int)(r*0.8), (int)(g*0.8), (int)(b*0.8), a);
        // Верхняя грань (светлее)
        addQuad(buffer, matrix, -s, s, -s, -s, s, s, s, s, s, s, s, -s, (int)Math.min(255, r*1.1), (int)Math.min(255, g*1.1), (int)Math.min(255, b*1.1), a);
        // Нижняя грань (темнее)
        addQuad(buffer, matrix, -s, -s, -s, s, -s, -s, s, -s, s, -s, -s, s, (int)(r*0.7), (int)(g*0.7), (int)(b*0.7), a);

        matrices.pop();
    }

    private void addQuad(BufferBuilder buffer, Matrix4f matrix, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, int r, int g, int b, int a) {
        buffer.vertex(matrix, x1, y1, z1).color(r, g, b, a);
        buffer.vertex(matrix, x2, y2, z2).color(r, g, b, a);
        buffer.vertex(matrix, x3, y3, z3).color(r, g, b, a);

        buffer.vertex(matrix, x1, y1, z1).color(r, g, b, a);
        buffer.vertex(matrix, x3, y3, z3).color(r, g, b, a);
        buffer.vertex(matrix, x4, y4, z4).color(r, g, b, a);
    }

    private void addQuad(MatrixStack matrices, Matrix4f matrix, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, int r, int g, int b, int a) {
        // Вспомогательный метод для совместимости
    }

    public static double interpolate(double current, double old, double scale) {
        return old + (current - old) * scale;
    }

    private ColorRGBA getCurrentColor() {
        Theme theme = Zenith.getInstance().getThemeManager().getCurrentTheme();
        ColorRGBA themeColor = theme.getColor();

        if (!this.redOnHit.isEnabled() || this.lastTarget == null || !(this.lastTarget instanceof LivingEntity)) {
            return themeColor;
        }

        LivingEntity entity = (LivingEntity) this.lastTarget;
        if (entity.hurtTime > 0) {
            ColorRGBA redColor = new ColorRGBA(255, 50, 50, 255);
            float hitProgress = (float) entity.hurtTime / 10.0F;
         
            int r = (int)(redColor.getRed() * hitProgress + themeColor.getRed() * (1 - hitProgress));
            int g = (int)(redColor.getGreen() * hitProgress + themeColor.getGreen() * (1 - hitProgress));
            int b = (int)(redColor.getBlue() * hitProgress + themeColor.getBlue() * (1 - hitProgress));

            return new ColorRGBA(r, g, b, 255);
        }

        return themeColor;
    }
}
p.S: СДЕЛАЛ ЭТО ВСЕ ЧИСТА НА + ВАЙБЕ ЗА МИНУТ 30. комментраии писал мой бизкий друг под именем haiku chan <3 который помогал делать эти таргет есп <3
не ну прикольно +rep
 
Привет всем! Сделал вот такие таргет исп в виде кубиков, вдохновляясь кристалами из Rockstar client =).

Сделал ползунки регулирующие скорость, размеры и т.д , а так же сделал чекбокс на краснение при ударе.

SS:Посмотреть вложение 326255Посмотреть вложение 326256
DW:
Код:
Expand Collapse Copy
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.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.Vec3d;
import org.joml.Matrix4f;
import org.joml.Quaternionf;

import zenith.zov.Zenith;
import zenith.zov.base.animations.base.Animation;
import zenith.zov.base.animations.base.Easing;
import zenith.zov.base.events.impl.render.EventRender3D;
import zenith.zov.base.theme.Theme;
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.NumberSetting;
import zenith.zov.client.modules.impl.combat.Aura;
import zenith.zov.utility.render.display.base.color.ColorRGBA;
import zenith.zov.utility.interfaces.IMinecraft;

@ModuleAnnotation(name = "TargetESP", category = Category.RENDER, description = "Рендер целей с кубами")
public class TargetESP extends Module implements IMinecraft {
    public static final TargetESP INSTANCE = new TargetESP();

    private final NumberSetting cubeSize = new NumberSetting("Размер кубов", 0.12F, 0.05F, 0.5F, 0.01F);
    private final NumberSetting cubeCount = new NumberSetting("Кол-во кубов", 20.0F, 8.0F, 30.0F, 1.0F);
    private final NumberSetting rotationSpeed = new NumberSetting("Скорость вращения оси", 4.0F, 0.5F, 15.0F, 0.5F);
    private final NumberSetting orbitSpeed = new NumberSetting("Скорость орбиты", 1.0F, 0.2F, 3.0F, 0.1F);
    private final BooleanSetting redOnHit = new BooleanSetting("Краснеть при ударе", true);
 
    private final Animation cubesAnimation = new Animation(300, 0.0F, Easing.SINE_OUT);
    private LivingEntity lastTarget = null;
    private float rotationY = 0.0F;
    private float rotationX = 0.0F;

    @EventTarget
    public void onRender3D(EventRender3D event) {
        LivingEntity target = Aura.INSTANCE.getTarget();

        if (target != null) {
            this.lastTarget = target;
            this.cubesAnimation.update(true);
        } else {
            this.cubesAnimation.update(false);
            if (this.cubesAnimation.getValue() == 0.0F) {
                this.lastTarget = null;
                return;
            }
        }

        // Update rotation angles
        this.rotationY += this.rotationSpeed.getCurrent();
        this.rotationX += this.rotationSpeed.getCurrent() * 0.375F;

        if (this.lastTarget != null) {
            renderCubes(event, this.lastTarget);
        }
    }

    private void renderCubes(EventRender3D event, LivingEntity target) {
        float alpha = this.cubesAnimation.getValue();
        if (alpha <= 0.0F) return;

        MatrixStack matrices = event.getMatrix();
        float partialTicks = event.getPartialTicks();

        Vec3d targetPos = target.getLerpedPos(partialTicks);
        Vec3d cameraPos = mc.gameRenderer.getCamera().getPos();
        Vec3d renderPos = targetPos.subtract(cameraPos);

        matrices.push();
        matrices.translate(renderPos.x, renderPos.y, renderPos.z);

        RenderSystem.enableBlend();
        RenderSystem.blendFuncSeparate(770, 1, 1, 0);
        RenderSystem.disableCull();
        RenderSystem.enableDepthTest();
        RenderSystem.depthMask(false);
        RenderSystem.setShader(ShaderProgramKeys.POSITION_COLOR);

        int count = (int) this.cubeCount.getCurrent();
        float size = this.cubeSize.getCurrent();
        float time = (mc.player.age + partialTicks) * 0.15f;
        float entityHeight = target.getHeight();
        float entityWidth = target.getWidth();
        float halfWidth = entityWidth * 0.5f;

        int colorInt = this.getCurrentColor().getRGB();

        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder buffer = tessellator.begin(VertexFormat.DrawMode.TRIANGLES, VertexFormats.POSITION_COLOR);

        for (int i = 0; i < count; i++) {
            float seed1 = (float) Math.sin(i * 1.7f + 0.3f) * 0.5f + 0.5f;
            float seed2 = (float) Math.cos(i * 2.3f + 0.7f) * 0.5f + 0.5f;
            float seed3 = (float) Math.sin(i * 3.1f + 1.1f) * 0.5f + 0.5f;

            float angleOffset = i * (360f / count) + seed1 * 12f;
            float angle = (time + mc.player.age) * this.orbitSpeed.getCurrent() + angleOffset;
            float orbitRadius = halfWidth + 0.25f + seed3 * 0.15f;

            float x = orbitRadius * (float) Math.cos(Math.toRadians(angle));
            float z = orbitRadius * (float) Math.sin(Math.toRadians(angle));
            float bobbing = (float) Math.sin(time * 0.05f + i * 0.3f) * 0.1f;
            float y = seed2 * entityHeight * 1.05f + bobbing;

            addCubeVertices(buffer, matrices, x, y, z, size, colorInt, alpha * 0.5F, this.rotationY, this.rotationX);
        }

        BufferRenderer.drawWithGlobalProgram(buffer.end());

        RenderSystem.defaultBlendFunc();
        RenderSystem.depthMask(true);
        RenderSystem.enableCull();
        matrices.pop();
    }

    private void drawCube(MatrixStack matrices, float x, float y, float z, float size, float yaw, int color, float alpha) {
        matrices.push();
        matrices.translate(x, y, z);

        Matrix4f matrix = matrices.peek().getPositionMatrix();

        int r = (color >> 16) & 0xFF;
        int g = (color >> 8) & 0xFF;
        int b = color & 0xFF;
        int a = (int) (((color >> 24) & 0xFF) * alpha);

        float s = size / 2f;

        // Лицевые треугольники куба с затенением
        // Передняя грань (яркая)
        addQuad(matrices, matrix, -s, -s, s, s, -s, s, s, s, s, -s, s, s, r, g, b, a);
        // Задняя грань (темнее)
        addQuad(matrices, matrix, -s, -s, -s, -s, s, -s, s, s, -s, s, -s, -s, (int)(r*0.9), (int)(g*0.9), (int)(b*0.9), a);
        // Левая грань
        addQuad(matrices, matrix, -s, -s, -s, -s, -s, s, -s, s, s, -s, s, -s, (int)(r*0.8), (int)(g*0.8), (int)(b*0.8), a);
        // Правая грань
        addQuad(matrices, matrix, s, -s, -s, s, s, -s, s, s, s, s, -s, s, (int)(r*0.8), (int)(g*0.8), (int)(b*0.8), a);
        // Верхняя грань (светлее)
        addQuad(matrices, matrix, -s, s, -s, -s, s, s, s, s, s, s, s, -s, (int)Math.min(255, r*1.1), (int)Math.min(255, g*1.1), (int)Math.min(255, b*1.1), a);
        // Нижняя грань (темнее)
        addQuad(matrices, matrix, -s, -s, -s, s, -s, -s, s, -s, s, -s, -s, s, (int)(r*0.7), (int)(g*0.7), (int)(b*0.7), a);

        matrices.pop();
    }

    private void addCubeVertices(BufferBuilder buffer, MatrixStack matrices, float x, float y, float z, float size, int color, float alpha, float rotY, float rotX) {
        matrices.push();
        matrices.translate(x, y, z);
        matrices.multiply(new Quaternionf().rotationY((float) Math.toRadians(rotY)));
        matrices.multiply(new Quaternionf().rotationX((float) Math.toRadians(rotX)));

        Matrix4f matrix = matrices.peek().getPositionMatrix();

        int r = (color >> 16) & 0xFF;
        int g = (color >> 8) & 0xFF;
        int b = color & 0xFF;
        int a = (int) (((color >> 24) & 0xFF) * alpha);

        float s = size / 2f;

        // Лицевые треугольники куба с затенением
        // Передняя грань (яркая)
        addQuad(buffer, matrix, -s, -s, s, s, -s, s, s, s, s, -s, s, s, r, g, b, a);
        // Задняя грань (темнее)
        addQuad(buffer, matrix, -s, -s, -s, -s, s, -s, s, s, -s, s, -s, -s, (int)(r*0.9), (int)(g*0.9), (int)(b*0.9), a);
        // Левая грань
        addQuad(buffer, matrix, -s, -s, -s, -s, -s, s, -s, s, s, -s, s, -s, (int)(r*0.8), (int)(g*0.8), (int)(b*0.8), a);
        // Правая грань
        addQuad(buffer, matrix, s, -s, -s, s, s, -s, s, s, s, s, -s, s, (int)(r*0.8), (int)(g*0.8), (int)(b*0.8), a);
        // Верхняя грань (светлее)
        addQuad(buffer, matrix, -s, s, -s, -s, s, s, s, s, s, s, s, -s, (int)Math.min(255, r*1.1), (int)Math.min(255, g*1.1), (int)Math.min(255, b*1.1), a);
        // Нижняя грань (темнее)
        addQuad(buffer, matrix, -s, -s, -s, s, -s, -s, s, -s, s, -s, -s, s, (int)(r*0.7), (int)(g*0.7), (int)(b*0.7), a);

        matrices.pop();
    }

    private void addQuad(BufferBuilder buffer, Matrix4f matrix, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, int r, int g, int b, int a) {
        buffer.vertex(matrix, x1, y1, z1).color(r, g, b, a);
        buffer.vertex(matrix, x2, y2, z2).color(r, g, b, a);
        buffer.vertex(matrix, x3, y3, z3).color(r, g, b, a);

        buffer.vertex(matrix, x1, y1, z1).color(r, g, b, a);
        buffer.vertex(matrix, x3, y3, z3).color(r, g, b, a);
        buffer.vertex(matrix, x4, y4, z4).color(r, g, b, a);
    }

    private void addQuad(MatrixStack matrices, Matrix4f matrix, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, int r, int g, int b, int a) {
        // Вспомогательный метод для совместимости
    }

    public static double interpolate(double current, double old, double scale) {
        return old + (current - old) * scale;
    }

    private ColorRGBA getCurrentColor() {
        Theme theme = Zenith.getInstance().getThemeManager().getCurrentTheme();
        ColorRGBA themeColor = theme.getColor();

        if (!this.redOnHit.isEnabled() || this.lastTarget == null || !(this.lastTarget instanceof LivingEntity)) {
            return themeColor;
        }

        LivingEntity entity = (LivingEntity) this.lastTarget;
        if (entity.hurtTime > 0) {
            ColorRGBA redColor = new ColorRGBA(255, 50, 50, 255);
            float hitProgress = (float) entity.hurtTime / 10.0F;
         
            int r = (int)(redColor.getRed() * hitProgress + themeColor.getRed() * (1 - hitProgress));
            int g = (int)(redColor.getGreen() * hitProgress + themeColor.getGreen() * (1 - hitProgress));
            int b = (int)(redColor.getBlue() * hitProgress + themeColor.getBlue() * (1 - hitProgress));

            return new ColorRGBA(r, g, b, 255);
        }

        return themeColor;
    }
}
p.S: СДЕЛАЛ ЭТО ВСЕ ЧИСТА НА + ВАЙБЕ ЗА МИНУТ 30. комментраии писал мой бизкий друг под именем haiku chan <3 который помогал делать эти таргет есп <3
Ну выглядит как что то интересное, если доработать то четко будет. + rep
 
Привет всем! Сделал вот такие таргет исп в виде кубиков, вдохновляясь кристалами из Rockstar client =).

Сделал ползунки регулирующие скорость, размеры и т.д , а так же сделал чекбокс на краснение при ударе.

SS:Посмотреть вложение 326255Посмотреть вложение 326256
DW:
Код:
Expand Collapse Copy
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.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.Vec3d;
import org.joml.Matrix4f;
import org.joml.Quaternionf;

import zenith.zov.Zenith;
import zenith.zov.base.animations.base.Animation;
import zenith.zov.base.animations.base.Easing;
import zenith.zov.base.events.impl.render.EventRender3D;
import zenith.zov.base.theme.Theme;
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.NumberSetting;
import zenith.zov.client.modules.impl.combat.Aura;
import zenith.zov.utility.render.display.base.color.ColorRGBA;
import zenith.zov.utility.interfaces.IMinecraft;

@ModuleAnnotation(name = "TargetESP", category = Category.RENDER, description = "Рендер целей с кубами")
public class TargetESP extends Module implements IMinecraft {
    public static final TargetESP INSTANCE = new TargetESP();

    private final NumberSetting cubeSize = new NumberSetting("Размер кубов", 0.12F, 0.05F, 0.5F, 0.01F);
    private final NumberSetting cubeCount = new NumberSetting("Кол-во кубов", 20.0F, 8.0F, 30.0F, 1.0F);
    private final NumberSetting rotationSpeed = new NumberSetting("Скорость вращения оси", 4.0F, 0.5F, 15.0F, 0.5F);
    private final NumberSetting orbitSpeed = new NumberSetting("Скорость орбиты", 1.0F, 0.2F, 3.0F, 0.1F);
    private final BooleanSetting redOnHit = new BooleanSetting("Краснеть при ударе", true);
 
    private final Animation cubesAnimation = new Animation(300, 0.0F, Easing.SINE_OUT);
    private LivingEntity lastTarget = null;
    private float rotationY = 0.0F;
    private float rotationX = 0.0F;

    @EventTarget
    public void onRender3D(EventRender3D event) {
        LivingEntity target = Aura.INSTANCE.getTarget();

        if (target != null) {
            this.lastTarget = target;
            this.cubesAnimation.update(true);
        } else {
            this.cubesAnimation.update(false);
            if (this.cubesAnimation.getValue() == 0.0F) {
                this.lastTarget = null;
                return;
            }
        }

        // Update rotation angles
        this.rotationY += this.rotationSpeed.getCurrent();
        this.rotationX += this.rotationSpeed.getCurrent() * 0.375F;

        if (this.lastTarget != null) {
            renderCubes(event, this.lastTarget);
        }
    }

    private void renderCubes(EventRender3D event, LivingEntity target) {
        float alpha = this.cubesAnimation.getValue();
        if (alpha <= 0.0F) return;

        MatrixStack matrices = event.getMatrix();
        float partialTicks = event.getPartialTicks();

        Vec3d targetPos = target.getLerpedPos(partialTicks);
        Vec3d cameraPos = mc.gameRenderer.getCamera().getPos();
        Vec3d renderPos = targetPos.subtract(cameraPos);

        matrices.push();
        matrices.translate(renderPos.x, renderPos.y, renderPos.z);

        RenderSystem.enableBlend();
        RenderSystem.blendFuncSeparate(770, 1, 1, 0);
        RenderSystem.disableCull();
        RenderSystem.enableDepthTest();
        RenderSystem.depthMask(false);
        RenderSystem.setShader(ShaderProgramKeys.POSITION_COLOR);

        int count = (int) this.cubeCount.getCurrent();
        float size = this.cubeSize.getCurrent();
        float time = (mc.player.age + partialTicks) * 0.15f;
        float entityHeight = target.getHeight();
        float entityWidth = target.getWidth();
        float halfWidth = entityWidth * 0.5f;

        int colorInt = this.getCurrentColor().getRGB();

        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder buffer = tessellator.begin(VertexFormat.DrawMode.TRIANGLES, VertexFormats.POSITION_COLOR);

        for (int i = 0; i < count; i++) {
            float seed1 = (float) Math.sin(i * 1.7f + 0.3f) * 0.5f + 0.5f;
            float seed2 = (float) Math.cos(i * 2.3f + 0.7f) * 0.5f + 0.5f;
            float seed3 = (float) Math.sin(i * 3.1f + 1.1f) * 0.5f + 0.5f;

            float angleOffset = i * (360f / count) + seed1 * 12f;
            float angle = (time + mc.player.age) * this.orbitSpeed.getCurrent() + angleOffset;
            float orbitRadius = halfWidth + 0.25f + seed3 * 0.15f;

            float x = orbitRadius * (float) Math.cos(Math.toRadians(angle));
            float z = orbitRadius * (float) Math.sin(Math.toRadians(angle));
            float bobbing = (float) Math.sin(time * 0.05f + i * 0.3f) * 0.1f;
            float y = seed2 * entityHeight * 1.05f + bobbing;

            addCubeVertices(buffer, matrices, x, y, z, size, colorInt, alpha * 0.5F, this.rotationY, this.rotationX);
        }

        BufferRenderer.drawWithGlobalProgram(buffer.end());

        RenderSystem.defaultBlendFunc();
        RenderSystem.depthMask(true);
        RenderSystem.enableCull();
        matrices.pop();
    }

    private void drawCube(MatrixStack matrices, float x, float y, float z, float size, float yaw, int color, float alpha) {
        matrices.push();
        matrices.translate(x, y, z);

        Matrix4f matrix = matrices.peek().getPositionMatrix();

        int r = (color >> 16) & 0xFF;
        int g = (color >> 8) & 0xFF;
        int b = color & 0xFF;
        int a = (int) (((color >> 24) & 0xFF) * alpha);

        float s = size / 2f;

        // Лицевые треугольники куба с затенением
        // Передняя грань (яркая)
        addQuad(matrices, matrix, -s, -s, s, s, -s, s, s, s, s, -s, s, s, r, g, b, a);
        // Задняя грань (темнее)
        addQuad(matrices, matrix, -s, -s, -s, -s, s, -s, s, s, -s, s, -s, -s, (int)(r*0.9), (int)(g*0.9), (int)(b*0.9), a);
        // Левая грань
        addQuad(matrices, matrix, -s, -s, -s, -s, -s, s, -s, s, s, -s, s, -s, (int)(r*0.8), (int)(g*0.8), (int)(b*0.8), a);
        // Правая грань
        addQuad(matrices, matrix, s, -s, -s, s, s, -s, s, s, s, s, -s, s, (int)(r*0.8), (int)(g*0.8), (int)(b*0.8), a);
        // Верхняя грань (светлее)
        addQuad(matrices, matrix, -s, s, -s, -s, s, s, s, s, s, s, s, -s, (int)Math.min(255, r*1.1), (int)Math.min(255, g*1.1), (int)Math.min(255, b*1.1), a);
        // Нижняя грань (темнее)
        addQuad(matrices, matrix, -s, -s, -s, s, -s, -s, s, -s, s, -s, -s, s, (int)(r*0.7), (int)(g*0.7), (int)(b*0.7), a);

        matrices.pop();
    }

    private void addCubeVertices(BufferBuilder buffer, MatrixStack matrices, float x, float y, float z, float size, int color, float alpha, float rotY, float rotX) {
        matrices.push();
        matrices.translate(x, y, z);
        matrices.multiply(new Quaternionf().rotationY((float) Math.toRadians(rotY)));
        matrices.multiply(new Quaternionf().rotationX((float) Math.toRadians(rotX)));

        Matrix4f matrix = matrices.peek().getPositionMatrix();

        int r = (color >> 16) & 0xFF;
        int g = (color >> 8) & 0xFF;
        int b = color & 0xFF;
        int a = (int) (((color >> 24) & 0xFF) * alpha);

        float s = size / 2f;

        // Лицевые треугольники куба с затенением
        // Передняя грань (яркая)
        addQuad(buffer, matrix, -s, -s, s, s, -s, s, s, s, s, -s, s, s, r, g, b, a);
        // Задняя грань (темнее)
        addQuad(buffer, matrix, -s, -s, -s, -s, s, -s, s, s, -s, s, -s, -s, (int)(r*0.9), (int)(g*0.9), (int)(b*0.9), a);
        // Левая грань
        addQuad(buffer, matrix, -s, -s, -s, -s, -s, s, -s, s, s, -s, s, -s, (int)(r*0.8), (int)(g*0.8), (int)(b*0.8), a);
        // Правая грань
        addQuad(buffer, matrix, s, -s, -s, s, s, -s, s, s, s, s, -s, s, (int)(r*0.8), (int)(g*0.8), (int)(b*0.8), a);
        // Верхняя грань (светлее)
        addQuad(buffer, matrix, -s, s, -s, -s, s, s, s, s, s, s, s, -s, (int)Math.min(255, r*1.1), (int)Math.min(255, g*1.1), (int)Math.min(255, b*1.1), a);
        // Нижняя грань (темнее)
        addQuad(buffer, matrix, -s, -s, -s, s, -s, -s, s, -s, s, -s, -s, s, (int)(r*0.7), (int)(g*0.7), (int)(b*0.7), a);

        matrices.pop();
    }

    private void addQuad(BufferBuilder buffer, Matrix4f matrix, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, int r, int g, int b, int a) {
        buffer.vertex(matrix, x1, y1, z1).color(r, g, b, a);
        buffer.vertex(matrix, x2, y2, z2).color(r, g, b, a);
        buffer.vertex(matrix, x3, y3, z3).color(r, g, b, a);

        buffer.vertex(matrix, x1, y1, z1).color(r, g, b, a);
        buffer.vertex(matrix, x3, y3, z3).color(r, g, b, a);
        buffer.vertex(matrix, x4, y4, z4).color(r, g, b, a);
    }

    private void addQuad(MatrixStack matrices, Matrix4f matrix, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, int r, int g, int b, int a) {
        // Вспомогательный метод для совместимости
    }

    public static double interpolate(double current, double old, double scale) {
        return old + (current - old) * scale;
    }

    private ColorRGBA getCurrentColor() {
        Theme theme = Zenith.getInstance().getThemeManager().getCurrentTheme();
        ColorRGBA themeColor = theme.getColor();

        if (!this.redOnHit.isEnabled() || this.lastTarget == null || !(this.lastTarget instanceof LivingEntity)) {
            return themeColor;
        }

        LivingEntity entity = (LivingEntity) this.lastTarget;
        if (entity.hurtTime > 0) {
            ColorRGBA redColor = new ColorRGBA(255, 50, 50, 255);
            float hitProgress = (float) entity.hurtTime / 10.0F;
         
            int r = (int)(redColor.getRed() * hitProgress + themeColor.getRed() * (1 - hitProgress));
            int g = (int)(redColor.getGreen() * hitProgress + themeColor.getGreen() * (1 - hitProgress));
            int b = (int)(redColor.getBlue() * hitProgress + themeColor.getBlue() * (1 - hitProgress));

            return new ColorRGBA(r, g, b, 255);
        }

        return themeColor;
    }
}
p.S: СДЕЛАЛ ЭТО ВСЕ ЧИСТА НА + ВАЙБЕ ЗА МИНУТ 30. комментраии писал мой бизкий друг под именем haiku chan <3 который помогал делать эти таргет есп <3
как будто бы крута но кабута бы какой то кал норм кароч /up
 
Назад
Сверху Снизу