• Я зарабатываю 100 000 RUB / месяц на этом сайте!

    А знаешь как? Я всего-лишь публикую (создаю темы), а админ мне платит. Трачу деньги на мороженое, робуксы и сервера в Minecraft. А ещё на паль из Китая. 

    Хочешь так же? Пиши и узнавай условия: https://t.me/alex_redact
    Реклама: https://t.me/yougame_official

Визуальная часть Snow Eva/Exp 3.1

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
14 Янв 2025
Сообщения
257
Реакции
0
Выберите загрузчик игры
  1. Прочие моды
Snow:
Expand Collapse Copy
package alpha.night.modules.impl.render;

import alpha.night.NightDLS;
import alpha.night.events.DEngineEvent;
import alpha.night.events.EventChangeWorld;
import alpha.night.modules.settings.impl.BooleanSetting;
import alpha.night.utils.animations.easing.CompactAnimation;
import alpha.night.utils.animations.easing.Easing;
import alpha.night.utils.client.TimerUtility;
import alpha.night.utils.player.BlockUtils;
import alpha.night.utils.render.RectUtility;
import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import alpha.night.modules.api.Category;
import alpha.night.modules.api.Module;
import alpha.night.modules.api.ModuleRegister;
import alpha.night.modules.settings.impl.ModeSetting;
import alpha.night.modules.settings.impl.SliderSetting;

import alpha.night.utils.math.MathUtil;
import alpha.night.utils.render.color.ColorUtils;
import lombok.Getter;
import net.minecraft.block.*;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import org.joml.Math;
import org.joml.Vector3d;
import org.lwjgl.opengl.GL11;

import java.util.ArrayList;
import java.util.List;

@ModuleRegister(name = "Snow", category = Category.Render, desc = "Спавнит партиклы в мире")
public class Snow extends Module {
    private final List<FireFlyEntity> particles = new ArrayList<>();
    private final ModeSetting fallModeSetting = new ModeSetting("Режим", "Простой", "Простой", "Взлет");
    private final SliderSetting count = new SliderSetting("Количество", 100, 10, 1000, 10);
    public final BooleanSetting randomColor = new BooleanSetting("Рандомный цвет", false);
    private final ResourceLocation texture = new ResourceLocation("alphanight/images/firefly.png");

    public Snow() {
        addSettings(fallModeSetting, count, randomColor);
    }

    [USER=1367676]@override[/USER]
    public boolean onEnable() {
        super.onEnable();
        particles.clear();
        spawnParticle(mc.player);
        return false;
    }

    [USER=1367676]@override[/USER]
    public void onDisable() {
        super.onDisable();
        particles.clear();
    }

    private void spawnParticle(LivingEntity entity) {
        double distance = MathUtil.random(5, 50), yawRad = org.joml.Math.toRadians(MathUtil.random(0, 360)), xOffset = -org.joml.Math.sin(yawRad) * distance, zOffset = org.joml.Math.cos(yawRad) * distance;

        particles.add(new FireFlyEntity(new org.joml.Vector3d(entity.getPosX() + xOffset, entity.getPosY() + (fallModeSetting.is("Взлет") ? MathUtil.random(-5, 0) : MathUtil.random(3, 15)), entity.getPosZ() + zOffset),
                new org.joml.Vector3d(), particles.size(), ColorUtils.random(particles.size()).hashCode()));
    }

    [USER=1474073]@Subscribe[/USER]
    public void onChange(EventChangeWorld e) {
        particles.clear();
    }

    [USER=1474073]@Subscribe[/USER]
    public void onRender(DEngineEvent event) {
        ClientPlayerEntity player = mc.player;

        particles.removeIf(particle ->
                particle.time.isReached(5000) ||
                        particle.position.distance(player.getPosX(), player.getPosY(), player.getPosZ()) >= 60
        );
       
        if (particles.size() <= count.get().intValue()) {
            spawnParticle(player);
        }

        MatrixStack matrix = event.getMatrix();
        boolean lightEnabled = GL11.glIsEnabled(GL11.GL_LIGHTING);

        RenderSystem.pushMatrix();
        matrix.push();
        RenderSystem.enableBlend();
        RenderSystem.disableAlphaTest();
        RenderSystem.depthMask(false);
        RenderSystem.disableCull();

        if (lightEnabled) {
            RenderSystem.disableLighting();
        }

        GL11.glShadeModel(GL11.GL_SMOOTH);
        RenderSystem.blendFuncSeparate(
                GlStateManager.SourceFactor.SRC_ALPHA,
                GlStateManager.DestFactor.ONE,
                GlStateManager.SourceFactor.ONE,
                GlStateManager.DestFactor.ZERO
        );

        RectUtility.bindTexture(texture);

        if (!particles.isEmpty()) {
            particles.forEach(fireFlyEntity -> fireFlyEntity.update(true));

            float pos = 0.2F;
            for (FireFlyEntity particle : particles) {
                updateParticleAlpha(particle);

                int alpha = (int) org.joml.Math.clamp(0, (int) (particle.getAlpha().getValue()), particle.getAngle());
                int colorGlow = randomColor.get() ?
                        ColorUtils.reAlphaInt(particle.getColor(), alpha) :
                        ColorUtils.reAlphaInt(ColorUtils.getColor(particle.index * 99), alpha);

                renderParticle(matrix, particle, pos, alpha, colorGlow);
            }
        }

        cleanupRenderState(lightEnabled, matrix);
    }

    private void updateParticleAlpha(FireFlyEntity particle) {
        if ((int) particle.getAlpha().getValue() != 255 && !particle.time.isReached(particle.alpha.getDuration())) {
            particle.getAlpha().run(255);
        }
        if ((int) particle.getAlpha().getValue() != 0 && particle.time.isReached(5000 - particle.alpha.getDuration())) {
            particle.getAlpha().run(0);
        }
    }

    private void renderParticle(MatrixStack matrix, FireFlyEntity particle, float pos, int alpha, int colorGlow) {
        final org.joml.Vector3d vec = particle.getPosition();
        matrix.push();
        RectUtility.setupOrientationMatrix(matrix, (float) vec.x, (float) vec.y, (float) vec.z);
        matrix.rotate(mc.getRenderManager().getCameraOrientation());
        matrix.translate(0, pos / 2F, 0);

        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
        RectUtility.drawRect(matrix, -pos, -pos, pos, pos, colorGlow, colorGlow, colorGlow, colorGlow, true, true);

        float size = pos / 2F;
        int color = ColorUtils.reAlphaInt(-1, alpha);
        RectUtility.drawRect(matrix, -size, -size, size, size, color, color, color, color, true, true);

        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        matrix.pop();
    }

    private void cleanupRenderState(boolean lightEnabled, MatrixStack matrix) {
        RenderSystem.blendFuncSeparate(
                GlStateManager.SourceFactor.SRC_ALPHA,
                GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA,
                GlStateManager.SourceFactor.ONE,
                GlStateManager.DestFactor.ZERO
        );

        GlStateManager.clearCurrentColor();
        GL11.glShadeModel(GL11.GL_FLAT);

        if (lightEnabled) {
            RenderSystem.enableLighting();
        }

        RenderSystem.enableCull();
        RenderSystem.depthMask(true);
        RenderSystem.enableAlphaTest();
        matrix.pop();
        RenderSystem.popMatrix();
    }


    [USER=270918]@Getter[/USER]
    private static class FireFlyEntity {
        private final int index;
        private final TimerUtility time = new TimerUtility();
        private final CompactAnimation alpha = new CompactAnimation(Easing.LINEAR, 150);
        private final int color;

        public final org.joml.Vector3d position;
        private final org.joml.Vector3d delta;

        public FireFlyEntity(final org.joml.Vector3d position, final org.joml.Vector3d velocity, final int index, int color) {
            this.position = position;
            this.delta = new Vector3d(velocity.x, velocity.y, velocity.z);
            this.index = index;
            this.color = color;
            this.time.reset();
        }

        public void update(boolean physics) {
            if (physics) {
                final Block block1 = BlockUtils.getBlock(this.position.x, this.position.y, this.position.z + this.delta.z);
                if (isValidBlock(block1))
                    this.delta.z *= -0.8;

                final Block block2 = BlockUtils.getBlock(this.position.x, this.position.y + this.delta.y, this.position.z);
                if (isValidBlock(block2)) {
                    this.delta.x *= 0.999F;
                    this.delta.z *= 0.999F;
                    this.delta.y *= -0.7;
                }

                final Block block3 = BlockUtils.getBlock(this.position.x + this.delta.x, this.position.y, this.position.z);
                if (isValidBlock(block3))
                    this.delta.x *= -0.8;
            }

            this.updateMotion();
        }

        private boolean isValidBlock(Block block) {
            return !(block instanceof AirBlock)
                    && !(block instanceof BushBlock)
                    && !(block instanceof AbstractButtonBlock)
                    && !(block instanceof TorchBlock)
                    && !(block instanceof LeverBlock)
                    && !(block instanceof AbstractPressurePlateBlock)
                    && !(block instanceof CarpetBlock)
                    && !(block instanceof FlowingFluidBlock);
        }

        public int getAngle() {
            return (int) org.joml.Math.clamp(0, 255, ((org.joml.Math.sin(time.getTime() / 250D) + 1F) / 2F) * 255);
        }

        public void updateMotion() {
            double motion = 0.002;
            this.delta.x += (org.joml.Math.random() - 0.5) * motion;
            this.delta.y += (org.joml.Math.random() - 0.5) * motion * 0.5;

            if (!NightDLS.getInstance().getModuleManager().getSnow().fallModeSetting.is("Простой")) {
                this.delta.y = 0.03;
            }

            this.delta.z += (Math.random() - 0.5) * motion;

            double maxSpeed = 0.3;
            this.delta.x = MathHelper.clamp(this.delta.x, -maxSpeed, maxSpeed);
            this.delta.y = MathHelper.clamp(this.delta.y, -maxSpeed, maxSpeed);
            this.delta.z = MathHelper.clamp(this.delta.z, -maxSpeed, maxSpeed);

            this.position.x += this.delta.x;
            this.position.y += this.delta.y;
            this.position.z += this.delta.z;
        }
    }
}
Пожалуйста, авторизуйтесь для просмотра ссылки.
 
Snow:
Expand Collapse Copy
package alpha.night.modules.impl.render;

import alpha.night.NightDLS;
import alpha.night.events.DEngineEvent;
import alpha.night.events.EventChangeWorld;
import alpha.night.modules.settings.impl.BooleanSetting;
import alpha.night.utils.animations.easing.CompactAnimation;
import alpha.night.utils.animations.easing.Easing;
import alpha.night.utils.client.TimerUtility;
import alpha.night.utils.player.BlockUtils;
import alpha.night.utils.render.RectUtility;
import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import alpha.night.modules.api.Category;
import alpha.night.modules.api.Module;
import alpha.night.modules.api.ModuleRegister;
import alpha.night.modules.settings.impl.ModeSetting;
import alpha.night.modules.settings.impl.SliderSetting;

import alpha.night.utils.math.MathUtil;
import alpha.night.utils.render.color.ColorUtils;
import lombok.Getter;
import net.minecraft.block.*;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import org.joml.Math;
import org.joml.Vector3d;
import org.lwjgl.opengl.GL11;

import java.util.ArrayList;
import java.util.List;

@ModuleRegister(name = "Snow", category = Category.Render, desc = "Спавнит партиклы в мире")
public class Snow extends Module {
    private final List<FireFlyEntity> particles = new ArrayList<>();
    private final ModeSetting fallModeSetting = new ModeSetting("Режим", "Простой", "Простой", "Взлет");
    private final SliderSetting count = new SliderSetting("Количество", 100, 10, 1000, 10);
    public final BooleanSetting randomColor = new BooleanSetting("Рандомный цвет", false);
    private final ResourceLocation texture = new ResourceLocation("alphanight/images/firefly.png");

    public Snow() {
        addSettings(fallModeSetting, count, randomColor);
    }

    [USER=1367676]@override[/USER]
    public boolean onEnable() {
        super.onEnable();
        particles.clear();
        spawnParticle(mc.player);
        return false;
    }

    [USER=1367676]@override[/USER]
    public void onDisable() {
        super.onDisable();
        particles.clear();
    }

    private void spawnParticle(LivingEntity entity) {
        double distance = MathUtil.random(5, 50), yawRad = org.joml.Math.toRadians(MathUtil.random(0, 360)), xOffset = -org.joml.Math.sin(yawRad) * distance, zOffset = org.joml.Math.cos(yawRad) * distance;

        particles.add(new FireFlyEntity(new org.joml.Vector3d(entity.getPosX() + xOffset, entity.getPosY() + (fallModeSetting.is("Взлет") ? MathUtil.random(-5, 0) : MathUtil.random(3, 15)), entity.getPosZ() + zOffset),
                new org.joml.Vector3d(), particles.size(), ColorUtils.random(particles.size()).hashCode()));
    }

    [USER=1474073]@Subscribe[/USER]
    public void onChange(EventChangeWorld e) {
        particles.clear();
    }

    [USER=1474073]@Subscribe[/USER]
    public void onRender(DEngineEvent event) {
        ClientPlayerEntity player = mc.player;

        particles.removeIf(particle ->
                particle.time.isReached(5000) ||
                        particle.position.distance(player.getPosX(), player.getPosY(), player.getPosZ()) >= 60
        );
      
        if (particles.size() <= count.get().intValue()) {
            spawnParticle(player);
        }

        MatrixStack matrix = event.getMatrix();
        boolean lightEnabled = GL11.glIsEnabled(GL11.GL_LIGHTING);

        RenderSystem.pushMatrix();
        matrix.push();
        RenderSystem.enableBlend();
        RenderSystem.disableAlphaTest();
        RenderSystem.depthMask(false);
        RenderSystem.disableCull();

        if (lightEnabled) {
            RenderSystem.disableLighting();
        }

        GL11.glShadeModel(GL11.GL_SMOOTH);
        RenderSystem.blendFuncSeparate(
                GlStateManager.SourceFactor.SRC_ALPHA,
                GlStateManager.DestFactor.ONE,
                GlStateManager.SourceFactor.ONE,
                GlStateManager.DestFactor.ZERO
        );

        RectUtility.bindTexture(texture);

        if (!particles.isEmpty()) {
            particles.forEach(fireFlyEntity -> fireFlyEntity.update(true));

            float pos = 0.2F;
            for (FireFlyEntity particle : particles) {
                updateParticleAlpha(particle);

                int alpha = (int) org.joml.Math.clamp(0, (int) (particle.getAlpha().getValue()), particle.getAngle());
                int colorGlow = randomColor.get() ?
                        ColorUtils.reAlphaInt(particle.getColor(), alpha) :
                        ColorUtils.reAlphaInt(ColorUtils.getColor(particle.index * 99), alpha);

                renderParticle(matrix, particle, pos, alpha, colorGlow);
            }
        }

        cleanupRenderState(lightEnabled, matrix);
    }

    private void updateParticleAlpha(FireFlyEntity particle) {
        if ((int) particle.getAlpha().getValue() != 255 && !particle.time.isReached(particle.alpha.getDuration())) {
            particle.getAlpha().run(255);
        }
        if ((int) particle.getAlpha().getValue() != 0 && particle.time.isReached(5000 - particle.alpha.getDuration())) {
            particle.getAlpha().run(0);
        }
    }

    private void renderParticle(MatrixStack matrix, FireFlyEntity particle, float pos, int alpha, int colorGlow) {
        final org.joml.Vector3d vec = particle.getPosition();
        matrix.push();
        RectUtility.setupOrientationMatrix(matrix, (float) vec.x, (float) vec.y, (float) vec.z);
        matrix.rotate(mc.getRenderManager().getCameraOrientation());
        matrix.translate(0, pos / 2F, 0);

        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
        RectUtility.drawRect(matrix, -pos, -pos, pos, pos, colorGlow, colorGlow, colorGlow, colorGlow, true, true);

        float size = pos / 2F;
        int color = ColorUtils.reAlphaInt(-1, alpha);
        RectUtility.drawRect(matrix, -size, -size, size, size, color, color, color, color, true, true);

        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        matrix.pop();
    }

    private void cleanupRenderState(boolean lightEnabled, MatrixStack matrix) {
        RenderSystem.blendFuncSeparate(
                GlStateManager.SourceFactor.SRC_ALPHA,
                GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA,
                GlStateManager.SourceFactor.ONE,
                GlStateManager.DestFactor.ZERO
        );

        GlStateManager.clearCurrentColor();
        GL11.glShadeModel(GL11.GL_FLAT);

        if (lightEnabled) {
            RenderSystem.enableLighting();
        }

        RenderSystem.enableCull();
        RenderSystem.depthMask(true);
        RenderSystem.enableAlphaTest();
        matrix.pop();
        RenderSystem.popMatrix();
    }


    [USER=270918]@Getter[/USER]
    private static class FireFlyEntity {
        private final int index;
        private final TimerUtility time = new TimerUtility();
        private final CompactAnimation alpha = new CompactAnimation(Easing.LINEAR, 150);
        private final int color;

        public final org.joml.Vector3d position;
        private final org.joml.Vector3d delta;

        public FireFlyEntity(final org.joml.Vector3d position, final org.joml.Vector3d velocity, final int index, int color) {
            this.position = position;
            this.delta = new Vector3d(velocity.x, velocity.y, velocity.z);
            this.index = index;
            this.color = color;
            this.time.reset();
        }

        public void update(boolean physics) {
            if (physics) {
                final Block block1 = BlockUtils.getBlock(this.position.x, this.position.y, this.position.z + this.delta.z);
                if (isValidBlock(block1))
                    this.delta.z *= -0.8;

                final Block block2 = BlockUtils.getBlock(this.position.x, this.position.y + this.delta.y, this.position.z);
                if (isValidBlock(block2)) {
                    this.delta.x *= 0.999F;
                    this.delta.z *= 0.999F;
                    this.delta.y *= -0.7;
                }

                final Block block3 = BlockUtils.getBlock(this.position.x + this.delta.x, this.position.y, this.position.z);
                if (isValidBlock(block3))
                    this.delta.x *= -0.8;
            }

            this.updateMotion();
        }

        private boolean isValidBlock(Block block) {
            return !(block instanceof AirBlock)
                    && !(block instanceof BushBlock)
                    && !(block instanceof AbstractButtonBlock)
                    && !(block instanceof TorchBlock)
                    && !(block instanceof LeverBlock)
                    && !(block instanceof AbstractPressurePlateBlock)
                    && !(block instanceof CarpetBlock)
                    && !(block instanceof FlowingFluidBlock);
        }

        public int getAngle() {
            return (int) org.joml.Math.clamp(0, 255, ((org.joml.Math.sin(time.getTime() / 250D) + 1F) / 2F) * 255);
        }

        public void updateMotion() {
            double motion = 0.002;
            this.delta.x += (org.joml.Math.random() - 0.5) * motion;
            this.delta.y += (org.joml.Math.random() - 0.5) * motion * 0.5;

            if (!NightDLS.getInstance().getModuleManager().getSnow().fallModeSetting.is("Простой")) {
                this.delta.y = 0.03;
            }

            this.delta.z += (Math.random() - 0.5) * motion;

            double maxSpeed = 0.3;
            this.delta.x = MathHelper.clamp(this.delta.x, -maxSpeed, maxSpeed);
            this.delta.y = MathHelper.clamp(this.delta.y, -maxSpeed, maxSpeed);
            this.delta.z = MathHelper.clamp(this.delta.z, -maxSpeed, maxSpeed);

            this.position.x += this.delta.x;
            this.position.y += this.delta.y;
            this.position.z += this.delta.z;
        }
    }
}
Пожалуйста, авторизуйтесь для просмотра ссылки.
прикольно
 
Snow:
Expand Collapse Copy
package alpha.night.modules.impl.render;

import alpha.night.NightDLS;
import alpha.night.events.DEngineEvent;
import alpha.night.events.EventChangeWorld;
import alpha.night.modules.settings.impl.BooleanSetting;
import alpha.night.utils.animations.easing.CompactAnimation;
import alpha.night.utils.animations.easing.Easing;
import alpha.night.utils.client.TimerUtility;
import alpha.night.utils.player.BlockUtils;
import alpha.night.utils.render.RectUtility;
import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import alpha.night.modules.api.Category;
import alpha.night.modules.api.Module;
import alpha.night.modules.api.ModuleRegister;
import alpha.night.modules.settings.impl.ModeSetting;
import alpha.night.modules.settings.impl.SliderSetting;

import alpha.night.utils.math.MathUtil;
import alpha.night.utils.render.color.ColorUtils;
import lombok.Getter;
import net.minecraft.block.*;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import org.joml.Math;
import org.joml.Vector3d;
import org.lwjgl.opengl.GL11;

import java.util.ArrayList;
import java.util.List;

@ModuleRegister(name = "Snow", category = Category.Render, desc = "Спавнит партиклы в мире")
public class Snow extends Module {
    private final List<FireFlyEntity> particles = new ArrayList<>();
    private final ModeSetting fallModeSetting = new ModeSetting("Режим", "Простой", "Простой", "Взлет");
    private final SliderSetting count = new SliderSetting("Количество", 100, 10, 1000, 10);
    public final BooleanSetting randomColor = new BooleanSetting("Рандомный цвет", false);
    private final ResourceLocation texture = new ResourceLocation("alphanight/images/firefly.png");

    public Snow() {
        addSettings(fallModeSetting, count, randomColor);
    }

    [USER=1367676]@override[/USER]
    public boolean onEnable() {
        super.onEnable();
        particles.clear();
        spawnParticle(mc.player);
        return false;
    }

    [USER=1367676]@override[/USER]
    public void onDisable() {
        super.onDisable();
        particles.clear();
    }

    private void spawnParticle(LivingEntity entity) {
        double distance = MathUtil.random(5, 50), yawRad = org.joml.Math.toRadians(MathUtil.random(0, 360)), xOffset = -org.joml.Math.sin(yawRad) * distance, zOffset = org.joml.Math.cos(yawRad) * distance;

        particles.add(new FireFlyEntity(new org.joml.Vector3d(entity.getPosX() + xOffset, entity.getPosY() + (fallModeSetting.is("Взлет") ? MathUtil.random(-5, 0) : MathUtil.random(3, 15)), entity.getPosZ() + zOffset),
                new org.joml.Vector3d(), particles.size(), ColorUtils.random(particles.size()).hashCode()));
    }

    [USER=1474073]@Subscribe[/USER]
    public void onChange(EventChangeWorld e) {
        particles.clear();
    }

    [USER=1474073]@Subscribe[/USER]
    public void onRender(DEngineEvent event) {
        ClientPlayerEntity player = mc.player;

        particles.removeIf(particle ->
                particle.time.isReached(5000) ||
                        particle.position.distance(player.getPosX(), player.getPosY(), player.getPosZ()) >= 60
        );
      
        if (particles.size() <= count.get().intValue()) {
            spawnParticle(player);
        }

        MatrixStack matrix = event.getMatrix();
        boolean lightEnabled = GL11.glIsEnabled(GL11.GL_LIGHTING);

        RenderSystem.pushMatrix();
        matrix.push();
        RenderSystem.enableBlend();
        RenderSystem.disableAlphaTest();
        RenderSystem.depthMask(false);
        RenderSystem.disableCull();

        if (lightEnabled) {
            RenderSystem.disableLighting();
        }

        GL11.glShadeModel(GL11.GL_SMOOTH);
        RenderSystem.blendFuncSeparate(
                GlStateManager.SourceFactor.SRC_ALPHA,
                GlStateManager.DestFactor.ONE,
                GlStateManager.SourceFactor.ONE,
                GlStateManager.DestFactor.ZERO
        );

        RectUtility.bindTexture(texture);

        if (!particles.isEmpty()) {
            particles.forEach(fireFlyEntity -> fireFlyEntity.update(true));

            float pos = 0.2F;
            for (FireFlyEntity particle : particles) {
                updateParticleAlpha(particle);

                int alpha = (int) org.joml.Math.clamp(0, (int) (particle.getAlpha().getValue()), particle.getAngle());
                int colorGlow = randomColor.get() ?
                        ColorUtils.reAlphaInt(particle.getColor(), alpha) :
                        ColorUtils.reAlphaInt(ColorUtils.getColor(particle.index * 99), alpha);

                renderParticle(matrix, particle, pos, alpha, colorGlow);
            }
        }

        cleanupRenderState(lightEnabled, matrix);
    }

    private void updateParticleAlpha(FireFlyEntity particle) {
        if ((int) particle.getAlpha().getValue() != 255 && !particle.time.isReached(particle.alpha.getDuration())) {
            particle.getAlpha().run(255);
        }
        if ((int) particle.getAlpha().getValue() != 0 && particle.time.isReached(5000 - particle.alpha.getDuration())) {
            particle.getAlpha().run(0);
        }
    }

    private void renderParticle(MatrixStack matrix, FireFlyEntity particle, float pos, int alpha, int colorGlow) {
        final org.joml.Vector3d vec = particle.getPosition();
        matrix.push();
        RectUtility.setupOrientationMatrix(matrix, (float) vec.x, (float) vec.y, (float) vec.z);
        matrix.rotate(mc.getRenderManager().getCameraOrientation());
        matrix.translate(0, pos / 2F, 0);

        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
        RectUtility.drawRect(matrix, -pos, -pos, pos, pos, colorGlow, colorGlow, colorGlow, colorGlow, true, true);

        float size = pos / 2F;
        int color = ColorUtils.reAlphaInt(-1, alpha);
        RectUtility.drawRect(matrix, -size, -size, size, size, color, color, color, color, true, true);

        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        matrix.pop();
    }

    private void cleanupRenderState(boolean lightEnabled, MatrixStack matrix) {
        RenderSystem.blendFuncSeparate(
                GlStateManager.SourceFactor.SRC_ALPHA,
                GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA,
                GlStateManager.SourceFactor.ONE,
                GlStateManager.DestFactor.ZERO
        );

        GlStateManager.clearCurrentColor();
        GL11.glShadeModel(GL11.GL_FLAT);

        if (lightEnabled) {
            RenderSystem.enableLighting();
        }

        RenderSystem.enableCull();
        RenderSystem.depthMask(true);
        RenderSystem.enableAlphaTest();
        matrix.pop();
        RenderSystem.popMatrix();
    }


    [USER=270918]@Getter[/USER]
    private static class FireFlyEntity {
        private final int index;
        private final TimerUtility time = new TimerUtility();
        private final CompactAnimation alpha = new CompactAnimation(Easing.LINEAR, 150);
        private final int color;

        public final org.joml.Vector3d position;
        private final org.joml.Vector3d delta;

        public FireFlyEntity(final org.joml.Vector3d position, final org.joml.Vector3d velocity, final int index, int color) {
            this.position = position;
            this.delta = new Vector3d(velocity.x, velocity.y, velocity.z);
            this.index = index;
            this.color = color;
            this.time.reset();
        }

        public void update(boolean physics) {
            if (physics) {
                final Block block1 = BlockUtils.getBlock(this.position.x, this.position.y, this.position.z + this.delta.z);
                if (isValidBlock(block1))
                    this.delta.z *= -0.8;

                final Block block2 = BlockUtils.getBlock(this.position.x, this.position.y + this.delta.y, this.position.z);
                if (isValidBlock(block2)) {
                    this.delta.x *= 0.999F;
                    this.delta.z *= 0.999F;
                    this.delta.y *= -0.7;
                }

                final Block block3 = BlockUtils.getBlock(this.position.x + this.delta.x, this.position.y, this.position.z);
                if (isValidBlock(block3))
                    this.delta.x *= -0.8;
            }

            this.updateMotion();
        }

        private boolean isValidBlock(Block block) {
            return !(block instanceof AirBlock)
                    && !(block instanceof BushBlock)
                    && !(block instanceof AbstractButtonBlock)
                    && !(block instanceof TorchBlock)
                    && !(block instanceof LeverBlock)
                    && !(block instanceof AbstractPressurePlateBlock)
                    && !(block instanceof CarpetBlock)
                    && !(block instanceof FlowingFluidBlock);
        }

        public int getAngle() {
            return (int) org.joml.Math.clamp(0, 255, ((org.joml.Math.sin(time.getTime() / 250D) + 1F) / 2F) * 255);
        }

        public void updateMotion() {
            double motion = 0.002;
            this.delta.x += (org.joml.Math.random() - 0.5) * motion;
            this.delta.y += (org.joml.Math.random() - 0.5) * motion * 0.5;

            if (!NightDLS.getInstance().getModuleManager().getSnow().fallModeSetting.is("Простой")) {
                this.delta.y = 0.03;
            }

            this.delta.z += (Math.random() - 0.5) * motion;

            double maxSpeed = 0.3;
            this.delta.x = MathHelper.clamp(this.delta.x, -maxSpeed, maxSpeed);
            this.delta.y = MathHelper.clamp(this.delta.y, -maxSpeed, maxSpeed);
            this.delta.z = MathHelper.clamp(this.delta.z, -maxSpeed, maxSpeed);

            this.position.x += this.delta.x;
            this.position.y += this.delta.y;
            this.position.z += this.delta.z;
        }
    }
}
Пожалуйста, авторизуйтесь для просмотра ссылки.
/del спащено с паст
 
че за дефолт снег с евы /del фууу паста
 
Snow:
Expand Collapse Copy
package alpha.night.modules.impl.render;

import alpha.night.NightDLS;
import alpha.night.events.DEngineEvent;
import alpha.night.events.EventChangeWorld;
import alpha.night.modules.settings.impl.BooleanSetting;
import alpha.night.utils.animations.easing.CompactAnimation;
import alpha.night.utils.animations.easing.Easing;
import alpha.night.utils.client.TimerUtility;
import alpha.night.utils.player.BlockUtils;
import alpha.night.utils.render.RectUtility;
import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import alpha.night.modules.api.Category;
import alpha.night.modules.api.Module;
import alpha.night.modules.api.ModuleRegister;
import alpha.night.modules.settings.impl.ModeSetting;
import alpha.night.modules.settings.impl.SliderSetting;

import alpha.night.utils.math.MathUtil;
import alpha.night.utils.render.color.ColorUtils;
import lombok.Getter;
import net.minecraft.block.*;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import org.joml.Math;
import org.joml.Vector3d;
import org.lwjgl.opengl.GL11;

import java.util.ArrayList;
import java.util.List;

@ModuleRegister(name = "Snow", category = Category.Render, desc = "Спавнит партиклы в мире")
public class Snow extends Module {
    private final List<FireFlyEntity> particles = new ArrayList<>();
    private final ModeSetting fallModeSetting = new ModeSetting("Режим", "Простой", "Простой", "Взлет");
    private final SliderSetting count = new SliderSetting("Количество", 100, 10, 1000, 10);
    public final BooleanSetting randomColor = new BooleanSetting("Рандомный цвет", false);
    private final ResourceLocation texture = new ResourceLocation("alphanight/images/firefly.png");

    public Snow() {
        addSettings(fallModeSetting, count, randomColor);
    }

    [USER=1367676]@override[/USER]
    public boolean onEnable() {
        super.onEnable();
        particles.clear();
        spawnParticle(mc.player);
        return false;
    }

    [USER=1367676]@override[/USER]
    public void onDisable() {
        super.onDisable();
        particles.clear();
    }

    private void spawnParticle(LivingEntity entity) {
        double distance = MathUtil.random(5, 50), yawRad = org.joml.Math.toRadians(MathUtil.random(0, 360)), xOffset = -org.joml.Math.sin(yawRad) * distance, zOffset = org.joml.Math.cos(yawRad) * distance;

        particles.add(new FireFlyEntity(new org.joml.Vector3d(entity.getPosX() + xOffset, entity.getPosY() + (fallModeSetting.is("Взлет") ? MathUtil.random(-5, 0) : MathUtil.random(3, 15)), entity.getPosZ() + zOffset),
                new org.joml.Vector3d(), particles.size(), ColorUtils.random(particles.size()).hashCode()));
    }

    [USER=1474073]@Subscribe[/USER]
    public void onChange(EventChangeWorld e) {
        particles.clear();
    }

    [USER=1474073]@Subscribe[/USER]
    public void onRender(DEngineEvent event) {
        ClientPlayerEntity player = mc.player;

        particles.removeIf(particle ->
                particle.time.isReached(5000) ||
                        particle.position.distance(player.getPosX(), player.getPosY(), player.getPosZ()) >= 60
        );
      
        if (particles.size() <= count.get().intValue()) {
            spawnParticle(player);
        }

        MatrixStack matrix = event.getMatrix();
        boolean lightEnabled = GL11.glIsEnabled(GL11.GL_LIGHTING);

        RenderSystem.pushMatrix();
        matrix.push();
        RenderSystem.enableBlend();
        RenderSystem.disableAlphaTest();
        RenderSystem.depthMask(false);
        RenderSystem.disableCull();

        if (lightEnabled) {
            RenderSystem.disableLighting();
        }

        GL11.glShadeModel(GL11.GL_SMOOTH);
        RenderSystem.blendFuncSeparate(
                GlStateManager.SourceFactor.SRC_ALPHA,
                GlStateManager.DestFactor.ONE,
                GlStateManager.SourceFactor.ONE,
                GlStateManager.DestFactor.ZERO
        );

        RectUtility.bindTexture(texture);

        if (!particles.isEmpty()) {
            particles.forEach(fireFlyEntity -> fireFlyEntity.update(true));

            float pos = 0.2F;
            for (FireFlyEntity particle : particles) {
                updateParticleAlpha(particle);

                int alpha = (int) org.joml.Math.clamp(0, (int) (particle.getAlpha().getValue()), particle.getAngle());
                int colorGlow = randomColor.get() ?
                        ColorUtils.reAlphaInt(particle.getColor(), alpha) :
                        ColorUtils.reAlphaInt(ColorUtils.getColor(particle.index * 99), alpha);

                renderParticle(matrix, particle, pos, alpha, colorGlow);
            }
        }

        cleanupRenderState(lightEnabled, matrix);
    }

    private void updateParticleAlpha(FireFlyEntity particle) {
        if ((int) particle.getAlpha().getValue() != 255 && !particle.time.isReached(particle.alpha.getDuration())) {
            particle.getAlpha().run(255);
        }
        if ((int) particle.getAlpha().getValue() != 0 && particle.time.isReached(5000 - particle.alpha.getDuration())) {
            particle.getAlpha().run(0);
        }
    }

    private void renderParticle(MatrixStack matrix, FireFlyEntity particle, float pos, int alpha, int colorGlow) {
        final org.joml.Vector3d vec = particle.getPosition();
        matrix.push();
        RectUtility.setupOrientationMatrix(matrix, (float) vec.x, (float) vec.y, (float) vec.z);
        matrix.rotate(mc.getRenderManager().getCameraOrientation());
        matrix.translate(0, pos / 2F, 0);

        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
        RectUtility.drawRect(matrix, -pos, -pos, pos, pos, colorGlow, colorGlow, colorGlow, colorGlow, true, true);

        float size = pos / 2F;
        int color = ColorUtils.reAlphaInt(-1, alpha);
        RectUtility.drawRect(matrix, -size, -size, size, size, color, color, color, color, true, true);

        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        matrix.pop();
    }

    private void cleanupRenderState(boolean lightEnabled, MatrixStack matrix) {
        RenderSystem.blendFuncSeparate(
                GlStateManager.SourceFactor.SRC_ALPHA,
                GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA,
                GlStateManager.SourceFactor.ONE,
                GlStateManager.DestFactor.ZERO
        );

        GlStateManager.clearCurrentColor();
        GL11.glShadeModel(GL11.GL_FLAT);

        if (lightEnabled) {
            RenderSystem.enableLighting();
        }

        RenderSystem.enableCull();
        RenderSystem.depthMask(true);
        RenderSystem.enableAlphaTest();
        matrix.pop();
        RenderSystem.popMatrix();
    }


    [USER=270918]@Getter[/USER]
    private static class FireFlyEntity {
        private final int index;
        private final TimerUtility time = new TimerUtility();
        private final CompactAnimation alpha = new CompactAnimation(Easing.LINEAR, 150);
        private final int color;

        public final org.joml.Vector3d position;
        private final org.joml.Vector3d delta;

        public FireFlyEntity(final org.joml.Vector3d position, final org.joml.Vector3d velocity, final int index, int color) {
            this.position = position;
            this.delta = new Vector3d(velocity.x, velocity.y, velocity.z);
            this.index = index;
            this.color = color;
            this.time.reset();
        }

        public void update(boolean physics) {
            if (physics) {
                final Block block1 = BlockUtils.getBlock(this.position.x, this.position.y, this.position.z + this.delta.z);
                if (isValidBlock(block1))
                    this.delta.z *= -0.8;

                final Block block2 = BlockUtils.getBlock(this.position.x, this.position.y + this.delta.y, this.position.z);
                if (isValidBlock(block2)) {
                    this.delta.x *= 0.999F;
                    this.delta.z *= 0.999F;
                    this.delta.y *= -0.7;
                }

                final Block block3 = BlockUtils.getBlock(this.position.x + this.delta.x, this.position.y, this.position.z);
                if (isValidBlock(block3))
                    this.delta.x *= -0.8;
            }

            this.updateMotion();
        }

        private boolean isValidBlock(Block block) {
            return !(block instanceof AirBlock)
                    && !(block instanceof BushBlock)
                    && !(block instanceof AbstractButtonBlock)
                    && !(block instanceof TorchBlock)
                    && !(block instanceof LeverBlock)
                    && !(block instanceof AbstractPressurePlateBlock)
                    && !(block instanceof CarpetBlock)
                    && !(block instanceof FlowingFluidBlock);
        }

        public int getAngle() {
            return (int) org.joml.Math.clamp(0, 255, ((org.joml.Math.sin(time.getTime() / 250D) + 1F) / 2F) * 255);
        }

        public void updateMotion() {
            double motion = 0.002;
            this.delta.x += (org.joml.Math.random() - 0.5) * motion;
            this.delta.y += (org.joml.Math.random() - 0.5) * motion * 0.5;

            if (!NightDLS.getInstance().getModuleManager().getSnow().fallModeSetting.is("Простой")) {
                this.delta.y = 0.03;
            }

            this.delta.z += (Math.random() - 0.5) * motion;

            double maxSpeed = 0.3;
            this.delta.x = MathHelper.clamp(this.delta.x, -maxSpeed, maxSpeed);
            this.delta.y = MathHelper.clamp(this.delta.y, -maxSpeed, maxSpeed);
            this.delta.z = MathHelper.clamp(this.delta.z, -maxSpeed, maxSpeed);

            this.position.x += this.delta.x;
            this.position.y += this.delta.y;
            this.position.z += this.delta.z;
        }
    }
}
Пожалуйста, авторизуйтесь для просмотра ссылки.
гуд /up
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
и смысл от твоей темы если в сурсах зовчика он был ?) /del
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
у всех есть
 
и смысл от твоей темы если в сурсах зовчика он был ?) /del
дебик?
Эта залупа почти везде есть
покажи
Да. ибо нахуя ты вообще эту хуйню заливаешь
тебе нужно ты делай с нуля
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.

Похожие темы

Назад
Сверху Снизу