- Статус
 - Оффлайн
 
- Регистрация
 - 29 Дек 2023
 
- Сообщения
 - 137
 
- Реакции
 - 1
 
		Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
	
Я решил повторить что-то по типу вилда, но сделал по своему. Тут звезды появляются за игроком только во время движения. Ток не оскорбляйте я ж пытался))
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
				
			
	Пожалуйста, авторизуйтесь для просмотра ссылки.
	Пожалуйста, авторизуйтесь для просмотра ссылки.
			
				Java:
			
		
		
		package dev.rarchik.modules.impl.render;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d;
import dev.rarchik.modules.Function;
import dev.rarchik.modules.FunctionAnnotation;
import dev.rarchik.modules.settings.imp.SliderSetting;
import dev.rarchik.util.IMinecraft;
import dev.rarchik.util.math.MathUtil;
import dev.rarchik.render.ProjectionUtils;
import dev.rarchik.render.RenderUtil;
import dev.rarchik.world.WorldUtil;
import org.joml.Vector2d;
import wtf.build.events.Event;
import dev.rarchik.events.impl.player.EventMotion;
import dev.rarchik.events.impl.render.EventRender;
import dev.rarchik.modules.Type;
import dev.rarchik.util.render.ColorUtil;
import dev.rarchik.util.render.animation.AnimationMath;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ThreadLocalRandom;
@FunctionAnnotation(name = "Trails 2", type = Type.Render)
public class Snow extends Function {
    private SliderSetting maxPoints = new SliderSetting("Сила", 200, 100, 200, 50);
    public Snow() {
        this.addSettings(maxPoints);
    }
    CopyOnWriteArrayList<Snow.Point> points = new CopyOnWriteArrayList<>();
    @Override
    public void onEvent(final Event event) {
        if (IMinecraft.mc.world == null || IMinecraft.mc.player == null) return;
        if (event instanceof EventMotion e) {
            Vector3d previousPos = new Vector3d(IMinecraft.mc.player.prevPosX, IMinecraft.mc.player.prevPosY, IMinecraft.mc.player.prevPosZ);
            Vector3d currentPos = new Vector3d(IMinecraft.mc.player.getPosX(), IMinecraft.mc.player.getPosY(), IMinecraft.mc.player.getPosZ());
            if (!previousPos.equals(currentPos)) {
                if (IMinecraft.mc.player.ticksExisted % 6 == 0) {
                    createPoints(currentPos);
                }
            }
        }
        if (event instanceof EventRender e) {
            if (points.size() > maxPoints.getValue().floatValue()) {
                points.remove(0);
            }
            for (Snow.Point point : points) {
                long alive = (System.currentTimeMillis() - point.createdTime);
                if (alive > point.aliveTime || !IMinecraft.mc.player.canVectorBeSeenFixed(point.position)) {
                    points.remove(point);
                    continue;
                }
                Vector2d pos = ProjectionUtils.project(point.position.x, point.position.y, point.position.z);
                if (pos != null) {
                    point.update();
                    RenderUtil.Render2D.drawImage(new ResourceLocation("tense/images/star.png"), (float) pos.x, (float) pos.y, 20, 20, ColorUtil.getColorStyle(points.indexOf(point)));
                }
            }
        }
    }
    private void createPoints(Vector3d position) {
        int numberOfStars = 40; // колва
        for (int i = 0; i < numberOfStars; i++) {
        
            Vector3d randomizedPosition = new Vector3d(
                    position.x + MathUtil.randomizeFloat(-0.5f, 0.5f),
                    position.y + MathUtil.randomizeFloat(0.0f, 2.0f), 
                    position.z + MathUtil.randomizeFloat(-0.5f, 0.5f)
            );
            points.add(new Point(randomizedPosition));
        }
    }
    public final class Point {
        public Vector3d position;
        public Vector3d motion;
        public Vector3d animatedMotion;
        public long aliveTime;
        public float size;
        public long createdTime = System.currentTimeMillis();
        public Point(Vector3d position) {
            this.position = new Vector3d(position.x, position.y, position.z);
            this.motion = new Vector3d(MathUtil.randomizeFloat(0.0f, 0.0f), 0, MathUtil.randomizeFloat(0.0f, 0.0f));
            this.animatedMotion = new Vector3d(0, 0, 0);
            size = MathUtil.randomizeFloat(3, 7);
            aliveTime = ThreadLocalRandom.current().nextLong(1000, 3000);
        }
        public void update() {
            if (isGround()) {
                points.remove(points);
            } else {
                motion.y = MathUtil.randomizeFloat(-0.01f, 0.01f);
                motion.y *= 1;
                motion.x *= 1.001;
                motion.z *= 1.001;
            }
            animatedMotion.x = AnimationMath.fast((float) animatedMotion.x, (float) (motion.x), 1);
            animatedMotion.y = AnimationMath.fast((float) animatedMotion.y, (float) (motion.y), 1);
            animatedMotion.z = AnimationMath.fast((float) animatedMotion.z, (float) (motion.z), 1);
            position = position.add(animatedMotion);
        }
        boolean isGround() {
            Vector3d position = this.position.add(animatedMotion);
            AxisAlignedBB bb = new AxisAlignedBB(position.x - 0.1, position.y - 0.3, position.z - 0.1, position.x + 0.1, position.y + 0.3, position.z + 0.1);
            return WorldUtil.TotemUtil.getSphere(new BlockPos(position), 1, 2, false, true, 0)
                    .stream()
                    .anyMatch(blockPos -> !IMinecraft.mc.world.getBlockState(blockPos).isAir() &&
                            bb.intersects(new AxisAlignedBB(blockPos)) &&
                            AxisAlignedBB.calcSideHit(new AxisAlignedBB(blockPos.add(0, 0, 0)), position, new double[]{
                                    2D
                            }, null, 0.1f, 0.1f, 0.1f) == Direction.UP);
        }
    }
}
	
			
				Последнее редактирование: 
			
		
	
								
								
									
	
								
							
							
				
 люди очнитесь, ради чего вам этот отвратный мусор?