Подписывайтесь на наш Telegram и не пропускайте важные новости! Перейти

Вопрос Как сделать элитра таргет под рв?

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
25 Фев 2026
Сообщения
9
Реакции
0
govno:
Expand Collapse Copy
package ezz.onyx.features.modules.impl.combat;

import com.google.common.eventbus.Subscribe;
import ezz.onyx.api.event.impl.EventPacket;
import ezz.onyx.api.event.impl.EventTick;
import ezz.onyx.api.event.impl.EventVelocity;
import ezz.onyx.features.modules.api.Category;
import ezz.onyx.features.modules.api.Module;
import ezz.onyx.utility.other.InvUtil;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Items;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec2f;
import net.minecraft.util.math.Vec3d;

import static ezz.onyx.utility.Wrapper.mc;

public class ElytraTarget extends Module {
    public ElytraTarget() {
        super("ElytraTarget", Category.Combat);
    }


    LivingEntity target;


    @Subscribe
    public void onTick(EventTick e) {

        if (mc.player == null || mc.world == null) return;

//        if (!mc.player.getInventory().armor.get(1).isOf(Items.ELYTRA)) return;
        if (!mc.player.isGliding()) return;

        target = findDolboeb();

        if (target == null) return;

        if (getBPS(mc.player) < getBPS(target)) {

            InvUtil.swapAndUse(Items.FIREWORK_ROCKET);

        }


        mc.player.setYaw(getRotationsToEntity(target)[0]);
        mc.player.setPitch(getRotationsToEntity(target)[1]);


    }


    private LivingEntity findDolboeb() {

        LivingEntity minDistGlider = null;
        float distToGlider = Float.MAX_VALUE;
        LivingEntity minDist = null;
        float dist = Float.MAX_VALUE;

        for (Entity entity : mc.world.getEntities()) {

            if (!(entity instanceof LivingEntity entity1)) continue;
            if (entity1 == mc.player) continue;
            if (mc.player.distanceTo(entity1) > 50) continue;
            if (!mc.player.canSee(entity1)) continue;

            if (entity1.isGliding()) {

                if (mc.player.distanceTo(entity1) <= distToGlider) {

                    minDistGlider = entity1;
                    distToGlider = mc.player.distanceTo(entity1);

                }



            } else {

                if (mc.player.distanceTo(entity1) <= dist) {

                    minDist = entity1;
                    dist = mc.player.distanceTo(entity1);

                }

            }

        }

        if (minDistGlider == null && minDist == null) {
            return null;
        }


        if (minDistGlider != null) {

            return minDistGlider;

        } else {
            return minDist;
        }


    }

    public static float[] getRotationsToEntity(LivingEntity target) {
        Vec3d eyes = new Vec3d(mc.player.getX(), mc.player.getY() + mc.player.getEyeHeight(mc.player.getPose()), mc.player.getZ());
        Vec3d targetPos = new Vec3d(target.getX(), target.getY() + target.getEyeHeight(target.getPose()) - 0.1, target.getZ());
        double difX = targetPos.x - eyes.x;
        double difY = targetPos.y - eyes.y;
        double difZ = targetPos.z - eyes.z;
        double dist = Math.sqrt(difX * difX + difZ * difZ);
        float yaw = (float) Math.toDegrees(Math.atan2(difZ, difX)) - 90f;
        float pitch = (float) -Math.toDegrees(Math.atan2(difY, dist));
        while (yaw > 180f) yaw -= 360f;
        while (yaw < -180f) yaw += 360f;
        return new float[]{yaw, pitch};
    }

    public static double getBPS(LivingEntity player) {
        if (player == null) return 0;

        double dx = player.getX() - player.prevX;
        double dy = player.getY() - player.prevY;
        double dz = player.getZ() - player.prevZ;

        return Math.sqrt(dx * dx + dy * dy + dz * dz) * 20.0;
    }

}


сам сделал это, оно работает только на игроков, и морских мобов(хз почему) на других ничего не происходит.
 
Назад
Сверху Снизу