Начинающий
			
			
				
					
				
			
		- Статус
- Оффлайн
- Регистрация
- 17 Апр 2025
- Сообщения
- 50
- Реакции
- 0
- Выберите загрузчик игры
- Прочие моды
 
Я вам тупо все из базы своей сливаю:grimacing:
короче, дефолтные экспешные партиклы, но с годной оптимизацией
Теперь партиклы спавняться только в радиусе вашей видемости, а не по всей части, но выглядит не парашно, сразу при повороте они респавняться
а если включено количество больше чем минимальные 100, то сначала спавняться только часть, но если вы продолжаете смотреть в ту сторону то они спавняться все
ЗНАЮ пишеться за несколько минут, но экономлю ваше время
плюс я его минут 20 делал, для хорошего рендеринга
немного чата гпт
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
а и у кого есть партиклы, типо которые работают при стрельбе из лука, при перки и тд, кто может дать, отпишите в лс
				
			короче, дефолтные экспешные партиклы, но с годной оптимизацией
Теперь партиклы спавняться только в радиусе вашей видемости, а не по всей части, но выглядит не парашно, сразу при повороте они респавняться
а если включено количество больше чем минимальные 100, то сначала спавняться только часть, но если вы продолжаете смотреть в ту сторону то они спавняться все
	Пожалуйста, авторизуйтесь для просмотра ссылки.
 (no ad)ЗНАЮ пишеться за несколько минут, но экономлю ваше время
плюс я его минут 20 делал, для хорошего рендеринга
немного чата гпт
			
				Код:
			
		
		
		public class Snow extends Function {
    private final ModeSetting fallModeSetting = new ModeSetting("Режим", "Простой", "Простой", "Отскоки");
    public static final ModeSetting setting = new ModeSetting("Вид", "Бубенцы", "Бубенцы", "Звездочки", "Сердечки", "Доллары", "Молнии");
    public final SliderSetting size = new SliderSetting("Количество", 350f, 100f, 5000f, 50f);
    private final MatrixStack matrixStack = new MatrixStack();
    private final CopyOnWriteArrayList<ParticleBase> particles = new CopyOnWriteArrayList<>();
    private float dynamicSpeed = fallModeSetting.is("Отскоки") ? 0.2f : 0.6f; 
    public Snow() {
        addSettings(fallModeSetting, setting, size);
    }
    private boolean isInView(Vector3d pos) {
        frustum.setCameraPosition(mc.getRenderManager().info.getProjectedView().x,
                mc.getRenderManager().info.getProjectedView().y,
                mc.getRenderManager().info.getProjectedView().z);
        return frustum.isBoundingBoxInFrustum(new AxisAlignedBB(pos.add(-0.2, -0.2, -0.2), pos.add(0.2, 0.2, 0.2)));
    }
    @Subscribe
    private void onUpdate(EventUpdate e) {
        particles.removeIf(ParticleBase::tick);
        if (mc.currentScreen instanceof IngameMenuScreen) return;
        for (int n = particles.size(); n < size.get(); ++n) {
            float randomX = MathUtil.random(-48.0F, 48.0F);
            float randomY = MathUtil.random(-20.0F, 48.0F);
            float randomZ = MathUtil.random(-48.0F, 48.0F);
            float motionX = MathUtil.random(-dynamicSpeed, dynamicSpeed);
            float motionY = MathUtil.random(-0.1F, 0.1F);
            float motionZ = MathUtil.random(-dynamicSpeed, dynamicSpeed);
            Vector3d particlePos = new Vector3d(
                    mc.player.getPosX() + randomX,
                    mc.player.getPosY() + randomY,
                    mc.player.getPosZ() + randomZ
            );
            if (isInView(particlePos)) {
                particles.add(new ParticleBase(
                        (float) particlePos.x,
                        (float) particlePos.y,
                        (float) particlePos.z,
                        motionX, motionY, motionZ
                ));
            }
        }
        particles.removeIf(particleBase -> System.currentTimeMillis() - particleBase.time > 5000);
    }
    @Subscribe
    private void onRender(WorldEvent e) {
        render(matrixStack);
    }
    public void render(MatrixStack matrixStack) {
        if (mc.currentScreen instanceof IngameMenuScreen) return;
        matrixStack.push();
        RenderSystem.enableBlend();
        RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
        RenderSystem.enableDepthTest();
        RenderSystem.depthMask(false);
        BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
        bufferBuilder.begin(7, DefaultVertexFormats.POSITION_COLOR_TEX_LIGHTMAP);
        particles.stream()
                .filter(particleBase -> isInView(new Vector3d(particleBase.posX, particleBase.posY, particleBase.posZ)))
                .forEach(particleBase -> particleBase.render(bufferBuilder));
        bufferBuilder.finishDrawing();
        WorldVertexBufferUploader.draw(bufferBuilder);
        RenderSystem.depthMask(true);
        RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
        RenderSystem.disableDepthTest();
        RenderSystem.disableBlend();
        matrixStack.pop();
    }
    private class ParticleBase {
        public long time;
        protected float prevposX, prevposY, prevposZ;
        protected float posX, posY, posZ;
        protected float motionX, motionY, motionZ;
        protected int age, maxAge;
        private float alpha;
        private long collisionTime = -1L;
        public ParticleBase(float x, float y, float z, float motionX, float motionY, float motionZ) {
            this.posX = x;
            this.posY = y;
            this.posZ = z;
            this.prevposX = x;
            this.prevposY = y;
            this.prevposZ = z;
            this.motionX = motionX;
            this.motionY = motionY;
            this.motionZ = motionZ;
            this.time = System.currentTimeMillis();
            this.maxAge = this.age = (int) MathUtil.random(120, 200);
        }
        public void update() {
            alpha = MathUtil.fast(alpha, 1, 10);
            if (fallModeSetting.is("Отскоки")) updateWithBounce();
        }
        public boolean tick() {
            this.age = mc.player.getDistanceSq(this.posX, this.posY, this.posZ) > 4096.0 ? (this.age -= 8) : --this.age;
            if (this.age < 0) {
                return true;
            } else {
                this.prevposX = this.posX;
                this.prevposY = this.posY;
                this.prevposZ = this.posZ;
                this.posX += this.motionX;
                this.posY += this.motionY;
                this.posZ += this.motionZ;
                if (!fallModeSetting.is("Отскоки")) {
                    this.motionX *= 0.9F;
                    this.motionY *= 0.9F;
                    this.motionZ *= 0.9F;
                    this.motionY -= 0.001F;
                } else {
                    this.motionX = 0;
                    this.motionZ = 0;
                }
                return false;
            }
        }
        private void updateWithBounce() {
            if (this.collisionTime != -1L) {
                long timeSinceCollision = System.currentTimeMillis() - this.collisionTime;
                this.alpha = Math.max(0.0f, 1.0f - (float) timeSinceCollision / 3000.0f);
            }
            this.motionY -= 8.0E-4;
            float newPosX = this.posX + this.motionX;
            float newPosY = this.posY + this.motionY;
            float newPosZ = this.posZ + this.motionZ;
            BlockPos particlePos = new BlockPos(newPosX, newPosY, newPosZ);
            BlockState blockState = mc.world.getBlockState(particlePos);
            if (!blockState.isAir()) {
                if (this.collisionTime == -1L) {
                    this.collisionTime = System.currentTimeMillis();
                }
                if (!mc.world.getBlockState(new BlockPos(this.posX + this.motionX, this.posY, this.posZ)).isAir()) {
                    this.motionX = 0.0f;
                }
                if (!mc.world.getBlockState(new BlockPos(this.posX, this.posY + this.motionY, this.posZ)).isAir()) {
                    this.motionY = -this.motionY * 0.8f;
                }
                if (!mc.world.getBlockState(new BlockPos(this.posX, this.posY, this.posZ + this.motionZ)).isAir()) {
                    this.motionZ = 0.0f;
                }
                this.posX += this.motionX;
                this.posY += this.motionY;
                this.posZ += this.motionZ;
            } else {
                this.posX = newPosX;
                this.posY = newPosY;
                this.posZ = newPosZ;
            }
        }
        public void render(BufferBuilder bufferBuilder) {
            ResourceLocation texture;
            if (setting.is("Бубенцы")) {
                texture = new ResourceLocation("Akven/images/glow.png");
            } else if (setting.is("Звездочки")) {
                texture = new ResourceLocation("Akven/images/star.png");
            } else if (setting.is("Сердечки")) {
                texture = new ResourceLocation("Akven/images/heart.png");
            } else if (setting.is("Доллары")) {
                texture = new ResourceLocation("Akven/images/dollar.png");
            } else {
                texture = new ResourceLocation("Akven/images/lightning.png");
            }
            mc.getTextureManager().bindTexture(texture);
            float size = 1 - ((System.currentTimeMillis() - time) / 5000f);
            update();
            ActiveRenderInfo camera = mc.gameRenderer.getActiveRenderInfo();
            int color = ColorUtils.setAlpha(ColorUtils.getColor(age * 2), (int) ((alpha * 255) * size));
            Vector3d pos = MathUtil.interpolatePos(prevposX, prevposY, prevposZ, posX, posY, posZ);
            MatrixStack matrices = new MatrixStack();
            matrices.translate(pos.x, pos.y, pos.z);
            matrices.rotate(Vector3f.YP.rotationDegrees(-camera.getYaw()));
            matrices.rotate(Vector3f.XP.rotationDegrees(camera.getPitch()));
            Matrix4f matrix = matrices.getLast().getMatrix();
            bufferBuilder.pos(matrix, 0, -0.9f * size, 0).color(color).tex(0, 1).lightmap(0, 240).endVertex();
            bufferBuilder.pos(matrix, -0.9f * size, -0.9f * size, 0).color(color).tex(1, 1).lightmap(0, 240).endVertex();
            bufferBuilder.pos(matrix, -0.9f * size, 0, 0).color(color).tex(1, 0).lightmap(0, 240).endVertex();
            bufferBuilder.pos(matrix, 0, 0, 0).color(color).tex(0, 0).lightmap(0, 240).endVertex();
        }
    }
} 
				 
	 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		