Визуальная часть Кристаллы | Excellent Omni

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
9 Май 2023
Сообщения
68
Реакции
1
Выберите загрузчик игры
  1. Vanilla
Бля, похуй, пусть будет.
Не всем же не понравилось
п:
Expand Collapse Copy
package org.san1na.excellent.client.impl.feature.impl.render;

import lombok.Getter;
import lombok.experimental.Accessors;
import net.blaze3d.matrix.MatrixStack;
import net.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.LivingEntity;
import net.minecraft.potion.Effects;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraft.util.math.vector.Vector4f;
import org.joml.Vector2f;
import org.lwjgl.opengl.GL11;
import org.san1na.common.animation.Animation;
import org.san1na.common.animation.AnimationUtil;
import org.san1na.common.animation.Easings;
import org.san1na.common.events.orbit.EventHandler;
import org.san1na.excellent.client.Client;
import org.san1na.excellent.client.events.player.UpdateEvent;
import org.san1na.excellent.client.events.render.Render2DEvent;
import org.san1na.excellent.client.events.render.Render3DLastEvent;
import org.san1na.excellent.client.impl.feature.Category;
import org.san1na.excellent.client.impl.feature.Feature;
import org.san1na.excellent.client.impl.feature.FeatureInfo;
import org.san1na.excellent.client.impl.feature.impl.combat.AttackAura;
import org.san1na.excellent.client.impl.settings.impl.BooleanSetting;
import org.san1na.excellent.client.impl.settings.impl.ModeSetting;
import org.san1na.excellent.client.impl.settings.impl.SliderSetting;
import org.san1na.excellent.client.util.color.ColorUtil;
import org.san1na.excellent.client.util.color.theme.Theme;
import org.san1na.excellent.client.util.combat.AuraUtil;
import org.san1na.excellent.client.util.math.Interpolator;
import org.san1na.excellent.client.util.math.MathUtils;
import org.san1na.excellent.client.util.math.Mathf;
import org.san1na.excellent.client.util.math.StopWatch;
import org.san1na.excellent.client.util.render.impl.GLUtils;
import org.san1na.excellent.client.util.render.impl.Project;
import org.san1na.excellent.client.util.render.impl.RectUtil;
import org.san1na.excellent.client.util.render.impl.RenderUtil;
import org.san1na.excellent.client.util.render.impl.RenderUtil3D;
import org.san1na.excellent.client.util.render.texture.ClientTexture;

import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;

@Getter
@Accessors(fluent = true)
@FeatureInfo(name = "TargetESP", description = "Подсвечивает главного врага на текущий момент если он есть", category = Category.RENDER)
public class TargetESP extends Feature {

    public final ModeSetting mode = new ModeSetting("Режим", "Кристаллы", "Кольцо/Jello", "Картинка", "Души");
    public final BooleanSetting aimEsp = new BooleanSetting("При наведении", false);

    private final Random RAND = new Random(123123222);
    private final Tessellator tessellator = Tessellator.getInstance();
    private final BufferBuilder bufferBuilder = tessellator.getBuffer();

    private final ResourceLocation glowTex = ClientTexture.GLOW.location();
    final Animation crystalAnimation = new Animation().easing(Easings.SINE_OUT).duration(Duration.ofMillis(600));

    private int getColor(int index, float aPC) {
        return ColorUtil.fade(3, index, ColorUtil.multBright(Theme.DEFAULT.accent(aPC), .15f), ColorUtil.multBright(Theme.DEFAULT.accent(aPC), .45f));
    }

    private List<LivingEntity> getTargeted() {
        final List<LivingEntity> targets = new ArrayList<>();
        if (Client.inst().featureManager().attackAura().target() != null)
            targets.add(Client.inst().featureManager().attackAura().target());
        if (aimEsp.get() && mc.pointedEntity instanceof LivingEntity living && living.isAlive() && living != Client.inst().featureManager().freeCam.entity())
            targets.add(living);
        return targets;
    }

    public LivingEntity target;
    public LivingEntity lastTarget;
    public final Animation markerAnimation = new Animation();
    private final Vector2f markerPosition = new Vector2f(0, 0);
    private final ResourceLocation markerLocation = ClientTexture.MARKER.location();
    private final ResourceLocation glow = ClientTexture.GLOW.location();
    final Animation hurtAnim = new Animation().easing(Easings.SINE_OUT).duration(Duration.ofMillis(100));
    final Animation sizeAnim = new Animation().easing(Easings.LINEAR).duration(Duration.ofMillis(50));

    private void updateTarget() {
        AttackAura aura = Client.inst().featureManager().attackAura();
        LivingEntity newTarget = null;
        if (aura.target() != null)
            newTarget = aura.target();
        if (aimEsp.get() && mc.pointedEntity instanceof LivingEntity living && living.isAlive() && living != Client.inst().featureManager().freeCam.entity())
            newTarget = living;
        this.target = newTarget;

        if (this.target != null) {
            this.lastTarget = this.target;
        }
    }

    @EventHandler
    public void onUpdate(UpdateEvent eventUpdate) {
        updateTarget();
    }

    @EventHandler
    public void onRenderWorldEvent(Render3DLastEvent event3d) {
    }

    @EventHandler
    public void onEvent(Render2DEvent event) {
        markerAnimation.update();
        crystalAnimation.update();

        long durationRingSoul = 400L;
        long durationImage = 150L;
        long durationCrystal = 600L;

        long duration = durationImage;
        if (mode.is("Кристаллы")) duration = durationCrystal;
        else duration = durationImage;

        markerAnimation.run(this.target == null ? 0 : 1, Duration.ofMillis(mode.is("Картинка") || mode.is("Кольцо/Jello") || mode.is("Души") ? (this.target == null ? duration : durationImage) : duration), Easings.LINEAR, false);


        crystalAnimation.run(this.target != null ? 1 : 0, Duration.ofMillis(durationCrystal), Easings.SINE_OUT, false);

        if (markerAnimation.get() == 0.0 && this.target == null) {
            this.lastTarget = null;
        }

        if (this.target != null || this.lastTarget != null) {
            if (this.mode.is("Кристаллы")) {
                float animProgress = crystalAnimation.get();
                if (animProgress > 0) {
                    RenderSystem.enableBlend();
                    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
                    renderCrystals(event.getMatrix(), event.getPartialTicks(), animProgress);
                    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                    RenderSystem.disableBlend();
                }
            }
        }
    }

    private void renderCrystals(MatrixStack matrix, float partialTicks, float animProgress) {
        LivingEntity entityToRender = this.target != null ? this.target : this.lastTarget;
        if (entityToRender == null) return;

        Vector3d interpolated = RenderUtil3D.interpolate(entityToRender, partialTicks);
        double cx = interpolated.x;
        double cy = interpolated.y + entityToRender.getHeight() * 0.55;
        double cz = interpolated.z;

        renderCrystalkrug(matrix, partialTicks, entityToRender, cx, cy, cz, 0.9, 1.8, 0, animProgress);
        renderCrystalkrug(matrix, partialTicks, entityToRender, cx, cy, cz, 1.1, 2.0, 0.6, animProgress);
    }

    private void renderCrystalkrug(MatrixStack matrix, float partialTicks, LivingEntity entityToRender, double cx, double cy, double cz, double orbitR, double speed, double yOffset, float animProgress) {
        boolean poisoned = entityToRender.isPotionActive(Effects.POISON);
        int redColor = ColorUtil.getColor(255, 0, 0);
        float hurtProgress = (float) Math.sin(entityToRender.hurtTime * (18F * Math.PI / 180F));
        int overrideRGB = poisoned ? 0x00FF00 : redColor;

        long curMs = System.currentTimeMillis();
        int hue = ColorUtil.overCol(Theme.DEFAULT.accent((int) ((curMs / 10) % 360), 1F), overrideRGB, hurtProgress);

        int lighterThemeColor = ColorUtil.multBright(hue, 1.5f);
        int baseRGB = ColorUtil.multAlpha(lighterThemeColor, (200f / 255f));

        double t = curMs / 1000.0;
        double pulse = 1.0 + 0.1 * Math.sin(t * 3.0);

        float scale = animProgress;

        Vector3d top = new Vector3d(0, 0.14 * scale, 0);
        Vector3d bottom = new Vector3d(0, -0.14 * scale, 0);
        Vector3d px = new Vector3d(0.14 * scale, 0, 0);
        Vector3d nx = new Vector3d(-0.14 * scale, 0, 0);
        Vector3d pz = new Vector3d(0, 0, 0.14 * scale);
        Vector3d nz = new Vector3d(0, 0, -0.14 * scale);


        Vector3d[][] faces = new Vector3d[][]{
                {top, px, pz}, {top, pz, nx}, {top, nx, nz}, {top, nz, px},
                {bottom, pz, px}, {bottom, nx, pz}, {bottom, nz, nx}, {bottom, px, nz}
        };

        float shellScale = 1.15f;
        for (int i = 0; i < 6; i++) {
            double ang = t * speed + i * (2 * Math.PI / 6.0);

            double ox = cx + orbitR * pulse * Math.cos(ang);
            double oy = cy + yOffset + 0.15 * Math.sin(t * 2.5 + i * 0.8);
            double oz = cz + orbitR * pulse * Math.sin(ang);

            Vector3d kristalchikiPos = new Vector3d(ox, oy, oz);
            Vector3d entityCenter = new Vector3d(cx, cy, cz);

            for (Vector3d[] tri : faces) {
                Vector3d l0 = tri[0].scale(shellScale);
                Vector3d l1 = tri[1].scale(shellScale);
                Vector3d l2 = tri[2].scale(shellScale);

                Vector3d v0 = Kirilj(kristalchikiPos, entityCenter, l0);
                Vector3d v1 = Kirilj(kristalchikiPos, entityCenter, l1);
                Vector3d v2 = Kirilj(kristalchikiPos, entityCenter, l2);

                Vector3d n = v1.subtract(v0).crossProduct(v2.subtract(v0)).normalize();
                Vector3d lightDir = new Vector3d(0.6, 1.0, 0.4).normalize();
                double ndl = Math.max(0.1, n.dotProduct(lightDir));
                int faceColor = shadeColor(baseRGB, (float) ndl);

                int shellColor = ColorUtil.multAlpha(faceColor, 0.3f * animProgress);

                Vector2f p0 = Project.project2D(v0.x, v0.y, v0.z);
                Vector2f p1 = Project.project2D(v1.x, v1.y, v1.z);
                Vector2f p2 = Project.project2D(v2.x, v2.y, v2.z);
                if (p0 == null || p1 == null || p2 == null) continue;

                xzfilled(matrix, p0, p1, p2, shellColor);
            }
        }

        for (int i = 0; i < 6; i++) {
            double ang = t * speed + i * (2 * Math.PI / 6.0);
            double ox = cx + orbitR * pulse * Math.cos(ang);
            double oy = cy + yOffset + 0.15 * Math.sin(t * 2.5 + i * 0.8);
            double oz = cz + orbitR * pulse * Math.sin(ang);

            Vector3d kristalchikiPos = new Vector3d(ox, oy, oz);
            Vector3d entityCenter = new Vector3d(cx, cy, cz);

            Vector2f p_center = Project.project2D(ox, oy, oz);
            if (p_center != null) {
                float distance = (float) mc.getRenderManager().info.getProjectedView().distanceTo(new Vector3d(ox, oy, oz));
                float scaleFactor = Math.max(0.5f, 5.0f / distance);
                float glowSize = 30.0f * scaleFactor * scale;

                int finalColor = ColorUtil.overCol(hue, redColor, hurtProgress);
                int fadedColor = ColorUtil.multAlpha(finalColor, 0.05f * animProgress);
                int mainColor = ColorUtil.multAlpha(finalColor, animProgress);

                mc.getTextureManager().bindTexture(glowTex);
                RectUtil.drawRect(matrix, p_center.x - glowSize / 2, p_center.y - glowSize / 2, glowSize, glowSize, fadedColor, fadedColor, fadedColor, fadedColor, true, true);
                RectUtil.drawRect(matrix, p_center.x - glowSize / 2, p_center.y - glowSize / 2, glowSize, glowSize, mainColor, mainColor, mainColor, mainColor, true, true);
            }

            for (Vector3d[] tri : faces) {
                Vector3d l0 = tri[0];
                Vector3d l1 = tri[1];
                Vector3d l2 = tri[2];

                Vector3d v0 = Kirilj(kristalchikiPos, entityCenter, l0);
                Vector3d v1 = Kirilj(kristalchikiPos, entityCenter, l1);
                Vector3d v2 = Kirilj(kristalchikiPos, entityCenter, l2);


                Vector3d n = v1.subtract(v0).crossProduct(v2.subtract(v0)).normalize();
                Vector3d lightDir = new Vector3d(0.6, 1.0, 0.4).normalize();
                double ndl = Math.max(0.1, n.dotProduct(lightDir));
                int faceColor = shadeColor(baseRGB, (float) ndl);
                faceColor = ColorUtil.multAlpha(faceColor, animProgress);

                Vector2f p0 = Project.project2D(v0.x, v0.y, v0.z);
                Vector2f p1 = Project.project2D(v1.x, v1.y, v1.z);
                Vector2f p2 = Project.project2D(v2.x, v2.y, v2.z);
                if (p0 == null || p1 == null || p2 == null) continue;

                xzfilled(matrix, p0, p1, p2, faceColor);
            }
        }
    }

    private Vector3d Kirilj(Vector3d kristalchikiPos, Vector3d targetPos, Vector3d localPos) {
        Vector3d modelUp = targetPos.subtract(kristalchikiPos).normalize();

        Vector3d modelRight = new Vector3d(0, 1, 0).crossProduct(modelUp).normalize();

        if (modelRight.lengthSquared() < 0.001) {
            modelRight = new Vector3d(1, 0, 0).crossProduct(modelUp).normalize();
        }

        Vector3d modelForward = modelUp.crossProduct(modelRight).normalize();

        double worldX = kristalchikiPos.x + modelRight.x * localPos.x + modelUp.x * localPos.y + modelForward.x * localPos.z;
        double worldY = kristalchikiPos.y + modelRight.y * localPos.x + modelUp.y * localPos.y + modelForward.y * localPos.z;
        double worldZ = kristalchikiPos.z + modelRight.z * localPos.x + modelUp.z * localPos.y + modelForward.z * localPos.z;

        return new Vector3d(worldX, worldY, worldZ);
    }

    private int shadeColor(int rgba, float k) {
        return ColorUtil.multBright(rgba, k);
    }

    private void xzfilled(MatrixStack matrix, Vector2f p0, Vector2f p1, Vector2f p2, int rgba) {
        RenderSystem.disableTexture();
        RenderSystem.disableCull();

        float a = (float) (rgba >> 24 & 255) / 255.0F;
        float r = (float) (rgba >> 16 & 255) / 255.0F;
        float g = (float) (rgba >> 8 & 255) / 255.0F;
        float b = (float) (rgba & 255) / 255.0F;

        Matrix4f mat = matrix.getLast().getMatrix();
        BufferBuilder buf = Tessellator.getInstance().getBuffer();
        buf.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_COLOR);
        buf.pos(mat, p0.x, p0.y, 0).color(r, g, b, a).endVertex();
        buf.pos(mat, p1.x, p1.y, 0).color(r, g, b, a).endVertex();
        buf.pos(mat, p2.x, p2.y, 0).color(r, g, b, a).endVertex();
        Tessellator.getInstance().draw();

        RenderSystem.enableCull();
        RenderSystem.enableTexture();
    }
}
 

Вложения

  • 5413880850581422148.jpg
    5413880850581422148.jpg
    37.8 KB · Просмотры: 113
Последнее редактирование:
/del уже сотая тема
 
Наоборот хуже стало слишком ярко
 
Да, опять, НО теперь они сделаны просто АХУЕННО
Сливаю из-за того решил делать софт без обфы и что бы вы не мучались кидаю прям сюда
ss прикрепил
Crystals:
Expand Collapse Copy
package org.san1na.excellent.client.impl.feature.impl.render;

import lombok.Getter;
import lombok.experimental.Accessors;
import net.blaze3d.matrix.MatrixStack;
import net.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.LivingEntity;
import net.minecraft.potion.Effects;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraft.util.math.vector.Vector4f;
import org.joml.Vector2f;
import org.lwjgl.opengl.GL11;
import org.san1na.common.animation.Animation;
import org.san1na.common.animation.AnimationUtil;
import org.san1na.common.animation.Easings;
import org.san1na.common.events.orbit.EventHandler;
import org.san1na.excellent.client.Client;
import org.san1na.excellent.client.events.player.UpdateEvent;
import org.san1na.excellent.client.events.render.Render2DEvent;
import org.san1na.excellent.client.events.render.Render3DLastEvent;
import org.san1na.excellent.client.impl.feature.Category;
import org.san1na.excellent.client.impl.feature.Feature;
import org.san1na.excellent.client.impl.feature.FeatureInfo;
import org.san1na.excellent.client.impl.feature.impl.combat.AttackAura;
import org.san1na.excellent.client.impl.settings.impl.BooleanSetting;
import org.san1na.excellent.client.impl.settings.impl.ModeSetting;
import org.san1na.excellent.client.impl.settings.impl.SliderSetting;
import org.san1na.excellent.client.util.color.ColorUtil;
import org.san1na.excellent.client.util.color.theme.Theme;
import org.san1na.excellent.client.util.combat.AuraUtil;
import org.san1na.excellent.client.util.math.Interpolator;
import org.san1na.excellent.client.util.math.MathUtils;
import org.san1na.excellent.client.util.math.Mathf;
import org.san1na.excellent.client.util.math.StopWatch;
import org.san1na.excellent.client.util.render.impl.GLUtils;
import org.san1na.excellent.client.util.render.impl.Project;
import org.san1na.excellent.client.util.render.impl.RectUtil;
import org.san1na.excellent.client.util.render.impl.RenderUtil;
import org.san1na.excellent.client.util.render.impl.RenderUtil3D;
import org.san1na.excellent.client.util.render.texture.ClientTexture;

import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;

@Getter
@Accessors(fluent = true)
@FeatureInfo(name = "TargetESP", description = "Подсвечивает врага на текущий момент если он есть", category = Category.RENDER)
public class TargetESP extends Feature {

    public final ModeSetting mode = new ModeSetting("Режим", "Кристаллы");
    public final BooleanSetting aimEsp = new BooleanSetting("При наведении", false);

    private final Random RAND = new Random(123123222);
    private final Tessellator tessellator = Tessellator.getInstance();
    private final BufferBuilder bufferBuilder = tessellator.getBuffer();

    private final ResourceLocation glowTex = ClientTexture.GLOW.location();
    final Animation crystalAnimation = new Animation().easing(Easings.SINE_OUT).duration(Duration.ofMillis(600));

    private int getColor(int index, float aPC) {
        return ColorUtil.fade(3, index, ColorUtil.multBright(Theme.DEFAULT.accent(aPC), .15f), ColorUtil.multBright(Theme.DEFAULT.accent(aPC), .45f));
    }

    private List<LivingEntity> getTargeted() {
        final List<LivingEntity> targets = new ArrayList<>();
        if (Client.inst().featureManager().attackAura().target() != null)
            targets.add(Client.inst().featureManager().attackAura().target());
        if (aimEsp.get() && mc.pointedEntity instanceof LivingEntity living && living.isAlive() && living != Client.inst().featureManager().freeCam.entity())
            targets.add(living);
        return targets;
    }

    public LivingEntity target;
    public LivingEntity lastTarget;
    public final Animation markerAnimation = new Animation();
    private final Vector2f markerPosition = new Vector2f(0, 0);
    private final ResourceLocation markerLocation = ClientTexture.MARKER.location();
    private final ResourceLocation glow = ClientTexture.GLOW.location();
    final Animation hurtAnim = new Animation().easing(Easings.SINE_OUT).duration(Duration.ofMillis(100));
    final Animation sizeAnim = new Animation().easing(Easings.LINEAR).duration(Duration.ofMillis(50));

    private void updateTarget() {
        AttackAura aura = Client.inst().featureManager().attackAura();
        LivingEntity newTarget = null;
        if (aura.target() != null)
            newTarget = aura.target();
        if (aimEsp.get() && mc.pointedEntity instanceof LivingEntity living && living.isAlive() && living != Client.inst().featureManager().freeCam.entity())
            newTarget = living;
        this.target = newTarget;

        if (this.target != null) {
            this.lastTarget = this.target;
        }
    }

    @EventHandler
    public void onUpdate(UpdateEvent eventUpdate) {
        updateTarget();
    }

    @EventHandler
    public void onRenderWorldEvent(Render3DLastEvent event3d) {
    }

    @EventHandler
    public void onEvent(Render2DEvent event) {
        markerAnimation.update();
        crystalAnimation.update();

        long durationRingSoul = 400L;
        long durationImage = 150L;
        long durationCrystal = 600L;

        long duration = durationImage;
        if (mode.is("Кристаллы")) duration = durationCrystal;
        else duration = durationImage;

        markerAnimation.run(this.target == null ? 0 : 1, Duration.ofMillis(mode.is("Картинка") || mode.is("Кольцо/Jello") || mode.is("Души") ? (this.target == null ? duration : durationImage) : duration), Easings.LINEAR, false);


        crystalAnimation.run(this.target != null ? 1 : 0, Duration.ofMillis(durationCrystal), Easings.SINE_OUT, false);

        if (markerAnimation.get() == 0.0 && this.target == null) {
            this.lastTarget = null;
        }

        if (this.target != null || this.lastTarget != null) {
            if (this.mode.is("Кристаллы")) {
                float animProgress = crystalAnimation.get();
                if (animProgress > 0) {
                    RenderSystem.enableBlend();
                    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
                    renderCrystals(event.getMatrix(), event.getPartialTicks(), animProgress);
                    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                    RenderSystem.disableBlend();
                }
            }
        }
    }

    private void renderCrystals(MatrixStack matrix, float partialTicks, float animProgress) {
        LivingEntity entityToRender = this.target != null ? this.target : this.lastTarget;
        if (entityToRender == null) return;

        Vector3d interpolated = RenderUtil3D.interpolate(entityToRender, partialTicks);
        double cx = interpolated.x;
        double cy = interpolated.y + entityToRender.getHeight() * 0.55;
        double cz = interpolated.z;

        renderCrystalkrug(matrix, partialTicks, entityToRender, cx, cy, cz, 0.9, 1.8, 0, animProgress);
        renderCrystalkrug(matrix, partialTicks, entityToRender, cx, cy, cz, 1.1, 2.0, 0.6, animProgress);
    }

    private void renderCrystalkrug(MatrixStack matrix, float partialTicks, LivingEntity entityToRender, double cx, double cy, double cz, double orbitR, double speed, double yOffset, float animProgress) {
        boolean poisoned = entityToRender.isPotionActive(Effects.POISON);
        int redColor = ColorUtil.getColor(255, 0, 0);
        float hurtProgress = (float) Math.sin(entityToRender.hurtTime * (18F * Math.PI / 180F));
        int overrideRGB = poisoned ? 0x00FF00 : redColor;

        long curMs = System.currentTimeMillis();
        int hue = ColorUtil.overCol(Theme.DEFAULT.accent((int) ((curMs / 10) % 360), 1F), overrideRGB, hurtProgress);

        int lighterThemeColor = ColorUtil.multBright(hue, 1.5f);
        int baseRGB = ColorUtil.multAlpha(lighterThemeColor, (200f / 255f));

        double t = curMs / 1000.0;
        double pulse = 1.0 + 0.1 * Math.sin(t * 3.0);

        float scale = animProgress;

        Vector3d top = new Vector3d(0, 0.14 * scale, 0);
        Vector3d bottom = new Vector3d(0, -0.14 * scale, 0);
        Vector3d px = new Vector3d(0.14 * scale, 0, 0);
        Vector3d nx = new Vector3d(-0.14 * scale, 0, 0);
        Vector3d pz = new Vector3d(0, 0, 0.14 * scale);
        Vector3d nz = new Vector3d(0, 0, -0.14 * scale);


        Vector3d[][] faces = new Vector3d[][]{
                {top, px, pz}, {top, pz, nx}, {top, nx, nz}, {top, nz, px},
                {bottom, pz, px}, {bottom, nx, pz}, {bottom, nz, nx}, {bottom, px, nz}
        };

        float shellScale = 1.15f;
        for (int i = 0; i < 6; i++) {
            double ang = t * speed + i * (2 * Math.PI / 6.0);

            double ox = cx + orbitR * pulse * Math.cos(ang);
            double oy = cy + yOffset + 0.15 * Math.sin(t * 2.5 + i * 0.8);
            double oz = cz + orbitR * pulse * Math.sin(ang);

            Vector3d kristalchikiPos = new Vector3d(ox, oy, oz);
            Vector3d entityCenter = new Vector3d(cx, cy, cz);

            for (Vector3d[] tri : faces) {
                Vector3d l0 = tri[0].scale(shellScale);
                Vector3d l1 = tri[1].scale(shellScale);
                Vector3d l2 = tri[2].scale(shellScale);

                Vector3d v0 = Kirilj(kristalchikiPos, entityCenter, l0);
                Vector3d v1 = Kirilj(kristalchikiPos, entityCenter, l1);
                Vector3d v2 = Kirilj(kristalchikiPos, entityCenter, l2);

                Vector3d n = v1.subtract(v0).crossProduct(v2.subtract(v0)).normalize();
                Vector3d lightDir = new Vector3d(0.6, 1.0, 0.4).normalize();
                double ndl = Math.max(0.1, n.dotProduct(lightDir));
                int faceColor = shadeColor(baseRGB, (float) ndl);

                int shellColor = ColorUtil.multAlpha(faceColor, 0.3f * animProgress);

                Vector2f p0 = Project.project2D(v0.x, v0.y, v0.z);
                Vector2f p1 = Project.project2D(v1.x, v1.y, v1.z);
                Vector2f p2 = Project.project2D(v2.x, v2.y, v2.z);
                if (p0 == null || p1 == null || p2 == null) continue;

                xzfilled(matrix, p0, p1, p2, shellColor);
            }
        }

        for (int i = 0; i < 6; i++) {
            double ang = t * speed + i * (2 * Math.PI / 6.0);
            double ox = cx + orbitR * pulse * Math.cos(ang);
            double oy = cy + yOffset + 0.15 * Math.sin(t * 2.5 + i * 0.8);
            double oz = cz + orbitR * pulse * Math.sin(ang);

            Vector3d kristalchikiPos = new Vector3d(ox, oy, oz);
            Vector3d entityCenter = new Vector3d(cx, cy, cz);

            Vector2f p_center = Project.project2D(ox, oy, oz);
            if (p_center != null) {
                float distance = (float) mc.getRenderManager().info.getProjectedView().distanceTo(new Vector3d(ox, oy, oz));
                float scaleFactor = Math.max(0.5f, 5.0f / distance);
                float glowSize = 30.0f * scaleFactor * scale;

                int finalColor = ColorUtil.overCol(hue, redColor, hurtProgress);
                int fadedColor = ColorUtil.multAlpha(finalColor, 0.05f * animProgress);
                int mainColor = ColorUtil.multAlpha(finalColor, animProgress);

                mc.getTextureManager().bindTexture(glowTex);
                RectUtil.drawRect(matrix, p_center.x - glowSize / 2, p_center.y - glowSize / 2, glowSize, glowSize, fadedColor, fadedColor, fadedColor, fadedColor, true, true);
                RectUtil.drawRect(matrix, p_center.x - glowSize / 2, p_center.y - glowSize / 2, glowSize, glowSize, mainColor, mainColor, mainColor, mainColor, true, true);
            }

            for (Vector3d[] tri : faces) {
                Vector3d l0 = tri[0];
                Vector3d l1 = tri[1];
                Vector3d l2 = tri[2];

                Vector3d v0 = Kirilj(kristalchikiPos, entityCenter, l0);
                Vector3d v1 = Kirilj(kristalchikiPos, entityCenter, l1);
                Vector3d v2 = Kirilj(kristalchikiPos, entityCenter, l2);


                Vector3d n = v1.subtract(v0).crossProduct(v2.subtract(v0)).normalize();
                Vector3d lightDir = new Vector3d(0.6, 1.0, 0.4).normalize();
                double ndl = Math.max(0.1, n.dotProduct(lightDir));
                int faceColor = shadeColor(baseRGB, (float) ndl);
                faceColor = ColorUtil.multAlpha(faceColor, animProgress);

                Vector2f p0 = Project.project2D(v0.x, v0.y, v0.z);
                Vector2f p1 = Project.project2D(v1.x, v1.y, v1.z);
                Vector2f p2 = Project.project2D(v2.x, v2.y, v2.z);
                if (p0 == null || p1 == null || p2 == null) continue;

                xzfilled(matrix, p0, p1, p2, faceColor);
            }
        }
    }

    private Vector3d Kirilj(Vector3d kristalchikiPos, Vector3d targetPos, Vector3d localPos) {
        Vector3d modelUp = targetPos.subtract(kristalchikiPos).normalize();

        Vector3d modelRight = new Vector3d(0, 1, 0).crossProduct(modelUp).normalize();

        if (modelRight.lengthSquared() < 0.001) {
            modelRight = new Vector3d(1, 0, 0).crossProduct(modelUp).normalize();
        }

        Vector3d modelForward = modelUp.crossProduct(modelRight).normalize();

        double worldX = kristalchikiPos.x + modelRight.x * localPos.x + modelUp.x * localPos.y + modelForward.x * localPos.z;
        double worldY = kristalchikiPos.y + modelRight.y * localPos.x + modelUp.y * localPos.y + modelForward.y * localPos.z;
        double worldZ = kristalchikiPos.z + modelRight.z * localPos.x + modelUp.z * localPos.y + modelForward.z * localPos.z;

        return new Vector3d(worldX, worldY, worldZ);
    }

    private int shadeColor(int rgba, float k) {
        return ColorUtil.multBright(rgba, k);
    }

    private void xzfilled(MatrixStack matrix, Vector2f p0, Vector2f p1, Vector2f p2, int rgba) {
        RenderSystem.disableTexture();
        RenderSystem.disableCull();

        float a = (float) (rgba >> 24 & 255) / 255.0F;
        float r = (float) (rgba >> 16 & 255) / 255.0F;
        float g = (float) (rgba >> 8 & 255) / 255.0F;
        float b = (float) (rgba & 255) / 255.0F;

        Matrix4f mat = matrix.getLast().getMatrix();
        BufferBuilder buf = Tessellator.getInstance().getBuffer();
        buf.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_COLOR);
        buf.pos(mat, p0.x, p0.y, 0).color(r, g, b, a).endVertex();
        buf.pos(mat, p1.x, p1.y, 0).color(r, g, b, a).endVertex();
        buf.pos(mat, p2.x, p2.y, 0).color(r, g, b, a).endVertex();
        Tessellator.getInstance().draw();

        RenderSystem.enableCull();
        RenderSystem.enableTexture();
    }
}
Че то мне это напоминает...
 
ну и мусор честно говоря
 
Выглядит потрясающе!
 
Ахуено давай noclip под рв
 
имба брат. делай почаще красивые визики :)
 
Назад
Сверху Снизу