Вопрос Как сделать отображение через сколько долетит пёрка до земли

Забаненный
Забаненный
Статус
Оффлайн
Регистрация
10 Май 2023
Сообщения
803
Реакции
9
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.

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

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

Спасибо!

Вопрос в теме, типо хочу сделать так чтобы на месте там где прилетит пёрка рендерился текст через сколько сек он долетит


exp 3.1 def:
Expand Collapse Copy
package fun.ellant.modules.impl.render;

import com.google.common.eventbus.Subscribe;
import fun.ellant.events.WorldEvent;
import fun.ellant.modules.main.Category;
import fun.ellant.modules.main.Module;
import fun.ellant.modules.main.FunctionRegister;
import fun.ellant.modules.impl.hud.HUD;
import fun.ellant.utils.render.ColorUtils;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EnderPearlEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector3d;

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

@FunctionRegister(name = "Predictions", type = Category.RENDER, desc = "Показывает куда прилетит пёрка", ft = "", hw = "")
public class Predictions extends Module {

    @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);

        for (Entity entity : mc.world.getAllEntities()) {
            if (entity instanceof EnderPearlEntity throwable) {
                Vector3d motion = throwable.getMotion();
                Vector3d pos = throwable.getPositionVec();
                Vector3d prevPos;

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

                    ColorUtils.setColor(HUD.getColor(i));

                    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 (isLast || pos.y < 0) break;
                }
            }
        }

        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;
    }
}
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
пытался запастить и с премки срогалика и фришки но рыгалик не помог
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
типо, просто не отображается ничего
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
пробывал перепастить раз 6
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
берешь крякаешь нурсултан после вытаскиваешь эту хуйню с таймером перки :blush:
 
пробывал перепастить раз 6
Ладно помогу скину готовый код
package dev.Kainer.functions.impl.render;

import com.google.common.eventbus.Subscribe;
import dev.Kainer.functions.settings.impl.ColorSetting;
import dev.Kainer.utils.client.IMinecraft;
import net.minecraft.client.renderer.ItemModelMesher;
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.ThrowableEntity;
import net.minecraft.item.Items;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockRayTraceResult;
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 dev.Kainer.events.EventDisplay;
import dev.Kainer.events.WorldEvent;
import dev.Kainer.functions.api.Category;
import dev.Kainer.functions.api.Function;
import dev.Kainer.functions.api.FunctionRegister;
import dev.Kainer.utils.math.Vector4i;
import dev.Kainer.utils.projections.ProjectionUtil;
import dev.Kainer.utils.render.ColorUtils;
import dev.Kainer.utils.render.DisplayUtils;
import dev.Kainer.utils.render.font.Fonts;
import net.minecraft.util.math.vector.Vector4f;

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

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

@FunctionRegister(name = "Predictions", type = Category.Render)
public class Predictions extends Function {



public Predictions() {
addSettings();
}

record PearlPoint(Vector3d position, int ticks) {
}

final List<PearlPoint> pearlPoints = new ArrayList<>();

@Subscribe
public void aa(EventDisplay e) {
for (PearlPoint pearlPoint : pearlPoints) {
Vector3d pos = pearlPoint.position;
Vector2f projection = ProjectionUtil.project(pos.x, pos.y - 0.3F, pos.z);
int ticks = pearlPoint.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 + 3, posY + 2 - 3, textWidth - 4, 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/ender_pearl.png"), (int) posX + 5 , (int) posY + 2 + 2.4f - 4, 11 , 11, -1);
Fonts.montserrat.drawText(e.getMatrixStack(), text, (float) (posX + 18), (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);

pearlPoints.clear();
for (Entity entity : mc.world.getAllEntities()) {
if (entity instanceof EnderPearlEntity 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) {
pearlPoints.add(new PearlPoint(pos, ticks));
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;
}
}
Элант можешь скинуть базу с альтменеджером кнопкой я просто аутист не смог спастить еще и сурс к хуям сломал
 
Последнее редактирование:
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Ладно помогу скину готовый код
package dev.Kainer.functions.impl.render;

import com.google.common.eventbus.Subscribe;
import dev.Kainer.functions.settings.impl.ColorSetting;
import dev.Kainer.utils.client.IMinecraft;
import net.minecraft.client.renderer.ItemModelMesher;
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.ThrowableEntity;
import net.minecraft.item.Items;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockRayTraceResult;
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 dev.Kainer.events.EventDisplay;
import dev.Kainer.events.WorldEvent;
import dev.Kainer.functions.api.Category;
import dev.Kainer.functions.api.Function;
import dev.Kainer.functions.api.FunctionRegister;
import dev.Kainer.utils.math.Vector4i;
import dev.Kainer.utils.projections.ProjectionUtil;
import dev.Kainer.utils.render.ColorUtils;
import dev.Kainer.utils.render.DisplayUtils;
import dev.Kainer.utils.render.font.Fonts;
import net.minecraft.util.math.vector.Vector4f;

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

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

@FunctionRegister(name = "Predictions", type = Category.Render)
public class Predictions extends Function {



public Predictions() {
addSettings();
}

record PearlPoint(Vector3d position, int ticks) {
}

final List<PearlPoint> pearlPoints = new ArrayList<>();

@Subscribe
public void aa(EventDisplay e) {
for (PearlPoint pearlPoint : pearlPoints) {
Vector3d pos = pearlPoint.position;
Vector2f projection = ProjectionUtil.project(pos.x, pos.y - 0.3F, pos.z);
int ticks = pearlPoint.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 + 3, posY + 2 - 3, textWidth - 4, 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/ender_pearl.png"), (int) posX + 5 , (int) posY + 2 + 2.4f - 4, 11 , 11, -1);
Fonts.montserrat.drawText(e.getMatrixStack(), text, (float) (posX + 18), (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);

pearlPoints.clear();
for (Entity entity : mc.world.getAllEntities()) {
if (entity instanceof EnderPearlEntity 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) {
pearlPoints.add(new PearlPoint(pos, ticks));
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;
}
}
Элант можешь скинуть базу с альтменеджером кнопкой я просто аутист не смог спастить еще и сурс к хуям сломал
скину срк 1.0.7 если будут работать предиктионс (чуть позже проверю)
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Ладно помогу скину готовый код
package dev.Kainer.functions.impl.render;

import com.google.common.eventbus.Subscribe;
import dev.Kainer.functions.settings.impl.ColorSetting;
import dev.Kainer.utils.client.IMinecraft;
import net.minecraft.client.renderer.ItemModelMesher;
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.ThrowableEntity;
import net.minecraft.item.Items;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockRayTraceResult;
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 dev.Kainer.events.EventDisplay;
import dev.Kainer.events.WorldEvent;
import dev.Kainer.functions.api.Category;
import dev.Kainer.functions.api.Function;
import dev.Kainer.functions.api.FunctionRegister;
import dev.Kainer.utils.math.Vector4i;
import dev.Kainer.utils.projections.ProjectionUtil;
import dev.Kainer.utils.render.ColorUtils;
import dev.Kainer.utils.render.DisplayUtils;
import dev.Kainer.utils.render.font.Fonts;
import net.minecraft.util.math.vector.Vector4f;

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

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

@FunctionRegister(name = "Predictions", type = Category.Render)
public class Predictions extends Function {



public Predictions() {
addSettings();
}

record PearlPoint(Vector3d position, int ticks) {
}

final List<PearlPoint> pearlPoints = new ArrayList<>();

@Subscribe
public void aa(EventDisplay e) {
for (PearlPoint pearlPoint : pearlPoints) {
Vector3d pos = pearlPoint.position;
Vector2f projection = ProjectionUtil.project(pos.x, pos.y - 0.3F, pos.z);
int ticks = pearlPoint.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 + 3, posY + 2 - 3, textWidth - 4, 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/ender_pearl.png"), (int) posX + 5 , (int) posY + 2 + 2.4f - 4, 11 , 11, -1);
Fonts.montserrat.drawText(e.getMatrixStack(), text, (float) (posX + 18), (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);

pearlPoints.clear();
for (Entity entity : mc.world.getAllEntities()) {
if (entity instanceof EnderPearlEntity 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) {
pearlPoints.add(new PearlPoint(pos, ticks));
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;
}
}
Элант можешь скинуть базу с альтменеджером кнопкой я просто аутист не смог спастить еще и сурс к хуям сломал
щашвывшашывщашщзыв кайнер клиент
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
" Элант можешь скинуть базу с альтменеджером кнопкой я просто аутист не смог спастить еще и сурс к хуям сломал "
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Ладно помогу скину готовый код
package dev.Kainer.functions.impl.render;

import com.google.common.eventbus.Subscribe;
import dev.Kainer.functions.settings.impl.ColorSetting;
import dev.Kainer.utils.client.IMinecraft;
import net.minecraft.client.renderer.ItemModelMesher;
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.ThrowableEntity;
import net.minecraft.item.Items;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockRayTraceResult;
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 dev.Kainer.events.EventDisplay;
import dev.Kainer.events.WorldEvent;
import dev.Kainer.functions.api.Category;
import dev.Kainer.functions.api.Function;
import dev.Kainer.functions.api.FunctionRegister;
import dev.Kainer.utils.math.Vector4i;
import dev.Kainer.utils.projections.ProjectionUtil;
import dev.Kainer.utils.render.ColorUtils;
import dev.Kainer.utils.render.DisplayUtils;
import dev.Kainer.utils.render.font.Fonts;
import net.minecraft.util.math.vector.Vector4f;

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

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

@FunctionRegister(name = "Predictions", type = Category.Render)
public class Predictions extends Function {



public Predictions() {
addSettings();
}

record PearlPoint(Vector3d position, int ticks) {
}

final List<PearlPoint> pearlPoints = new ArrayList<>();

@Subscribe
public void aa(EventDisplay e) {
for (PearlPoint pearlPoint : pearlPoints) {
Vector3d pos = pearlPoint.position;
Vector2f projection = ProjectionUtil.project(pos.x, pos.y - 0.3F, pos.z);
int ticks = pearlPoint.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 + 3, posY + 2 - 3, textWidth - 4, 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/ender_pearl.png"), (int) posX + 5 , (int) posY + 2 + 2.4f - 4, 11 , 11, -1);
Fonts.montserrat.drawText(e.getMatrixStack(), text, (float) (posX + 18), (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);

pearlPoints.clear();
for (Entity entity : mc.world.getAllEntities()) {
if (entity instanceof EnderPearlEntity 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) {
pearlPoints.add(new PearlPoint(pos, ticks));
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;
}
}
Элант можешь скинуть базу с альтменеджером кнопкой я просто аутист не смог спастить еще и сурс к хуям сломал
кидай в др, дс у меня в аккаунте на юге
ну, как по мне выгодный обмен
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
кидай в др, дс у меня в аккаунте на юге

ну, как по мне выгодный обмен
1727608979052.png
Твой?
Все принимай
я даун просто дс imagal_1
не сразу понял
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Назад
Сверху Снизу