Исходник Potion prediction eva ready

Начинающий
Статус
Оффлайн
Регистрация
2 Мар 2024
Сообщения
70
Реакции[?]
0
Поинты[?]
0

Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:

  • бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
  • маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
  • приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
  • обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.

Спасибо!

мой $$$$elfcode спиздил идею у дельты это у меня криво вышло ну пох (nation привет) нужно иметь (Predictions я его приклеплю)
говнокод:
package im.expensive.modules.impl.render;

import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import im.expensive.events.EventDisplay;
import im.expensive.events.WorldEvent;
import im.expensive.modules.api.Category;
import im.expensive.modules.api.Module;
import im.expensive.modules.api.ModuleRegister;
import im.expensive.utils.math.MathUtil;
import im.expensive.utils.projections.ProjectionUtil;
import im.expensive.utils.render.color.ColorUtils;
import im.expensive.utils.render.font.Fonts;
import im.expensive.utils.render.rect.DisplayUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EnderPearlEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.PotionEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.UseAction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import org.lwjgl.opengl.GL11;

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

import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL11.glPopMatrix;

@ModuleRegister(
        name = "PotionBreak",
        category = Category.Render
)
public class PotionBreak extends Module {
    private final Minecraft mc = Minecraft.getInstance();
    public PotionBreak() {
        addSettings();
    }

    record PotionPoint(Vector3d position, int ticks) {
    }

    final List<PotionBreak.PotionPoint> PotionPoints = new ArrayList<>();

    @Subscribe
    public void aa(EventDisplay e) {
        for (PotionBreak.PotionPoint PotionPoint : PotionPoints) {
            Vector3d pos = PotionPoint.position;
            Vector2f projection = ProjectionUtil.project(pos.x, pos.y - 0.3F, pos.z);
            int ticks = PotionPoint.ticks;


            if (projection.equals(new Vector2f(Float.MAX_VALUE, Float.MAX_VALUE))) {
                continue;
            }

            double time = ticks * 50 / 1000.0;
            String text = String.format("%.1f" + " сек.", time);
            float width = Fonts.montserrat.getWidth(text, 7);

            float textWidth = width + 11 + 11;

            float posX = projection.x - textWidth / 2;
            float posX1 = projection.x / 2;
            float posY = projection.y;

// DisplayUtils.drawRoundedRect(posX - 0.5f, posY + 2 - 0.5f, textWidth + 1, 16 + 1, new Vector4f(1,1,1,1), ColorUtils.rgba(24,24,24,10));

            DisplayUtils.drawRoundedRect(posX + 1, posY + 1 - 2, textWidth - 2, 16 - 3, 0, ColorUtils.rgba(24, 24, 24, 80));
// DisplayUtils.drawRoundedRect(posX, posY + 2, textWidth, 16, new Vector4f(1,1,1,1), ColorUtils.rgba(162));

// mc.getItemRenderer().renderItemAndEffectIntoGUI(Items.ENDER_PEARL.getDefaultInstance(), (int) posX, (int) posY + 2);
           //DisplayUtils.drawImage(new ResourceLocation("textures/item/splash_potion.png"), (int) posX + 5 , (int) posY + 2 + 2.4f - 4, 11 , 11, -1);
            Fonts.montserrat.drawText(e.getMatrixStack(), text, (float) (posX + 15), (float) (posY + 6.5f - 4), -1, 7);
        }
    }

    @Subscribe
    public void onRender(WorldEvent event) {
        glPushMatrix();

        glDisable(GL_TEXTURE_2D);
        glDisable(GL_DEPTH_TEST);

        glEnable(GL_BLEND);
        glEnable(GL_LINE_SMOOTH);

        Vector3d renderOffset = mc.getRenderManager().info.getProjectedView();

        glTranslated(-renderOffset.x, -renderOffset.y, -renderOffset.z);

        glLineWidth(3);

        buffer.begin(1, DefaultVertexFormats.POSITION);

        PotionPoints.clear();
        for (Entity entity : mc.world.getAllEntities()) {
            if (entity instanceof PotionEntity throwable) {
                Vector3d motion = throwable.getMotion();
                Vector3d pos = throwable.getPositionVec();
                Vector3d prevPos;
                int ticks = 0;

                for (int i = 0; i < 150; i++) {
                    prevPos = pos;
                    pos = pos.add(motion);
                    motion = getNextMotion(throwable, motion);
                    ColorUtils.setAlpha(ColorUtils.getColor(0),165);

                    buffer.pos(prevPos.x, prevPos.y, prevPos.z).endVertex();

                    RayTraceContext rayTraceContext = new RayTraceContext(
                            prevPos,
                            pos,
                            RayTraceContext.BlockMode.COLLIDER,
                            RayTraceContext.FluidMode.NONE,
                            throwable
                    );

                    BlockRayTraceResult blockHitResult = mc.world.rayTraceBlocks(rayTraceContext);

                    boolean isLast = blockHitResult.getType() == RayTraceResult.Type.BLOCK;

                    if (isLast) {
                        pos = blockHitResult.getHitVec();
                    }

                    buffer.pos(pos.x, pos.y, pos.z).endVertex();

                    if (blockHitResult.getType() == BlockRayTraceResult.Type.BLOCK || pos.y < -128) {
                        PotionPoints.add(new PotionBreak.PotionPoint(pos, ticks));


                        /////////////////////////////////
                        float radius;
                        Vector3d position = pos;
                        double pitch;
                        double yaw;
                        int x;
                        int z;
                        float angle;
                        float xOffset;
                        float zOffset;
                        int loopIndex;
                        radius = 3.5f;


                        GlStateManager.pushMatrix();
                        buffer.pos(position.x, position.y, position.z).color(570425599).endVertex();

                        for(z = 0; z <= 360; ++z) {
                            angle = (float)(position.x + (double)(MathHelper.sin((float)Math.toRadians((double)z)) * radius));
                            xOffset = (float)(position.z + (double)(-MathHelper.cos((float)Math.toRadians((double)z)) * radius));
                            buffer.pos((double)angle, position.y, (double)xOffset).color(570425599).endVertex();
                        }
                        ////////////////////////////////
                        break;
                    }
                    ticks++;
                }
            }
        }

        tessellator.draw();

        glDisable(GL_BLEND);
        glDisable(GL_LINE_SMOOTH);

        glEnable(GL_TEXTURE_2D);
        glEnable(GL_DEPTH_TEST);

        glPopMatrix();
    }

    private Vector3d getNextMotion(ThrowableEntity throwable, Vector3d motion) {
        if (throwable.isInWater()) {
            motion = motion.scale(0.8);
        } else {
            motion = motion.scale(0.99);
        }

        if (!throwable.hasNoGravity()) {
            motion.y -= throwable.getGravityVelocity();
        }

        return motion;
    }

    private void DrawRadius(float rad,Vector3d pos)
    {

    }
}
Пожалуйста, авторизуйтесь для просмотра ссылки.
 

Вложения

Последнее редактирование:
Начинающий
Статус
Оффлайн
Регистрация
25 Фев 2024
Сообщения
469
Реакции[?]
0
Поинты[?]
0
мой $$$$elfcode спиздил идею у дельты это у меня криво вышло ну пох (nation привет) нужно иметь (Predictions я его приклеплю)
говнокод:
package im.expensive.modules.impl.render;

import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import im.expensive.events.EventDisplay;
import im.expensive.events.WorldEvent;
import im.expensive.modules.api.Category;
import im.expensive.modules.api.Module;
import im.expensive.modules.api.ModuleRegister;
import im.expensive.utils.math.MathUtil;
import im.expensive.utils.projections.ProjectionUtil;
import im.expensive.utils.render.color.ColorUtils;
import im.expensive.utils.render.font.Fonts;
import im.expensive.utils.render.rect.DisplayUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EnderPearlEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.PotionEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.UseAction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import org.lwjgl.opengl.GL11;

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

import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL11.glPopMatrix;

@ModuleRegister(
        name = "PotionBreak",
        category = Category.Render
)
public class PotionBreak extends Module {
    private final Minecraft mc = Minecraft.getInstance();
    public PotionBreak() {
        addSettings();
    }

    record PotionPoint(Vector3d position, int ticks) {
    }

    final List<PotionBreak.PotionPoint> PotionPoints = new ArrayList<>();

    @Subscribe
    public void aa(EventDisplay e) {
        for (PotionBreak.PotionPoint PotionPoint : PotionPoints) {
            Vector3d pos = PotionPoint.position;
            Vector2f projection = ProjectionUtil.project(pos.x, pos.y - 0.3F, pos.z);
            int ticks = PotionPoint.ticks;


            if (projection.equals(new Vector2f(Float.MAX_VALUE, Float.MAX_VALUE))) {
                continue;
            }

            double time = ticks * 50 / 1000.0;
            String text = String.format("%.1f" + " сек.", time);
            float width = Fonts.montserrat.getWidth(text, 7);

            float textWidth = width + 11 + 11;

            float posX = projection.x - textWidth / 2;
            float posX1 = projection.x / 2;
            float posY = projection.y;

// DisplayUtils.drawRoundedRect(posX - 0.5f, posY + 2 - 0.5f, textWidth + 1, 16 + 1, new Vector4f(1,1,1,1), ColorUtils.rgba(24,24,24,10));

            DisplayUtils.drawRoundedRect(posX + 1, posY + 1 - 2, textWidth - 2, 16 - 3, 0, ColorUtils.rgba(24, 24, 24, 80));
// DisplayUtils.drawRoundedRect(posX, posY + 2, textWidth, 16, new Vector4f(1,1,1,1), ColorUtils.rgba(162));

// mc.getItemRenderer().renderItemAndEffectIntoGUI(Items.ENDER_PEARL.getDefaultInstance(), (int) posX, (int) posY + 2);
           //DisplayUtils.drawImage(new ResourceLocation("textures/item/splash_potion.png"), (int) posX + 5 , (int) posY + 2 + 2.4f - 4, 11 , 11, -1);
            Fonts.montserrat.drawText(e.getMatrixStack(), text, (float) (posX + 15), (float) (posY + 6.5f - 4), -1, 7);
        }
    }

    @Subscribe
    public void onRender(WorldEvent event) {
        glPushMatrix();

        glDisable(GL_TEXTURE_2D);
        glDisable(GL_DEPTH_TEST);

        glEnable(GL_BLEND);
        glEnable(GL_LINE_SMOOTH);

        Vector3d renderOffset = mc.getRenderManager().info.getProjectedView();

        glTranslated(-renderOffset.x, -renderOffset.y, -renderOffset.z);

        glLineWidth(3);

        buffer.begin(1, DefaultVertexFormats.POSITION);

        PotionPoints.clear();
        for (Entity entity : mc.world.getAllEntities()) {
            if (entity instanceof PotionEntity throwable) {
                Vector3d motion = throwable.getMotion();
                Vector3d pos = throwable.getPositionVec();
                Vector3d prevPos;
                int ticks = 0;

                for (int i = 0; i < 150; i++) {
                    prevPos = pos;
                    pos = pos.add(motion);
                    motion = getNextMotion(throwable, motion);
                    ColorUtils.setAlpha(ColorUtils.getColor(0),165);

                    buffer.pos(prevPos.x, prevPos.y, prevPos.z).endVertex();

                    RayTraceContext rayTraceContext = new RayTraceContext(
                            prevPos,
                            pos,
                            RayTraceContext.BlockMode.COLLIDER,
                            RayTraceContext.FluidMode.NONE,
                            throwable
                    );

                    BlockRayTraceResult blockHitResult = mc.world.rayTraceBlocks(rayTraceContext);

                    boolean isLast = blockHitResult.getType() == RayTraceResult.Type.BLOCK;

                    if (isLast) {
                        pos = blockHitResult.getHitVec();
                    }

                    buffer.pos(pos.x, pos.y, pos.z).endVertex();

                    if (blockHitResult.getType() == BlockRayTraceResult.Type.BLOCK || pos.y < -128) {
                        PotionPoints.add(new PotionBreak.PotionPoint(pos, ticks));


                        /////////////////////////////////
                        float radius;
                        Vector3d position = pos;
                        double pitch;
                        double yaw;
                        int x;
                        int z;
                        float angle;
                        float xOffset;
                        float zOffset;
                        int loopIndex;
                        radius = 3.5f;


                        GlStateManager.pushMatrix();
                        buffer.pos(position.x, position.y, position.z).color(570425599).endVertex();

                        for(z = 0; z <= 360; ++z) {
                            angle = (float)(position.x + (double)(MathHelper.sin((float)Math.toRadians((double)z)) * radius));
                            xOffset = (float)(position.z + (double)(-MathHelper.cos((float)Math.toRadians((double)z)) * radius));
                            buffer.pos((double)angle, position.y, (double)xOffset).color(570425599).endVertex();
                        }
                        ////////////////////////////////
                        break;
                    }
                    ticks++;
                }
            }
        }

        tessellator.draw();

        glDisable(GL_BLEND);
        glDisable(GL_LINE_SMOOTH);

        glEnable(GL_TEXTURE_2D);
        glEnable(GL_DEPTH_TEST);

        glPopMatrix();
    }

    private Vector3d getNextMotion(ThrowableEntity throwable, Vector3d motion) {
        if (throwable.isInWater()) {
            motion = motion.scale(0.8);
        } else {
            motion = motion.scale(0.99);
        }

        if (!throwable.hasNoGravity()) {
            motion.y -= throwable.getGravityVelocity();
        }

        return motion;
    }

    private void DrawRadius(float rad,Vector3d pos)
    {

    }
}
Пожалуйста, авторизуйтесь для просмотра ссылки.
запастил мои перл предиктионы :FeelsBadMan:
 
Начинающий
Статус
Оффлайн
Регистрация
26 Янв 2023
Сообщения
237
Реакции[?]
1
Поинты[?]
1K
мой $$$$elfcode спиздил идею у дельты это у меня криво вышло ну пох (nation привет) нужно иметь (Predictions я его приклеплю)
говнокод:
package im.expensive.modules.impl.render;

import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import im.expensive.events.EventDisplay;
import im.expensive.events.WorldEvent;
import im.expensive.modules.api.Category;
import im.expensive.modules.api.Module;
import im.expensive.modules.api.ModuleRegister;
import im.expensive.utils.math.MathUtil;
import im.expensive.utils.projections.ProjectionUtil;
import im.expensive.utils.render.color.ColorUtils;
import im.expensive.utils.render.font.Fonts;
import im.expensive.utils.render.rect.DisplayUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EnderPearlEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.PotionEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.UseAction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import org.lwjgl.opengl.GL11;

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

import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL11.glPopMatrix;

@ModuleRegister(
        name = "PotionBreak",
        category = Category.Render
)
public class PotionBreak extends Module {
    private final Minecraft mc = Minecraft.getInstance();
    public PotionBreak() {
        addSettings();
    }

    record PotionPoint(Vector3d position, int ticks) {
    }

    final List<PotionBreak.PotionPoint> PotionPoints = new ArrayList<>();

    @Subscribe
    public void aa(EventDisplay e) {
        for (PotionBreak.PotionPoint PotionPoint : PotionPoints) {
            Vector3d pos = PotionPoint.position;
            Vector2f projection = ProjectionUtil.project(pos.x, pos.y - 0.3F, pos.z);
            int ticks = PotionPoint.ticks;


            if (projection.equals(new Vector2f(Float.MAX_VALUE, Float.MAX_VALUE))) {
                continue;
            }

            double time = ticks * 50 / 1000.0;
            String text = String.format("%.1f" + " сек.", time);
            float width = Fonts.montserrat.getWidth(text, 7);

            float textWidth = width + 11 + 11;

            float posX = projection.x - textWidth / 2;
            float posX1 = projection.x / 2;
            float posY = projection.y;

// DisplayUtils.drawRoundedRect(posX - 0.5f, posY + 2 - 0.5f, textWidth + 1, 16 + 1, new Vector4f(1,1,1,1), ColorUtils.rgba(24,24,24,10));

            DisplayUtils.drawRoundedRect(posX + 1, posY + 1 - 2, textWidth - 2, 16 - 3, 0, ColorUtils.rgba(24, 24, 24, 80));
// DisplayUtils.drawRoundedRect(posX, posY + 2, textWidth, 16, new Vector4f(1,1,1,1), ColorUtils.rgba(162));

// mc.getItemRenderer().renderItemAndEffectIntoGUI(Items.ENDER_PEARL.getDefaultInstance(), (int) posX, (int) posY + 2);
           //DisplayUtils.drawImage(new ResourceLocation("textures/item/splash_potion.png"), (int) posX + 5 , (int) posY + 2 + 2.4f - 4, 11 , 11, -1);
            Fonts.montserrat.drawText(e.getMatrixStack(), text, (float) (posX + 15), (float) (posY + 6.5f - 4), -1, 7);
        }
    }

    @Subscribe
    public void onRender(WorldEvent event) {
        glPushMatrix();

        glDisable(GL_TEXTURE_2D);
        glDisable(GL_DEPTH_TEST);

        glEnable(GL_BLEND);
        glEnable(GL_LINE_SMOOTH);

        Vector3d renderOffset = mc.getRenderManager().info.getProjectedView();

        glTranslated(-renderOffset.x, -renderOffset.y, -renderOffset.z);

        glLineWidth(3);

        buffer.begin(1, DefaultVertexFormats.POSITION);

        PotionPoints.clear();
        for (Entity entity : mc.world.getAllEntities()) {
            if (entity instanceof PotionEntity throwable) {
                Vector3d motion = throwable.getMotion();
                Vector3d pos = throwable.getPositionVec();
                Vector3d prevPos;
                int ticks = 0;

                for (int i = 0; i < 150; i++) {
                    prevPos = pos;
                    pos = pos.add(motion);
                    motion = getNextMotion(throwable, motion);
                    ColorUtils.setAlpha(ColorUtils.getColor(0),165);

                    buffer.pos(prevPos.x, prevPos.y, prevPos.z).endVertex();

                    RayTraceContext rayTraceContext = new RayTraceContext(
                            prevPos,
                            pos,
                            RayTraceContext.BlockMode.COLLIDER,
                            RayTraceContext.FluidMode.NONE,
                            throwable
                    );

                    BlockRayTraceResult blockHitResult = mc.world.rayTraceBlocks(rayTraceContext);

                    boolean isLast = blockHitResult.getType() == RayTraceResult.Type.BLOCK;

                    if (isLast) {
                        pos = blockHitResult.getHitVec();
                    }

                    buffer.pos(pos.x, pos.y, pos.z).endVertex();

                    if (blockHitResult.getType() == BlockRayTraceResult.Type.BLOCK || pos.y < -128) {
                        PotionPoints.add(new PotionBreak.PotionPoint(pos, ticks));


                        /////////////////////////////////
                        float radius;
                        Vector3d position = pos;
                        double pitch;
                        double yaw;
                        int x;
                        int z;
                        float angle;
                        float xOffset;
                        float zOffset;
                        int loopIndex;
                        radius = 3.5f;


                        GlStateManager.pushMatrix();
                        buffer.pos(position.x, position.y, position.z).color(570425599).endVertex();

                        for(z = 0; z <= 360; ++z) {
                            angle = (float)(position.x + (double)(MathHelper.sin((float)Math.toRadians((double)z)) * radius));
                            xOffset = (float)(position.z + (double)(-MathHelper.cos((float)Math.toRadians((double)z)) * radius));
                            buffer.pos((double)angle, position.y, (double)xOffset).color(570425599).endVertex();
                        }
                        ////////////////////////////////
                        break;
                    }
                    ticks++;
                }
            }
        }

        tessellator.draw();

        glDisable(GL_BLEND);
        glDisable(GL_LINE_SMOOTH);

        glEnable(GL_TEXTURE_2D);
        glEnable(GL_DEPTH_TEST);

        glPopMatrix();
    }

    private Vector3d getNextMotion(ThrowableEntity throwable, Vector3d motion) {
        if (throwable.isInWater()) {
            motion = motion.scale(0.8);
        } else {
            motion = motion.scale(0.99);
        }

        if (!throwable.hasNoGravity()) {
            motion.y -= throwable.getGravityVelocity();
        }

        return motion;
    }

    private void DrawRadius(float rad,Vector3d pos)
    {

    }
}
Пожалуйста, авторизуйтесь для просмотра ссылки.
Ева апгрейд :roflanEbalo:
 
Начинающий
Статус
Оффлайн
Регистрация
18 Авг 2023
Сообщения
339
Реакции[?]
2
Поинты[?]
0
мой $$$$elfcode спиздил идею у дельты это у меня криво вышло ну пох (nation привет) нужно иметь (Predictions я его приклеплю)
говнокод:
package im.expensive.modules.impl.render;

import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import im.expensive.events.EventDisplay;
import im.expensive.events.WorldEvent;
import im.expensive.modules.api.Category;
import im.expensive.modules.api.Module;
import im.expensive.modules.api.ModuleRegister;
import im.expensive.utils.math.MathUtil;
import im.expensive.utils.projections.ProjectionUtil;
import im.expensive.utils.render.color.ColorUtils;
import im.expensive.utils.render.font.Fonts;
import im.expensive.utils.render.rect.DisplayUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EnderPearlEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.PotionEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.UseAction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import org.lwjgl.opengl.GL11;

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

import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL11.glPopMatrix;

@ModuleRegister(
        name = "PotionBreak",
        category = Category.Render
)
public class PotionBreak extends Module {
    private final Minecraft mc = Minecraft.getInstance();
    public PotionBreak() {
        addSettings();
    }

    record PotionPoint(Vector3d position, int ticks) {
    }

    final List<PotionBreak.PotionPoint> PotionPoints = new ArrayList<>();

    @Subscribe
    public void aa(EventDisplay e) {
        for (PotionBreak.PotionPoint PotionPoint : PotionPoints) {
            Vector3d pos = PotionPoint.position;
            Vector2f projection = ProjectionUtil.project(pos.x, pos.y - 0.3F, pos.z);
            int ticks = PotionPoint.ticks;


            if (projection.equals(new Vector2f(Float.MAX_VALUE, Float.MAX_VALUE))) {
                continue;
            }

            double time = ticks * 50 / 1000.0;
            String text = String.format("%.1f" + " сек.", time);
            float width = Fonts.montserrat.getWidth(text, 7);

            float textWidth = width + 11 + 11;

            float posX = projection.x - textWidth / 2;
            float posX1 = projection.x / 2;
            float posY = projection.y;

// DisplayUtils.drawRoundedRect(posX - 0.5f, posY + 2 - 0.5f, textWidth + 1, 16 + 1, new Vector4f(1,1,1,1), ColorUtils.rgba(24,24,24,10));

            DisplayUtils.drawRoundedRect(posX + 1, posY + 1 - 2, textWidth - 2, 16 - 3, 0, ColorUtils.rgba(24, 24, 24, 80));
// DisplayUtils.drawRoundedRect(posX, posY + 2, textWidth, 16, new Vector4f(1,1,1,1), ColorUtils.rgba(162));

// mc.getItemRenderer().renderItemAndEffectIntoGUI(Items.ENDER_PEARL.getDefaultInstance(), (int) posX, (int) posY + 2);
           //DisplayUtils.drawImage(new ResourceLocation("textures/item/splash_potion.png"), (int) posX + 5 , (int) posY + 2 + 2.4f - 4, 11 , 11, -1);
            Fonts.montserrat.drawText(e.getMatrixStack(), text, (float) (posX + 15), (float) (posY + 6.5f - 4), -1, 7);
        }
    }

    @Subscribe
    public void onRender(WorldEvent event) {
        glPushMatrix();

        glDisable(GL_TEXTURE_2D);
        glDisable(GL_DEPTH_TEST);

        glEnable(GL_BLEND);
        glEnable(GL_LINE_SMOOTH);

        Vector3d renderOffset = mc.getRenderManager().info.getProjectedView();

        glTranslated(-renderOffset.x, -renderOffset.y, -renderOffset.z);

        glLineWidth(3);

        buffer.begin(1, DefaultVertexFormats.POSITION);

        PotionPoints.clear();
        for (Entity entity : mc.world.getAllEntities()) {
            if (entity instanceof PotionEntity throwable) {
                Vector3d motion = throwable.getMotion();
                Vector3d pos = throwable.getPositionVec();
                Vector3d prevPos;
                int ticks = 0;

                for (int i = 0; i < 150; i++) {
                    prevPos = pos;
                    pos = pos.add(motion);
                    motion = getNextMotion(throwable, motion);
                    ColorUtils.setAlpha(ColorUtils.getColor(0),165);

                    buffer.pos(prevPos.x, prevPos.y, prevPos.z).endVertex();

                    RayTraceContext rayTraceContext = new RayTraceContext(
                            prevPos,
                            pos,
                            RayTraceContext.BlockMode.COLLIDER,
                            RayTraceContext.FluidMode.NONE,
                            throwable
                    );

                    BlockRayTraceResult blockHitResult = mc.world.rayTraceBlocks(rayTraceContext);

                    boolean isLast = blockHitResult.getType() == RayTraceResult.Type.BLOCK;

                    if (isLast) {
                        pos = blockHitResult.getHitVec();
                    }

                    buffer.pos(pos.x, pos.y, pos.z).endVertex();

                    if (blockHitResult.getType() == BlockRayTraceResult.Type.BLOCK || pos.y < -128) {
                        PotionPoints.add(new PotionBreak.PotionPoint(pos, ticks));


                        /////////////////////////////////
                        float radius;
                        Vector3d position = pos;
                        double pitch;
                        double yaw;
                        int x;
                        int z;
                        float angle;
                        float xOffset;
                        float zOffset;
                        int loopIndex;
                        radius = 3.5f;


                        GlStateManager.pushMatrix();
                        buffer.pos(position.x, position.y, position.z).color(570425599).endVertex();

                        for(z = 0; z <= 360; ++z) {
                            angle = (float)(position.x + (double)(MathHelper.sin((float)Math.toRadians((double)z)) * radius));
                            xOffset = (float)(position.z + (double)(-MathHelper.cos((float)Math.toRadians((double)z)) * radius));
                            buffer.pos((double)angle, position.y, (double)xOffset).color(570425599).endVertex();
                        }
                        ////////////////////////////////
                        break;
                    }
                    ticks++;
                }
            }
        }

        tessellator.draw();

        glDisable(GL_BLEND);
        glDisable(GL_LINE_SMOOTH);

        glEnable(GL_TEXTURE_2D);
        glEnable(GL_DEPTH_TEST);

        glPopMatrix();
    }

    private Vector3d getNextMotion(ThrowableEntity throwable, Vector3d motion) {
        if (throwable.isInWater()) {
            motion = motion.scale(0.8);
        } else {
            motion = motion.scale(0.99);
        }

        if (!throwable.hasNoGravity()) {
            motion.y -= throwable.getGravityVelocity();
        }

        return motion;
    }

    private void DrawRadius(float rad,Vector3d pos)
    {

    }
}
Пожалуйста, авторизуйтесь для просмотра ссылки.
легче в перл предикт добавить проверку на ThrowableEntity и не мучаца
25 билд евы куда лучше будет апрегрейдов и 17 билда
 
Начинающий
Статус
Оффлайн
Регистрация
26 Янв 2023
Сообщения
237
Реакции[?]
1
Поинты[?]
1K
Read Only
Статус
Оффлайн
Регистрация
25 Окт 2024
Сообщения
10
Реакции[?]
0
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Начинающий
Статус
Оффлайн
Регистрация
29 Апр 2023
Сообщения
741
Реакции[?]
4
Поинты[?]
5K
мой $$$$elfcode спиздил идею у дельты это у меня криво вышло ну пох (nation привет) нужно иметь (Predictions я его приклеплю)
говнокод:
package im.expensive.modules.impl.render;

import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import im.expensive.events.EventDisplay;
import im.expensive.events.WorldEvent;
import im.expensive.modules.api.Category;
import im.expensive.modules.api.Module;
import im.expensive.modules.api.ModuleRegister;
import im.expensive.utils.math.MathUtil;
import im.expensive.utils.projections.ProjectionUtil;
import im.expensive.utils.render.color.ColorUtils;
import im.expensive.utils.render.font.Fonts;
import im.expensive.utils.render.rect.DisplayUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EnderPearlEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.PotionEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.UseAction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import org.lwjgl.opengl.GL11;

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

import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL11.glPopMatrix;

@ModuleRegister(
        name = "PotionBreak",
        category = Category.Render
)
public class PotionBreak extends Module {
    private final Minecraft mc = Minecraft.getInstance();
    public PotionBreak() {
        addSettings();
    }

    record PotionPoint(Vector3d position, int ticks) {
    }

    final List<PotionBreak.PotionPoint> PotionPoints = new ArrayList<>();

    @Subscribe
    public void aa(EventDisplay e) {
        for (PotionBreak.PotionPoint PotionPoint : PotionPoints) {
            Vector3d pos = PotionPoint.position;
            Vector2f projection = ProjectionUtil.project(pos.x, pos.y - 0.3F, pos.z);
            int ticks = PotionPoint.ticks;


            if (projection.equals(new Vector2f(Float.MAX_VALUE, Float.MAX_VALUE))) {
                continue;
            }

            double time = ticks * 50 / 1000.0;
            String text = String.format("%.1f" + " сек.", time);
            float width = Fonts.montserrat.getWidth(text, 7);

            float textWidth = width + 11 + 11;

            float posX = projection.x - textWidth / 2;
            float posX1 = projection.x / 2;
            float posY = projection.y;

// DisplayUtils.drawRoundedRect(posX - 0.5f, posY + 2 - 0.5f, textWidth + 1, 16 + 1, new Vector4f(1,1,1,1), ColorUtils.rgba(24,24,24,10));

            DisplayUtils.drawRoundedRect(posX + 1, posY + 1 - 2, textWidth - 2, 16 - 3, 0, ColorUtils.rgba(24, 24, 24, 80));
// DisplayUtils.drawRoundedRect(posX, posY + 2, textWidth, 16, new Vector4f(1,1,1,1), ColorUtils.rgba(162));

// mc.getItemRenderer().renderItemAndEffectIntoGUI(Items.ENDER_PEARL.getDefaultInstance(), (int) posX, (int) posY + 2);
           //DisplayUtils.drawImage(new ResourceLocation("textures/item/splash_potion.png"), (int) posX + 5 , (int) posY + 2 + 2.4f - 4, 11 , 11, -1);
            Fonts.montserrat.drawText(e.getMatrixStack(), text, (float) (posX + 15), (float) (posY + 6.5f - 4), -1, 7);
        }
    }

    @Subscribe
    public void onRender(WorldEvent event) {
        glPushMatrix();

        glDisable(GL_TEXTURE_2D);
        glDisable(GL_DEPTH_TEST);

        glEnable(GL_BLEND);
        glEnable(GL_LINE_SMOOTH);

        Vector3d renderOffset = mc.getRenderManager().info.getProjectedView();

        glTranslated(-renderOffset.x, -renderOffset.y, -renderOffset.z);

        glLineWidth(3);

        buffer.begin(1, DefaultVertexFormats.POSITION);

        PotionPoints.clear();
        for (Entity entity : mc.world.getAllEntities()) {
            if (entity instanceof PotionEntity throwable) {
                Vector3d motion = throwable.getMotion();
                Vector3d pos = throwable.getPositionVec();
                Vector3d prevPos;
                int ticks = 0;

                for (int i = 0; i < 150; i++) {
                    prevPos = pos;
                    pos = pos.add(motion);
                    motion = getNextMotion(throwable, motion);
                    ColorUtils.setAlpha(ColorUtils.getColor(0),165);

                    buffer.pos(prevPos.x, prevPos.y, prevPos.z).endVertex();

                    RayTraceContext rayTraceContext = new RayTraceContext(
                            prevPos,
                            pos,
                            RayTraceContext.BlockMode.COLLIDER,
                            RayTraceContext.FluidMode.NONE,
                            throwable
                    );

                    BlockRayTraceResult blockHitResult = mc.world.rayTraceBlocks(rayTraceContext);

                    boolean isLast = blockHitResult.getType() == RayTraceResult.Type.BLOCK;

                    if (isLast) {
                        pos = blockHitResult.getHitVec();
                    }

                    buffer.pos(pos.x, pos.y, pos.z).endVertex();

                    if (blockHitResult.getType() == BlockRayTraceResult.Type.BLOCK || pos.y < -128) {
                        PotionPoints.add(new PotionBreak.PotionPoint(pos, ticks));


                        /////////////////////////////////
                        float radius;
                        Vector3d position = pos;
                        double pitch;
                        double yaw;
                        int x;
                        int z;
                        float angle;
                        float xOffset;
                        float zOffset;
                        int loopIndex;
                        radius = 3.5f;


                        GlStateManager.pushMatrix();
                        buffer.pos(position.x, position.y, position.z).color(570425599).endVertex();

                        for(z = 0; z <= 360; ++z) {
                            angle = (float)(position.x + (double)(MathHelper.sin((float)Math.toRadians((double)z)) * radius));
                            xOffset = (float)(position.z + (double)(-MathHelper.cos((float)Math.toRadians((double)z)) * radius));
                            buffer.pos((double)angle, position.y, (double)xOffset).color(570425599).endVertex();
                        }
                        ////////////////////////////////
                        break;
                    }
                    ticks++;
                }
            }
        }

        tessellator.draw();

        glDisable(GL_BLEND);
        glDisable(GL_LINE_SMOOTH);

        glEnable(GL_TEXTURE_2D);
        glEnable(GL_DEPTH_TEST);

        glPopMatrix();
    }

    private Vector3d getNextMotion(ThrowableEntity throwable, Vector3d motion) {
        if (throwable.isInWater()) {
            motion = motion.scale(0.8);
        } else {
            motion = motion.scale(0.99);
        }

        if (!throwable.hasNoGravity()) {
            motion.y -= throwable.getGravityVelocity();
        }

        return motion;
    }

    private void DrawRadius(float rad,Vector3d pos)
    {

    }
}
Пожалуйста, авторизуйтесь для просмотра ссылки.
1729834240011.png
 
Начинающий
Статус
Оффлайн
Регистрация
20 Июн 2024
Сообщения
239
Реакции[?]
1
Поинты[?]
1K
мой $$$$elfcode спиздил идею у дельты это у меня криво вышло ну пох (nation привет) нужно иметь (Predictions я его приклеплю)
говнокод:
package im.expensive.modules.impl.render;

import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import im.expensive.events.EventDisplay;
import im.expensive.events.WorldEvent;
import im.expensive.modules.api.Category;
import im.expensive.modules.api.Module;
import im.expensive.modules.api.ModuleRegister;
import im.expensive.utils.math.MathUtil;
import im.expensive.utils.projections.ProjectionUtil;
import im.expensive.utils.render.color.ColorUtils;
import im.expensive.utils.render.font.Fonts;
import im.expensive.utils.render.rect.DisplayUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EnderPearlEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.PotionEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.UseAction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import org.lwjgl.opengl.GL11;

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

import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL11.glPopMatrix;

@ModuleRegister(
        name = "PotionBreak",
        category = Category.Render
)
public class PotionBreak extends Module {
    private final Minecraft mc = Minecraft.getInstance();
    public PotionBreak() {
        addSettings();
    }

    record PotionPoint(Vector3d position, int ticks) {
    }

    final List<PotionBreak.PotionPoint> PotionPoints = new ArrayList<>();

    @Subscribe
    public void aa(EventDisplay e) {
        for (PotionBreak.PotionPoint PotionPoint : PotionPoints) {
            Vector3d pos = PotionPoint.position;
            Vector2f projection = ProjectionUtil.project(pos.x, pos.y - 0.3F, pos.z);
            int ticks = PotionPoint.ticks;


            if (projection.equals(new Vector2f(Float.MAX_VALUE, Float.MAX_VALUE))) {
                continue;
            }

            double time = ticks * 50 / 1000.0;
            String text = String.format("%.1f" + " сек.", time);
            float width = Fonts.montserrat.getWidth(text, 7);

            float textWidth = width + 11 + 11;

            float posX = projection.x - textWidth / 2;
            float posX1 = projection.x / 2;
            float posY = projection.y;

// DisplayUtils.drawRoundedRect(posX - 0.5f, posY + 2 - 0.5f, textWidth + 1, 16 + 1, new Vector4f(1,1,1,1), ColorUtils.rgba(24,24,24,10));

            DisplayUtils.drawRoundedRect(posX + 1, posY + 1 - 2, textWidth - 2, 16 - 3, 0, ColorUtils.rgba(24, 24, 24, 80));
// DisplayUtils.drawRoundedRect(posX, posY + 2, textWidth, 16, new Vector4f(1,1,1,1), ColorUtils.rgba(162));

// mc.getItemRenderer().renderItemAndEffectIntoGUI(Items.ENDER_PEARL.getDefaultInstance(), (int) posX, (int) posY + 2);
           //DisplayUtils.drawImage(new ResourceLocation("textures/item/splash_potion.png"), (int) posX + 5 , (int) posY + 2 + 2.4f - 4, 11 , 11, -1);
            Fonts.montserrat.drawText(e.getMatrixStack(), text, (float) (posX + 15), (float) (posY + 6.5f - 4), -1, 7);
        }
    }

    @Subscribe
    public void onRender(WorldEvent event) {
        glPushMatrix();

        glDisable(GL_TEXTURE_2D);
        glDisable(GL_DEPTH_TEST);

        glEnable(GL_BLEND);
        glEnable(GL_LINE_SMOOTH);

        Vector3d renderOffset = mc.getRenderManager().info.getProjectedView();

        glTranslated(-renderOffset.x, -renderOffset.y, -renderOffset.z);

        glLineWidth(3);

        buffer.begin(1, DefaultVertexFormats.POSITION);

        PotionPoints.clear();
        for (Entity entity : mc.world.getAllEntities()) {
            if (entity instanceof PotionEntity throwable) {
                Vector3d motion = throwable.getMotion();
                Vector3d pos = throwable.getPositionVec();
                Vector3d prevPos;
                int ticks = 0;

                for (int i = 0; i < 150; i++) {
                    prevPos = pos;
                    pos = pos.add(motion);
                    motion = getNextMotion(throwable, motion);
                    ColorUtils.setAlpha(ColorUtils.getColor(0),165);

                    buffer.pos(prevPos.x, prevPos.y, prevPos.z).endVertex();

                    RayTraceContext rayTraceContext = new RayTraceContext(
                            prevPos,
                            pos,
                            RayTraceContext.BlockMode.COLLIDER,
                            RayTraceContext.FluidMode.NONE,
                            throwable
                    );

                    BlockRayTraceResult blockHitResult = mc.world.rayTraceBlocks(rayTraceContext);

                    boolean isLast = blockHitResult.getType() == RayTraceResult.Type.BLOCK;

                    if (isLast) {
                        pos = blockHitResult.getHitVec();
                    }

                    buffer.pos(pos.x, pos.y, pos.z).endVertex();

                    if (blockHitResult.getType() == BlockRayTraceResult.Type.BLOCK || pos.y < -128) {
                        PotionPoints.add(new PotionBreak.PotionPoint(pos, ticks));


                        /////////////////////////////////
                        float radius;
                        Vector3d position = pos;
                        double pitch;
                        double yaw;
                        int x;
                        int z;
                        float angle;
                        float xOffset;
                        float zOffset;
                        int loopIndex;
                        radius = 3.5f;


                        GlStateManager.pushMatrix();
                        buffer.pos(position.x, position.y, position.z).color(570425599).endVertex();

                        for(z = 0; z <= 360; ++z) {
                            angle = (float)(position.x + (double)(MathHelper.sin((float)Math.toRadians((double)z)) * radius));
                            xOffset = (float)(position.z + (double)(-MathHelper.cos((float)Math.toRadians((double)z)) * radius));
                            buffer.pos((double)angle, position.y, (double)xOffset).color(570425599).endVertex();
                        }
                        ////////////////////////////////
                        break;
                    }
                    ticks++;
                }
            }
        }

        tessellator.draw();

        glDisable(GL_BLEND);
        glDisable(GL_LINE_SMOOTH);

        glEnable(GL_TEXTURE_2D);
        glEnable(GL_DEPTH_TEST);

        glPopMatrix();
    }

    private Vector3d getNextMotion(ThrowableEntity throwable, Vector3d motion) {
        if (throwable.isInWater()) {
            motion = motion.scale(0.8);
        } else {
            motion = motion.scale(0.99);
        }

        if (!throwable.hasNoGravity()) {
            motion.y -= throwable.getGravityVelocity();
        }

        return motion;
    }

    private void DrawRadius(float rad,Vector3d pos)
    {

    }
}
Пожалуйста, авторизуйтесь для просмотра ссылки.
OpenGL, не дал спастить🥶🥶🥶
 
Начинающий
Статус
Оффлайн
Регистрация
18 Авг 2023
Сообщения
339
Реакции[?]
2
Поинты[?]
0
OpenGL, не дал спастить🥶🥶🥶
там пастить нечего. в обычном перл предикте сделать выбор энтити (arrowentity / snowballentity / pearlentity / potionentity) куда лучше будет чем отдельный модуль.
 
Начинающий
Статус
Оффлайн
Регистрация
20 Июн 2024
Сообщения
239
Реакции[?]
1
Поинты[?]
1K
там пастить нечего. в обычном перл предикте сделать выбор энтити (arrowentity / snowballentity / pearlentity / potionentity) куда лучше будет чем отдельный модуль.
Факт, но интересно почему у не опенгл вылезает
Факт, но интересно почему у не опенгл вылезает
у него*
 
Начинающий
Статус
Оффлайн
Регистрация
20 Апр 2021
Сообщения
1,232
Реакции[?]
25
Поинты[?]
38K
мой $$$$elfcode спиздил идею у дельты это у меня криво вышло ну пох (nation привет) нужно иметь (Predictions я его приклеплю)
говнокод:
package im.expensive.modules.impl.render;

import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import im.expensive.events.EventDisplay;
import im.expensive.events.WorldEvent;
import im.expensive.modules.api.Category;
import im.expensive.modules.api.Module;
import im.expensive.modules.api.ModuleRegister;
import im.expensive.utils.math.MathUtil;
import im.expensive.utils.projections.ProjectionUtil;
import im.expensive.utils.render.color.ColorUtils;
import im.expensive.utils.render.font.Fonts;
import im.expensive.utils.render.rect.DisplayUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EnderPearlEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.PotionEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.UseAction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import org.lwjgl.opengl.GL11;

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

import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL11.glPopMatrix;

@ModuleRegister(
        name = "PotionBreak",
        category = Category.Render
)
public class PotionBreak extends Module {
    private final Minecraft mc = Minecraft.getInstance();
    public PotionBreak() {
        addSettings();
    }

    record PotionPoint(Vector3d position, int ticks) {
    }

    final List<PotionBreak.PotionPoint> PotionPoints = new ArrayList<>();

    @Subscribe
    public void aa(EventDisplay e) {
        for (PotionBreak.PotionPoint PotionPoint : PotionPoints) {
            Vector3d pos = PotionPoint.position;
            Vector2f projection = ProjectionUtil.project(pos.x, pos.y - 0.3F, pos.z);
            int ticks = PotionPoint.ticks;


            if (projection.equals(new Vector2f(Float.MAX_VALUE, Float.MAX_VALUE))) {
                continue;
            }

            double time = ticks * 50 / 1000.0;
            String text = String.format("%.1f" + " сек.", time);
            float width = Fonts.montserrat.getWidth(text, 7);

            float textWidth = width + 11 + 11;

            float posX = projection.x - textWidth / 2;
            float posX1 = projection.x / 2;
            float posY = projection.y;

// DisplayUtils.drawRoundedRect(posX - 0.5f, posY + 2 - 0.5f, textWidth + 1, 16 + 1, new Vector4f(1,1,1,1), ColorUtils.rgba(24,24,24,10));

            DisplayUtils.drawRoundedRect(posX + 1, posY + 1 - 2, textWidth - 2, 16 - 3, 0, ColorUtils.rgba(24, 24, 24, 80));
// DisplayUtils.drawRoundedRect(posX, posY + 2, textWidth, 16, new Vector4f(1,1,1,1), ColorUtils.rgba(162));

// mc.getItemRenderer().renderItemAndEffectIntoGUI(Items.ENDER_PEARL.getDefaultInstance(), (int) posX, (int) posY + 2);
           //DisplayUtils.drawImage(new ResourceLocation("textures/item/splash_potion.png"), (int) posX + 5 , (int) posY + 2 + 2.4f - 4, 11 , 11, -1);
            Fonts.montserrat.drawText(e.getMatrixStack(), text, (float) (posX + 15), (float) (posY + 6.5f - 4), -1, 7);
        }
    }

    @Subscribe
    public void onRender(WorldEvent event) {
        glPushMatrix();

        glDisable(GL_TEXTURE_2D);
        glDisable(GL_DEPTH_TEST);

        glEnable(GL_BLEND);
        glEnable(GL_LINE_SMOOTH);

        Vector3d renderOffset = mc.getRenderManager().info.getProjectedView();

        glTranslated(-renderOffset.x, -renderOffset.y, -renderOffset.z);

        glLineWidth(3);

        buffer.begin(1, DefaultVertexFormats.POSITION);

        PotionPoints.clear();
        for (Entity entity : mc.world.getAllEntities()) {
            if (entity instanceof PotionEntity throwable) {
                Vector3d motion = throwable.getMotion();
                Vector3d pos = throwable.getPositionVec();
                Vector3d prevPos;
                int ticks = 0;

                for (int i = 0; i < 150; i++) {
                    prevPos = pos;
                    pos = pos.add(motion);
                    motion = getNextMotion(throwable, motion);
                    ColorUtils.setAlpha(ColorUtils.getColor(0),165);

                    buffer.pos(prevPos.x, prevPos.y, prevPos.z).endVertex();

                    RayTraceContext rayTraceContext = new RayTraceContext(
                            prevPos,
                            pos,
                            RayTraceContext.BlockMode.COLLIDER,
                            RayTraceContext.FluidMode.NONE,
                            throwable
                    );

                    BlockRayTraceResult blockHitResult = mc.world.rayTraceBlocks(rayTraceContext);

                    boolean isLast = blockHitResult.getType() == RayTraceResult.Type.BLOCK;

                    if (isLast) {
                        pos = blockHitResult.getHitVec();
                    }

                    buffer.pos(pos.x, pos.y, pos.z).endVertex();

                    if (blockHitResult.getType() == BlockRayTraceResult.Type.BLOCK || pos.y < -128) {
                        PotionPoints.add(new PotionBreak.PotionPoint(pos, ticks));


                        /////////////////////////////////
                        float radius;
                        Vector3d position = pos;
                        double pitch;
                        double yaw;
                        int x;
                        int z;
                        float angle;
                        float xOffset;
                        float zOffset;
                        int loopIndex;
                        radius = 3.5f;


                        GlStateManager.pushMatrix();
                        buffer.pos(position.x, position.y, position.z).color(570425599).endVertex();

                        for(z = 0; z <= 360; ++z) {
                            angle = (float)(position.x + (double)(MathHelper.sin((float)Math.toRadians((double)z)) * radius));
                            xOffset = (float)(position.z + (double)(-MathHelper.cos((float)Math.toRadians((double)z)) * radius));
                            buffer.pos((double)angle, position.y, (double)xOffset).color(570425599).endVertex();
                        }
                        ////////////////////////////////
                        break;
                    }
                    ticks++;
                }
            }
        }

        tessellator.draw();

        glDisable(GL_BLEND);
        glDisable(GL_LINE_SMOOTH);

        glEnable(GL_TEXTURE_2D);
        glEnable(GL_DEPTH_TEST);

        glPopMatrix();
    }

    private Vector3d getNextMotion(ThrowableEntity throwable, Vector3d motion) {
        if (throwable.isInWater()) {
            motion = motion.scale(0.8);
        } else {
            motion = motion.scale(0.99);
        }

        if (!throwable.hasNoGravity()) {
            motion.y -= throwable.getGravityVelocity();
        }

        return motion;
    }

    private void DrawRadius(float rad,Vector3d pos)
    {

    }
}
Пожалуйста, авторизуйтесь для просмотра ссылки.
ХАХАХА А ЧЁ ЗА ОШИБКИ В ЧАТЕ?
 
Начинающий
Статус
Оффлайн
Регистрация
26 Янв 2023
Сообщения
237
Реакции[?]
1
Поинты[?]
1K
Похожие темы
Сверху Снизу