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

Визуальная часть Line Glyphs | Rich 1.21.11

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
26 Дек 2024
Сообщения
80
Реакции
0
Выберите загрузчик игры
  1. Fabric
Взято с этой темы тык
Адаптировал под 1.21.11 рич
хуево но хотя бы роботает
Java:
Expand Collapse Copy
package rich.modules.impl.render;

import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Vec3d;

import rich.IMinecraft;
import rich.events.api.EventHandler;
import rich.events.impl.TickEvent;
import rich.events.impl.WorldRenderEvent;
import rich.modules.module.ModuleStructure;
import rich.modules.module.category.ModuleCategory;
import rich.modules.module.setting.implement.BooleanSetting;
import rich.modules.module.setting.implement.SelectSetting;
import rich.modules.module.setting.implement.SliderSettings;
import rich.util.ColorUtil;
import rich.util.animations.Animation;
import rich.util.animations.Decelerate;
import rich.util.animations.Direction;
import rich.util.render.Render3D;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;

import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class LineGlyphs extends ModuleStructure implements IMinecraft {

    private final SliderSettings count = new SliderSettings("Count", "Количество линий").setValue(70f).range(10f, 200f);
    private final BooleanSetting slow = new BooleanSetting("Slow Speed", "Медленная скорость").setValue(false);
    private final SelectSetting colorMode = new SelectSetting("Color", "Цвет").value("Theme", "Rainbow", "Single");
    private final BooleanSetting glow = new BooleanSetting("Glow", "Свечение").setValue(true);

    private final List<Glyph> glyphs = new ArrayList<>();
    private final Random rand = new Random(93882L);

    public LineGlyphs() {
        super("Line Glyphs", "Анимированные линии в пространстве", ModuleCategory.RENDER);
        настройки (количество, медленный, цветовой режим, свечение);
    }

    @Override
    public void activate() {
        glyphs.clear();
    }

    @EventHandler
    public void onTick(TickEvent e) {
        if (mc.player == null) return;
        glyphs.removeIf(Glyph::isDead);
        int cap = (int) count.getValue();
        int attempts = 8;
        while (attempts-- > 0 && glyphs.size() < cap) {
            glyphs.add(new Glyph(spawnPos(), rand.nextInt(7, 13)));
        }
        glyphs.forEach(Glyph::tick);
    }

    @EventHandler
    public void onRender3D(WorldRenderEvent e) {
        if (mc.player == null) return;
        drawAll(e.getStack(), e.getPartialTicks());
    }

    private void drawAll(MatrixStack ms, float pt) {
        if (glyphs.isEmpty()) return;

        Vec3d cam = mc.gameRenderer.getCamera().getCameraPos();
        VertexConsumerProvider.Immediate immediate = mc.getBufferBuilders().getEntityVertexConsumers();
        VertexConsumer glowBuf = glow.isValue() ? immediate.getBuffer(rich.util.render.sliemtpipeline.ClientPipelines.WORLD_PARTICLES_LINES) : null;
        MatrixStack.Entry entry = ms.peek();

        int idx = 0;
        for (Glyph g : glyphs) {
            List<Vec3d> pts = g.getPoints(pt);
            if (pts.size() < 2) { idx++; continue; }

            float lineW = calcLineWidth(g, cam);

            int from = idx;
            for (int step = 0; step < pts.size() - 1; step++) {
                Vec3d p1 = pts.get(step);
                Vec3d p2 = pts.get(step + 1);

                float apc1 = g.alpha() * (0.25f + (float) step / pts.size() / 1.75f);
                Color c1 = stateColor(ci, apc1);

                float apc2 = g.alpha() * (0.25f + (float) (step + 1) / pts.size() / 1.75f);
                Color c2 = stateColor(ci + 180, apc2);

                Render3D.drawLineGradient(p1, p2, c1.getRGB(), c2.getRGB(), lineW, false);
                
                if (glow.isValue()) {
                    org.joml.Vector3f normal = Render3D.getNormal(p1.toVector3f(), p2.toVector3f());
                    int gC1 = rich.util.ColorUtil.multAlpha(c1.getRGB(), 0.5f);
                    int gC2 = rich.util.ColorUtil.multAlpha(c2.getRGB(), 0.5f);
                    glowBuf.vertex(entry, (float)(p1.x - cam.x), (float)(p1.y - cam.y), (float)(p1.z - cam.z)).color(gC1).normal(entry, normal).lineWidth(lineW * 3.5f);
                    glowBuf.vertex(entry, (float)(p2.x - cam.x), (float)(p2.y - cam.y), (float)(p2.z - cam.z)).color(gC2).normal(entry, normal).lineWidth(lineW * 3.5f);
                }

                ci += 180;
            }

            idx++;
        }

        if (glow.isValue()) {
            immediate.draw();
        }
    }

    private Color stateColor(int index, float alphaPC) {
        Color base = switch (colorMode.getSelected()) {
            case "Rainbow" -> {
                float hue = ((System.currentTimeMillis() / 20f + index * 2f) % 360f) / 360f;
                yield Color.getHSBColor(hue, 1f, 1f);
            }
            case "Single" -> new Color(ColorUtil.getMainGuiColor());
            default -> new Color(ColorUtil.getMainGuiColor()); // Тема (используя резервный цвет основного графического интерфейса)
        };
        int a = Math.max(0, Math.min(255, (int)(alphaPC * 255f)));
        return new Color(base.getRed(), base.getGreen(), base.getBlue(), a);
    }

    private float calcLineWidth(Glyph g, Vec3d cam) {
        if (g.nodes.isEmpty()) return 1f;
        int[] n0 = g.nodes.get(0);
        Vec3d first = new Vec3d(n0[0], n0[1], n0[2]);
        double dst = cam.distanceTo(first);
        return 1e-4f + 3f * (float) Math.max(0, Math.min(1, 1.0 - dst / 20.0));
    }

    private int[] spawnPosInts() {
        double fov = mc.options.getFov().getValue();
        double yaw = Math.toRadians(rand.nextInt(
                (int)(mc.player.getYaw() - fov * 0.75),
                (int)(mc.player.getYaw() + fov * 0.75)));
        double dst = rand.nextInt(6, 24);
        int dx = (int)(-(Math.sin(yaw) * dst));
        int dy = rand.nextInt(0, 12);
        int dz = (int)(Math.cos(yaw) * dst);
        Vec3d eye = mc.player.getEyePos();
        return new int[]{(int)eye.x + dx, (int)eye.y + dy, (int)eye.z + dz};
    }

    private int[] spawnPos() { return spawnPosInts(); }

    private int[] randXY() {
        return new int[]{rand.nextInt(0, 4) * 90, rand.nextInt(-1, 2) * 90};
    }

    private int[] nextDir(int[] prev) {
        int a = prev[0], b = prev[1];
        int nb = b;
        for (int i = 150; i > 0 && Math.abs(nb - b) != 90; i--) nb = rand.nextInt(-2, 2) * 90;
        int a = a;
        for (int i = 5; i > 0 && Math.abs(na - a) != 90; i--) na = rand.nextInt(0, 4) * 90;
        return new int[]{na, nb};
    }

    private int[] step(int[] pos, int[] dir, int r) {
        double yaw = Math.toRadians(dir[0]);
        double pitch = Math.toRadians(dir[1]);
        double r1 = r;
        int ry = (int)(Math.sin(pitch) * r1);
        если (pitch != 0) r1 = 0;
        int rx = (int)(-(Math.sin(yaw) * r1));
        int rz = (int)(Math.cos(yaw) * r1);
        return new int[]{pos[0] + rx, pos[1] + ry, pos[2] + rz};
    }

    private class Glyph {
        final List<int[]> nodes = new ArrayList<>();
        private int[] dir;
        private int stepsLeft;
        private int ticksLeft;
        private int lastSet;
        private boolean dying = false;
        private final Animation anim = new Decelerate();

        Glyph(int[] spawn, int steps) {
            nodes.add(spawn);
            dir = randXY();
            stepsLeft = steps;
            animation.setValue(1.0);
            anim.setMs(600);
            anim.setDirection(Direction.FORWARD);
            anim.reset();
        }

        void tick() {
            if (stepsLeft == 0) {
                если (!умирает) {
                    умирание = правда;
                    anim.setMs(400);
                    anim.setDirection(Direction.BACKWARDS);
                    anim.reset();
                }
                возвращаться;
            }
            if (ticksLeft > 0) {
                ticksLeft -= slow.isValue() ? 1 : 2;
                if (ticksLeft < 0) ticksLeft = 0;
                возвращаться;
            }
            dir = nextDir(dir);
            lastSet = ticksLeft = rand.nextInt(0, 3);
            nodes.add(step(nodes.get(nodes.size() - 1), dir, Math.max(1, ticksLeft)));
            шаги влево--;
        }

        float alpha() { return (float) anim.getOutput().doubleValue(); }

        boolean isDead() {
            return stepsLeft == 0 && anim.getOutput() < 0.01 && anim.isFinished(Direction.BACKWARDS);
        }

        List<Vec3d> getPoints(float pt) {
            List<Vec3d> out = new ArrayList<>();
            for (int i = 0; i < nodes.size(); i++) {
                int[] n = nodes.get(i);
                double x = n[0], y = n[1], z = n[2];
                if (i == nodes.size() - 1 && nodes.size() >= 2) {
                    int[] prev = nodes.get(i - 1);
                    float adv = lastSet > 0 ? Math.max(0, Math.min(1, 1f - (float) ticksLeft / lastSet)) : 1f;
                    x = lerp(prev[0], x, adv);
                    y = lerp(prev[1], y, adv);
                    z = lerp(prev[2], z, adv);
                }
                out.add(new Vec3d(x, y, z));
            }
            вернуться наружу;
        }

        private double lerp(double a, double b, float t) { return a + (b - a) * t; }
    }
}
[/КОД]
 
Взято с этой темы тык
Адаптировал под 1.21.11 рич
хуево но хотя бы роботает
Java:
Expand Collapse Copy
package rich.modules.impl.render;

import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Vec3d;

import rich.IMinecraft;
import rich.events.api.EventHandler;
import rich.events.impl.TickEvent;
import rich.events.impl.WorldRenderEvent;
import rich.modules.module.ModuleStructure;
import rich.modules.module.category.ModuleCategory;
import rich.modules.module.setting.implement.BooleanSetting;
import rich.modules.module.setting.implement.SelectSetting;
import rich.modules.module.setting.implement.SliderSettings;
import rich.util.ColorUtil;
import rich.util.animations.Animation;
import rich.util.animations.Decelerate;
import rich.util.animations.Direction;
import rich.util.render.Render3D;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;

import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class LineGlyphs extends ModuleStructure implements IMinecraft {

    private final SliderSettings count = new SliderSettings("Count", "Количество линий").setValue(70f).range(10f, 200f);
    private final BooleanSetting slow = new BooleanSetting("Slow Speed", "Медленная скорость").setValue(false);
    private final SelectSetting colorMode = new SelectSetting("Color", "Цвет").value("Theme", "Rainbow", "Single");
    private final BooleanSetting glow = new BooleanSetting("Glow", "Свечение").setValue(true);

    private final List<Glyph> glyphs = new ArrayList<>();
    private final Random rand = new Random(93882L);

    public LineGlyphs() {
        super("Line Glyphs", "Анимированные линии в пространстве", ModuleCategory.RENDER);
        настройки (количество, медленный, цветовой режим, свечение);
    }

    @Override
    public void activate() {
        glyphs.clear();
    }

    @EventHandler
    public void onTick(TickEvent e) {
        if (mc.player == null) return;
        glyphs.removeIf(Glyph::isDead);
        int cap = (int) count.getValue();
        int attempts = 8;
        while (attempts-- > 0 && glyphs.size() < cap) {
            glyphs.add(new Glyph(spawnPos(), rand.nextInt(7, 13)));
        }
        glyphs.forEach(Glyph::tick);
    }

    @EventHandler
    public void onRender3D(WorldRenderEvent e) {
        if (mc.player == null) return;
        drawAll(e.getStack(), e.getPartialTicks());
    }

    private void drawAll(MatrixStack ms, float pt) {
        if (glyphs.isEmpty()) return;

        Vec3d cam = mc.gameRenderer.getCamera().getCameraPos();
        VertexConsumerProvider.Immediate immediate = mc.getBufferBuilders().getEntityVertexConsumers();
        VertexConsumer glowBuf = glow.isValue() ? immediate.getBuffer(rich.util.render.sliemtpipeline.ClientPipelines.WORLD_PARTICLES_LINES) : null;
        MatrixStack.Entry entry = ms.peek();

        int idx = 0;
        for (Glyph g : glyphs) {
            List<Vec3d> pts = g.getPoints(pt);
            if (pts.size() < 2) { idx++; continue; }

            float lineW = calcLineWidth(g, cam);

            int from = idx;
            for (int step = 0; step < pts.size() - 1; step++) {
                Vec3d p1 = pts.get(step);
                Vec3d p2 = pts.get(step + 1);

                float apc1 = g.alpha() * (0.25f + (float) step / pts.size() / 1.75f);
                Color c1 = stateColor(ci, apc1);

                float apc2 = g.alpha() * (0.25f + (float) (step + 1) / pts.size() / 1.75f);
                Color c2 = stateColor(ci + 180, apc2);

                Render3D.drawLineGradient(p1, p2, c1.getRGB(), c2.getRGB(), lineW, false);
               
                if (glow.isValue()) {
                    org.joml.Vector3f normal = Render3D.getNormal(p1.toVector3f(), p2.toVector3f());
                    int gC1 = rich.util.ColorUtil.multAlpha(c1.getRGB(), 0.5f);
                    int gC2 = rich.util.ColorUtil.multAlpha(c2.getRGB(), 0.5f);
                    glowBuf.vertex(entry, (float)(p1.x - cam.x), (float)(p1.y - cam.y), (float)(p1.z - cam.z)).color(gC1).normal(entry, normal).lineWidth(lineW * 3.5f);
                    glowBuf.vertex(entry, (float)(p2.x - cam.x), (float)(p2.y - cam.y), (float)(p2.z - cam.z)).color(gC2).normal(entry, normal).lineWidth(lineW * 3.5f);
                }

                ci += 180;
            }

            idx++;
        }

        if (glow.isValue()) {
            immediate.draw();
        }
    }

    private Color stateColor(int index, float alphaPC) {
        Color base = switch (colorMode.getSelected()) {
            case "Rainbow" -> {
                float hue = ((System.currentTimeMillis() / 20f + index * 2f) % 360f) / 360f;
                yield Color.getHSBColor(hue, 1f, 1f);
            }
            case "Single" -> new Color(ColorUtil.getMainGuiColor());
            default -> new Color(ColorUtil.getMainGuiColor()); // Тема (используя резервный цвет основного графического интерфейса)
        };
        int a = Math.max(0, Math.min(255, (int)(alphaPC * 255f)));
        return new Color(base.getRed(), base.getGreen(), base.getBlue(), a);
    }

    private float calcLineWidth(Glyph g, Vec3d cam) {
        if (g.nodes.isEmpty()) return 1f;
        int[] n0 = g.nodes.get(0);
        Vec3d first = new Vec3d(n0[0], n0[1], n0[2]);
        double dst = cam.distanceTo(first);
        return 1e-4f + 3f * (float) Math.max(0, Math.min(1, 1.0 - dst / 20.0));
    }

    private int[] spawnPosInts() {
        double fov = mc.options.getFov().getValue();
        double yaw = Math.toRadians(rand.nextInt(
                (int)(mc.player.getYaw() - fov * 0.75),
                (int)(mc.player.getYaw() + fov * 0.75)));
        double dst = rand.nextInt(6, 24);
        int dx = (int)(-(Math.sin(yaw) * dst));
        int dy = rand.nextInt(0, 12);
        int dz = (int)(Math.cos(yaw) * dst);
        Vec3d eye = mc.player.getEyePos();
        return new int[]{(int)eye.x + dx, (int)eye.y + dy, (int)eye.z + dz};
    }

    private int[] spawnPos() { return spawnPosInts(); }

    private int[] randXY() {
        return new int[]{rand.nextInt(0, 4) * 90, rand.nextInt(-1, 2) * 90};
    }

    private int[] nextDir(int[] prev) {
        int a = prev[0], b = prev[1];
        int nb = b;
        for (int i = 150; i > 0 && Math.abs(nb - b) != 90; i--) nb = rand.nextInt(-2, 2) * 90;
        int a = a;
        for (int i = 5; i > 0 && Math.abs(na - a) != 90; i--) na = rand.nextInt(0, 4) * 90;
        return new int[]{na, nb};
    }

    private int[] step(int[] pos, int[] dir, int r) {
        double yaw = Math.toRadians(dir[0]);
        double pitch = Math.toRadians(dir[1]);
        double r1 = r;
        int ry = (int)(Math.sin(pitch) * r1);
        если (pitch != 0) r1 = 0;
        int rx = (int)(-(Math.sin(yaw) * r1));
        int rz = (int)(Math.cos(yaw) * r1);
        return new int[]{pos[0] + rx, pos[1] + ry, pos[2] + rz};
    }

    private class Glyph {
        final List<int[]> nodes = new ArrayList<>();
        private int[] dir;
        private int stepsLeft;
        private int ticksLeft;
        private int lastSet;
        private boolean dying = false;
        private final Animation anim = new Decelerate();

        Glyph(int[] spawn, int steps) {
            nodes.add(spawn);
            dir = randXY();
            stepsLeft = steps;
            animation.setValue(1.0);
            anim.setMs(600);
            anim.setDirection(Direction.FORWARD);
            anim.reset();
        }

        void tick() {
            if (stepsLeft == 0) {
                если (!умирает) {
                    умирание = правда;
                    anim.setMs(400);
                    anim.setDirection(Direction.BACKWARDS);
                    anim.reset();
                }
                возвращаться;
            }
            if (ticksLeft > 0) {
                ticksLeft -= slow.isValue() ? 1 : 2;
                if (ticksLeft < 0) ticksLeft = 0;
                возвращаться;
            }
            dir = nextDir(dir);
            lastSet = ticksLeft = rand.nextInt(0, 3);
            nodes.add(step(nodes.get(nodes.size() - 1), dir, Math.max(1, ticksLeft)));
            шаги влево--;
        }

        float alpha() { return (float) anim.getOutput().doubleValue(); }

        boolean isDead() {
            return stepsLeft == 0 && anim.getOutput() < 0.01 && anim.isFinished(Direction.BACKWARDS);
        }

        List<Vec3d> getPoints(float pt) {
            List<Vec3d> out = new ArrayList<>();
            for (int i = 0; i < nodes.size(); i++) {
                int[] n = nodes.get(i);
                double x = n[0], y = n[1], z = n[2];
                if (i == nodes.size() - 1 && nodes.size() >= 2) {
                    int[] prev = nodes.get(i - 1);
                    float adv = lastSet > 0 ? Math.max(0, Math.min(1, 1f - (float) ticksLeft / lastSet)) : 1f;
                    x = lerp(prev[0], x, adv);
                    y = lerp(prev[1], y, adv);
                    z = lerp(prev[2], z, adv);
                }
                out.add(new Vec3d(x, y, z));
            }
            вернуться наружу;
        }

        private double lerp(double a, double b, float t) { return a + (b - a) * t; }
    }
}
[/КОД]
адаптируй под рок 2.0
 
Взято с этой темы тык
Адаптировал под 1.21.11 рич
хуево но хотя бы роботает
Java:
Expand Collapse Copy
package rich.modules.impl.render;

import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Vec3d;

import rich.IMinecraft;
import rich.events.api.EventHandler;
import rich.events.impl.TickEvent;
import rich.events.impl.WorldRenderEvent;
import rich.modules.module.ModuleStructure;
import rich.modules.module.category.ModuleCategory;
import rich.modules.module.setting.implement.BooleanSetting;
import rich.modules.module.setting.implement.SelectSetting;
import rich.modules.module.setting.implement.SliderSettings;
import rich.util.ColorUtil;
import rich.util.animations.Animation;
import rich.util.animations.Decelerate;
import rich.util.animations.Direction;
import rich.util.render.Render3D;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;

import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class LineGlyphs extends ModuleStructure implements IMinecraft {

    private final SliderSettings count = new SliderSettings("Count", "Количество линий").setValue(70f).range(10f, 200f);
    private final BooleanSetting slow = new BooleanSetting("Slow Speed", "Медленная скорость").setValue(false);
    private final SelectSetting colorMode = new SelectSetting("Color", "Цвет").value("Theme", "Rainbow", "Single");
    private final BooleanSetting glow = new BooleanSetting("Glow", "Свечение").setValue(true);

    private final List<Glyph> glyphs = new ArrayList<>();
    private final Random rand = new Random(93882L);

    public LineGlyphs() {
        super("Line Glyphs", "Анимированные линии в пространстве", ModuleCategory.RENDER);
        настройки (количество, медленный, цветовой режим, свечение);
    }

    @Override
    public void activate() {
        glyphs.clear();
    }

    @EventHandler
    public void onTick(TickEvent e) {
        if (mc.player == null) return;
        glyphs.removeIf(Glyph::isDead);
        int cap = (int) count.getValue();
        int attempts = 8;
        while (attempts-- > 0 && glyphs.size() < cap) {
            glyphs.add(new Glyph(spawnPos(), rand.nextInt(7, 13)));
        }
        glyphs.forEach(Glyph::tick);
    }

    @EventHandler
    public void onRender3D(WorldRenderEvent e) {
        if (mc.player == null) return;
        drawAll(e.getStack(), e.getPartialTicks());
    }

    private void drawAll(MatrixStack ms, float pt) {
        if (glyphs.isEmpty()) return;

        Vec3d cam = mc.gameRenderer.getCamera().getCameraPos();
        VertexConsumerProvider.Immediate immediate = mc.getBufferBuilders().getEntityVertexConsumers();
        VertexConsumer glowBuf = glow.isValue() ? immediate.getBuffer(rich.util.render.sliemtpipeline.ClientPipelines.WORLD_PARTICLES_LINES) : null;
        MatrixStack.Entry entry = ms.peek();

        int idx = 0;
        for (Glyph g : glyphs) {
            List<Vec3d> pts = g.getPoints(pt);
            if (pts.size() < 2) { idx++; continue; }

            float lineW = calcLineWidth(g, cam);

            int from = idx;
            for (int step = 0; step < pts.size() - 1; step++) {
                Vec3d p1 = pts.get(step);
                Vec3d p2 = pts.get(step + 1);

                float apc1 = g.alpha() * (0.25f + (float) step / pts.size() / 1.75f);
                Color c1 = stateColor(ci, apc1);

                float apc2 = g.alpha() * (0.25f + (float) (step + 1) / pts.size() / 1.75f);
                Color c2 = stateColor(ci + 180, apc2);

                Render3D.drawLineGradient(p1, p2, c1.getRGB(), c2.getRGB(), lineW, false);
               
                if (glow.isValue()) {
                    org.joml.Vector3f normal = Render3D.getNormal(p1.toVector3f(), p2.toVector3f());
                    int gC1 = rich.util.ColorUtil.multAlpha(c1.getRGB(), 0.5f);
                    int gC2 = rich.util.ColorUtil.multAlpha(c2.getRGB(), 0.5f);
                    glowBuf.vertex(entry, (float)(p1.x - cam.x), (float)(p1.y - cam.y), (float)(p1.z - cam.z)).color(gC1).normal(entry, normal).lineWidth(lineW * 3.5f);
                    glowBuf.vertex(entry, (float)(p2.x - cam.x), (float)(p2.y - cam.y), (float)(p2.z - cam.z)).color(gC2).normal(entry, normal).lineWidth(lineW * 3.5f);
                }

                ci += 180;
            }

            idx++;
        }

        if (glow.isValue()) {
            immediate.draw();
        }
    }

    private Color stateColor(int index, float alphaPC) {
        Color base = switch (colorMode.getSelected()) {
            case "Rainbow" -> {
                float hue = ((System.currentTimeMillis() / 20f + index * 2f) % 360f) / 360f;
                yield Color.getHSBColor(hue, 1f, 1f);
            }
            case "Single" -> new Color(ColorUtil.getMainGuiColor());
            default -> new Color(ColorUtil.getMainGuiColor()); // Тема (используя резервный цвет основного графического интерфейса)
        };
        int a = Math.max(0, Math.min(255, (int)(alphaPC * 255f)));
        return new Color(base.getRed(), base.getGreen(), base.getBlue(), a);
    }

    private float calcLineWidth(Glyph g, Vec3d cam) {
        if (g.nodes.isEmpty()) return 1f;
        int[] n0 = g.nodes.get(0);
        Vec3d first = new Vec3d(n0[0], n0[1], n0[2]);
        double dst = cam.distanceTo(first);
        return 1e-4f + 3f * (float) Math.max(0, Math.min(1, 1.0 - dst / 20.0));
    }

    private int[] spawnPosInts() {
        double fov = mc.options.getFov().getValue();
        double yaw = Math.toRadians(rand.nextInt(
                (int)(mc.player.getYaw() - fov * 0.75),
                (int)(mc.player.getYaw() + fov * 0.75)));
        double dst = rand.nextInt(6, 24);
        int dx = (int)(-(Math.sin(yaw) * dst));
        int dy = rand.nextInt(0, 12);
        int dz = (int)(Math.cos(yaw) * dst);
        Vec3d eye = mc.player.getEyePos();
        return new int[]{(int)eye.x + dx, (int)eye.y + dy, (int)eye.z + dz};
    }

    private int[] spawnPos() { return spawnPosInts(); }

    private int[] randXY() {
        return new int[]{rand.nextInt(0, 4) * 90, rand.nextInt(-1, 2) * 90};
    }

    private int[] nextDir(int[] prev) {
        int a = prev[0], b = prev[1];
        int nb = b;
        for (int i = 150; i > 0 && Math.abs(nb - b) != 90; i--) nb = rand.nextInt(-2, 2) * 90;
        int a = a;
        for (int i = 5; i > 0 && Math.abs(na - a) != 90; i--) na = rand.nextInt(0, 4) * 90;
        return new int[]{na, nb};
    }

    private int[] step(int[] pos, int[] dir, int r) {
        double yaw = Math.toRadians(dir[0]);
        double pitch = Math.toRadians(dir[1]);
        double r1 = r;
        int ry = (int)(Math.sin(pitch) * r1);
        если (pitch != 0) r1 = 0;
        int rx = (int)(-(Math.sin(yaw) * r1));
        int rz = (int)(Math.cos(yaw) * r1);
        return new int[]{pos[0] + rx, pos[1] + ry, pos[2] + rz};
    }

    private class Glyph {
        final List<int[]> nodes = new ArrayList<>();
        private int[] dir;
        private int stepsLeft;
        private int ticksLeft;
        private int lastSet;
        private boolean dying = false;
        private final Animation anim = new Decelerate();

        Glyph(int[] spawn, int steps) {
            nodes.add(spawn);
            dir = randXY();
            stepsLeft = steps;
            animation.setValue(1.0);
            anim.setMs(600);
            anim.setDirection(Direction.FORWARD);
            anim.reset();
        }

        void tick() {
            if (stepsLeft == 0) {
                если (!умирает) {
                    умирание = правда;
                    anim.setMs(400);
                    anim.setDirection(Direction.BACKWARDS);
                    anim.reset();
                }
                возвращаться;
            }
            if (ticksLeft > 0) {
                ticksLeft -= slow.isValue() ? 1 : 2;
                if (ticksLeft < 0) ticksLeft = 0;
                возвращаться;
            }
            dir = nextDir(dir);
            lastSet = ticksLeft = rand.nextInt(0, 3);
            nodes.add(step(nodes.get(nodes.size() - 1), dir, Math.max(1, ticksLeft)));
            шаги влево--;
        }

        float alpha() { return (float) anim.getOutput().doubleValue(); }

        boolean isDead() {
            return stepsLeft == 0 && anim.getOutput() < 0.01 && anim.isFinished(Direction.BACKWARDS);
        }

        List<Vec3d> getPoints(float pt) {
            List<Vec3d> out = new ArrayList<>();
            for (int i = 0; i < nodes.size(); i++) {
                int[] n = nodes.get(i);
                double x = n[0], y = n[1], z = n[2];
                if (i == nodes.size() - 1 && nodes.size() >= 2) {
                    int[] prev = nodes.get(i - 1);
                    float adv = lastSet > 0 ? Math.max(0, Math.min(1, 1f - (float) ticksLeft / lastSet)) : 1f;
                    x = lerp(prev[0], x, adv);
                    y = lerp(prev[1], y, adv);
                    z = lerp(prev[2], z, adv);
                }
                out.add(new Vec3d(x, y, z));
            }
            вернуться наружу;
        }

        private double lerp(double a, double b, float t) { return a + (b - a) * t; }
    }
}
[/КОД]
да блять, сколько эту функцию выкладывают уже...
 
бразер, что это?
ы:
Expand Collapse Copy
        void tick() {
            if (stepsLeft == 0) {
                если (!умирает) {
                    умирание = правда;
                    anim.setMs(400);
                    anim.setDirection(Direction.BACKWARDS);
                    anim.reset();
                }
                возвращаться;
            }
            if (ticksLeft > 0) {
                ticksLeft -= slow.isValue() ? 1 : 2;
                if (ticksLeft < 0) ticksLeft = 0;
                возвращаться;
            }
            dir = nextDir(dir);
            lastSet = ticksLeft = rand.nextInt(0, 3);
            nodes.add(step(nodes.get(nodes.size() - 1), dir, Math.max(1, ticksLeft)));
            шаги влево--;
        }
 
void tick() { if (stepsLeft == 0) { если (!умирает) { умирание = правда; anim.setMs(400); anim.setDirection(Direction.BACKWARDS); anim.reset(); } возвращаться; } if (ticksLeft > 0) { ticksLeft -= slow.isValue() ? 1 : 2; if (ticksLeft < 0) ticksLeft = 0; возвращаться; }

я в чистилище попал?
 
Назад
Сверху Снизу