Исходник ElytraTarget мега умный // expensive 2.0

Начинающий
Статус
Оффлайн
Регистрация
4 Янв 2023
Сообщения
226
Реакции[?]
11
Поинты[?]
10K
Летит на феерверках и эликах за тергетом и бьёт его

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


Если добавить таргетить по Крос хаеру тогда всё идеально будет
ещё Добавить плавность в ротации при наводке на игрока



Java:
package wtf.levinov.modules.impl.SelfCode;

import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import lombok.Getter;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.client.gui.screen.inventory.CreativeScreen;
import net.minecraft.client.gui.screen.inventory.InventoryScreen;
import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.item.*;
import net.minecraft.network.play.client.CEntityActionPacket;
import net.minecraft.network.play.client.CHeldItemChangePacket;
import net.minecraft.network.play.client.CPlayerTryUseItemPacket;
import net.minecraft.potion.Effects;
import net.minecraft.tags.FluidTags;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import org.joml.Vector2d;
import org.lwjgl.opengl.GL11;
import wtf.levinov.events.Event;
import wtf.levinov.events.impl.player.*;
import wtf.levinov.events.impl.render.EventRender;
import wtf.levinov.managment.Managment;
import wtf.levinov.modules.Function;
import wtf.levinov.modules.FunctionAnnotation;
import wtf.levinov.modules.Type;
import wtf.levinov.modules.impl.combat.Aura;
import wtf.levinov.util.ClientUtil;
import wtf.levinov.util.MarkerUtils.Mathf;
import wtf.levinov.util.math.*;
import wtf.levinov.modules.settings.imp.BooleanOption;
import wtf.levinov.modules.settings.imp.ModeSetting;
import wtf.levinov.modules.settings.imp.MultiBoxSetting;
import wtf.levinov.modules.settings.imp.SliderSetting;
import wtf.levinov.util.render.ColorUtil;
import wtf.levinov.util.render.Interpolator;
import wtf.levinov.util.render.RenderUtil;
import wtf.levinov.util.world.InventoryUtil;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

import static java.lang.Math.*;
import static java.lang.Math.toRadians;
import static net.minecraft.util.math.MathHelper.clamp;
import static org.lwjgl.opengl.GL11C.GL_ONE;
import static org.lwjgl.opengl.GL11C.GL_SRC_ALPHA;
import static wtf.levinov.util.math.MathUtil.calculateDelta;
/**
* @author levka
* @since 07.06.2023
*/

@SuppressWarnings("all")
@FunctionAnnotation(name = "ElytraTarget", type = Type.SelfCode)
public class Target extends Function {
    @Getter
    // Таргет Энтити
    public static LivingEntity target = null;

    public Vector2f rotate = new Vector2f(0, 0);
    private final SliderSetting fireworkDelay = new SliderSetting("Задержка фейрверка", 1.5f, 0.5f, 5f, 0.1f);
    // Ротация выбор
    private final ModeSetting rotationMode = new ModeSetting("Мод", "Обычная", "Обычная");
    // Убивать кого
    private final ModeSetting sortMode = new ModeSetting("Сортировать",
            "По всему",
            "По всему", "По здоровью", "По дистанции"
    );
    // Цели - кого бить
    private final MultiBoxSetting targets = new MultiBoxSetting("Цели",
            new BooleanOption("Игроки", true),
            new BooleanOption("Друзья", false),
            new BooleanOption("Голые", true),
            new BooleanOption("Мобы", false)
    );
    // Дистация
    private final SliderSetting distance = new SliderSetting("Дистанция удара в полёте", 3.0f, 2.0f, 5.0f, 0.05f);
    // Дистанция ротации / НАВОДКА
    private final SliderSetting rotateDistance = new SliderSetting("Дистанция", 100.5f, 20.0f, 1000.0f, 0.05f).setVisible(() -> rotationMode.is("Обычная"));

    public final MultiBoxSetting settings = new MultiBoxSetting("Настройки",
            new BooleanOption("Только критами", true),
            new BooleanOption("Таргет ЕСП", true)
    );
    // Только криты вкл/выкл
    private final BooleanOption onlySpaceCritical = new BooleanOption("Только с пробелом", false)
            .setVisible(() -> settings.get(0));
    //Оно нахуй тут не нужно
    private final BooleanOption silent = new BooleanOption("Коррекция в полёте", true);
    // Визуал ESP
    private final ModeSetting targetVisualize = new ModeSetting("Визуализация цели",
            "Прицел",
            "Выключен", "Прицел","Круг"
    );

    int ticksUntilNextAttack;
    private boolean hasRotated;
    private long cpsLimit = 0;
    private ItemStack getStackInSlotCopy;
    private Item prevItemInHand = Items.AIR;
    private int slotWithFireWorks = -1;
    private long lastFireworkTime;
    private boolean flying;
    private int currentSpeed;
    private int ticksInAir;
    private boolean startFallFlying;
    private boolean starting;
    private Integer oldArmor = -1;
    public boolean isActive() {
        return state && starting;
    }
    // Добавление сетиннгов
    public Target() {
        this.addSettings(
                distance,
                targets,
                sortMode,
                rotateDistance,
                settings,
                fireworkDelay,
                onlySpaceCritical,
                targetVisualize,
                silent);
    }
    // Настройка коррекции
    @Override
    public void onEvent(final Event event) {
        if (event instanceof EventInteractEntity entity) {
            if (target != null)
                entity.setCancel(true);
        }
        if (event instanceof EventInput eventInput) {
            if (silent.get() && (target == null || !isValidTarget(target)) || !silent.get()) {
                    updateTarget(); //Обновление таргета после 1 килла
            }
        }
        if (event instanceof EventUpdate updateEvent) {
            if (!(target != null && isValidTarget(target))) {
                target = findTarget();
            }
            if (target == null) {
                cpsLimit = System.currentTimeMillis();
                rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
                return;
            }

            attackAndRotateOnEntity(target);
        }
        if (event instanceof EventMotion motionEvent) {
            handleMotionEvent(motionEvent);
        }
        if (event instanceof StartFallFlyingEvent) {
            //fly(false);
        }
        if (event instanceof EventUpdate) {
            if (mc.player.isOnGround()) {
                mc.player.jump();
                startFallFlying = false;
            }
            if (mc.player.fallDistance > 0 && !mc.player.isElytraFlying() && !startFallFlying) {
                mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.START_FALL_FLYING));
                startFallFlying = true;
                fly(false);
            }

            if (mc.player.isElytraFlying()) {
                fly(true);
            }
        }
        //Рендер ЕСП
        if (event instanceof EventRender e) {
            if (target != null) {
                if (targetVisualize.is("Прицел")) {  //Название вашего мода
                    draw(); //Для нового метода
                }
                if (targetVisualize.is("Круг")) {  //Название вашего мода
                    drawCircle(target, e); //Для нового метода
                }
            }
        }
    }
    private void noFireworks() {
        ClientUtil.sendMesage("Для данного Модуля нужны Феерверки");
        setState(false);
        onDisable();
        flying = false;
        ticksInAir = 0;
    }

    private void noElytra() {
        ClientUtil.sendMesage("Для данного Модуля нужны Элитры");
        setState(false);
        onDisable();
        flying = false;
        ticksInAir = 0;
    }

    private void fly(boolean started) {
        if (started && (float) (System.currentTimeMillis() - lastFireworkTime) < fireworkDelay.getValue().floatValue() * 1000.0f) {
            return;
        }
        if (started && !mc.player.isElytraFlying()) {
            return;
        }
        if (!started && ticksInAir > 1) {
            return;
        }
        int n2 = InventoryUtil.getFireWorks();

        if (n2 == -1) {
            slotWithFireWorks = -1;
            return;
        }
        slotWithFireWorks = n2;
        boolean bl3 = mc.player.getHeldItemOffhand().getItem() == Items.FIREWORK_ROCKET;
        if (!bl3) {
            mc.player.connection.sendPacket(new CHeldItemChangePacket(n2));
        }

        mc.player.connection.sendPacket(new CPlayerTryUseItemPacket(bl3 ? Hand.OFF_HAND : Hand.MAIN_HAND));
        if (!bl3) {
            mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
        }
        ++ticksInAir;
        flying = true;
        lastFireworkTime = System.currentTimeMillis();
    }


    public static int getElytraSlot() {
        if (mc.player.getItemStackFromSlot(EquipmentSlotType.CHEST).getItem() == Items.ELYTRA) {
            return -2;
        }
        if (mc.currentScreen instanceof ContainerScreen<?> && !(mc.currentScreen instanceof InventoryScreen) && !(mc.currentScreen instanceof CreativeScreen)) {
            return -1;
        }
        for (int i = 0; i < 45; ++i) {
            ItemStack is = mc.player.inventory.getStackInSlot(i);
            if (is.getItem() != Items.ELYTRA || !ElytraItem.isUsable(is)) continue;
            return i < 9 ? i + 36 : i;
        }
        return -1;
    }
    //Таргетить 1 цель для "Плавная"
    private void updateTarget() {
        List<LivingEntity> targets = new ArrayList<>();

        for (Entity entity : mc.world.getAllEntities()) {
            if (entity instanceof LivingEntity living && isValidTarget(living)) {
                targets.add(living);
            }
        }

        if (targets.isEmpty()) {
            target = null;
            return;
        }

        if (targets.size() == 1) {
            target = targets.get(0);
            return;
        }

        targets.sort(Comparator.comparingDouble(object -> {
            if (object instanceof PlayerEntity player) {
                return -getEntityArmor(player);
            }
            if (object instanceof LivingEntity base) {
                return -base.getTotalArmorValue();
            }
            return 0.0;
        }).thenComparing((object, object2) -> {
            double d2 = getEntityHealth((LivingEntity) object);
            double d3 = getEntityHealth((LivingEntity) object2);
            return Double.compare(d2, d3);
        }).thenComparing((object, object2) -> {
            double d2 = mc.player.getDistance((LivingEntity) object);
            double d3 = mc.player.getDistance((LivingEntity) object2);
            return Double.compare(d2, d3);
        }));

        target = targets.get(0);
    }
    private double distanceToTarget() {
        return mc.player.getDistance(target);
    }
    //Медод
    private double prevCircleStep, circleStep;
    //Где будет ESP для Прицел
    private final Vector2d markerPosition = new Vector2d();
    //target.png локация
    private final ResourceLocation markerLocation = new ResourceLocation("client/images/target.png");
    //Рендеринг ESP нурика
    private void draw() {
        if (target != null && mc.player != null) {
            Vector3d interpolatedPosition = wtf.levinov.util.MarkerUtils.RenderUtil.interpolate(target, mc.getRenderPartialTicks());
            double x = interpolatedPosition.x;
            double y = interpolatedPosition.y;
            double z = interpolatedPosition.z;
            Vector2d marker = wtf.levinov.util.MarkerUtils.RenderUtil.project(x, y + ((target.getEyeHeight() + 0.4F) * 0.5F), z);
            if (marker == null) return;
            markerPosition.x = Interpolator.lerp(markerPosition.x, marker.x, 1F);
            markerPosition.y = Interpolator.lerp(markerPosition.y, marker.y, 1F);
            float size = 120;
            double angle = (float) Mathf.clamp(0, 30, ((sin(System.currentTimeMillis() / 150D) + 1F) / 2F) * 30);
            double scale = (float) Mathf.clamp(0.8, 1, ((sin(System.currentTimeMillis() / 500D) + 1F) / 2F) * 1);
            double rotate = (float) Mathf.clamp(0, 360, ((sin(System.currentTimeMillis() / 1000D) + 1F) / 2F) * 360);
            GlStateManager.pushMatrix();
            GL11.glTranslatef((float) markerPosition.x, (float) markerPosition.y, 0.0F);
            GL11.glScaled(scale, scale, 1F);
            double sc = Mathf.clamp(0.75F, 1F, (1F - distanceToTarget() / distance.getValue().doubleValue()));
            sc = Interpolator.lerp(scale, sc, 0.5F);
            GL11.glScaled(sc, sc, sc);
            GL11.glTranslatef((float) (-markerPosition.x) - (size / 2F), (float) (-markerPosition.y), 0.0F);
            int color = ColorUtil.getColorStyle(0);
            GLUtils.startRotate((float) markerPosition.x + (size / 2F), (float) markerPosition.y, (float) (5F - (angle - 5F) + rotate));
            GlStateManager.enableBlend();
            GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE);
            wtf.levinov.util.MarkerUtils.RenderUtil.drawImage(markerLocation, markerPosition.x, markerPosition.y - (size / 2F), size, size, color);
            GlStateManager.disableBlend();
            GLUtils.endRotate();
            GlStateManager.popMatrix();
        }
    }
    //Рендеринг обычного круга
    private void drawCircle(LivingEntity target, EventRender e) {
        EntityRendererManager rm = mc.getRenderManager();

        double x = target.lastTickPosX + (target.getPosX() - target.lastTickPosX) * e.partialTicks - rm.info.getProjectedView().getX();
        double y = target.lastTickPosY + (target.getPosY() - target.lastTickPosY) * e.partialTicks - rm.info.getProjectedView().getY();
        double z = target.lastTickPosZ + (target.getPosZ() - target.lastTickPosZ) * e.partialTicks - rm.info.getProjectedView().getZ();
        float height = target.getHeight();

        double duration = 2000;
        double elapsed = (System.currentTimeMillis() % duration);

        boolean side = elapsed > (duration / 2);
        double progress = elapsed / (duration / 2);

        if (side) progress -= 1;
        else progress = 1 - progress;
        progress = (progress < 0.5) ? 2 * progress * progress : 1 - pow((-2 * progress + 2), 2) / 2;

        double eased = (height / 2) * ((progress > 0.5) ? 1 - progress : progress) * ((side) ? -1 : 1);
        RenderSystem.pushMatrix();
        GL11.glDepthMask(false);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
        RenderSystem.disableTexture();
        RenderSystem.enableBlend();
        RenderSystem.disableAlphaTest();
        RenderSystem.shadeModel(GL11.GL_SMOOTH);
        RenderSystem.disableCull();

        RenderSystem.lineWidth(1.5f);
        RenderSystem.color4f(-1f, -1f, -1f, -1f);

        buffer.begin(GL11.GL_QUAD_STRIP, DefaultVertexFormats.POSITION_COLOR);

        float[] colors = null;
        int firstColor = ColorUtil.getColorStyle(0.0F);
        for (int i = 0; i <= 360; i++) {
            colors = RenderUtil.IntColor.rgb(Managment.STYLE_MANAGER.getCurrentStyle().getColor(i));

            buffer.pos(x + cos(toRadians(i)) * target.getWidth() * 0.8, y + (height * progress), z + sin(toRadians(i)) * target.getWidth() * 0.8)
                    .color(colors[0], colors[1], colors[2], 0.5F).endVertex();
            buffer.pos(x + cos(toRadians(i)) * target.getWidth() * 0.8, y + (height * progress) + eased, z + sin(toRadians(i)) * target.getWidth() * 0.8)
                    .color(colors[0], colors[1], colors[2], 0F).endVertex();
        }

        buffer.finishDrawing();
        WorldVertexBufferUploader.draw(buffer);
        RenderSystem.color4f(-1f, -1f, -1f, -1f);

        buffer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR);

        for (int i = 0; i <= 360; i++) {
            buffer.pos(x + cos(toRadians(i)) * target.getWidth() * 0.8, y + (height * progress), z + sin(toRadians(i)) * target.getWidth() * 0.8)
                    .color(colors[0], colors[1], colors[2], 0.5F).endVertex();
        }

        buffer.finishDrawing();
        WorldVertexBufferUploader.draw(buffer);
        RenderSystem.enableCull();
        RenderSystem.disableBlend();
        RenderSystem.enableTexture();
        RenderSystem.enableAlphaTest();
        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
        RenderSystem.shadeModel(GL11.GL_FLAT);
        RenderSystem.popMatrix();
    }

    public Vector2f clientRot = null;

    private void handleMotionEvent(EventMotion motionEvent) {
        if (target == null || Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion)
            return;

        motionEvent.setYaw(rotate.x);
        motionEvent.setPitch(rotate.y);
        mc.player.rotationYawHead = rotate.x;
        mc.player.renderYawOffset = rotate.x;
        mc.player.rotationPitchHead = rotate.y;
    }
    private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
        Vector3d vec = target.getPositionVec().add(0, clamp(mc.player.getPosYEye() - target.getPosY(),
                        0, target.getHeight() * (mc.player.getDistance(target) / distance.getValue().floatValue())), 0)
                .subtract(mc.player.getEyePosition(1.0F));
    }

    //Ротации
    private void attackAndRotateOnEntity(LivingEntity target) {
        hasRotated = false;
        switch (rotationMode.getIndex()) {
            case 0 -> {
                hasRotated = false;
                if (shouldAttack(target) && RayTraceUtil.getMouseOver(target, rotate.x, rotate.y, distance.getValue().floatValue()) == target
                        && !Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
                    attackTarget(target);
                }
                if (!hasRotated)
                    setRotation(target, false);
                mc.player.rotationYaw = rotationsBedwars(target)[0];
                mc.player.rotationPitch = rotationsBedwars(target)[1];
                updateTarget();
            }
        }
    }

    private void attackTarget(final LivingEntity targetEntity) {
        if (settings.get(1) && mc.player.isBlocking()) {
            mc.playerController.onStoppedUsingItem(mc.player);
        }
        boolean sprint = false;
        if (CEntityActionPacket.lastUpdatedSprint && !mc.player.isInWater()) {
            mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.STOP_SPRINTING));
            sprint = true;
        }
        cpsLimit = System.currentTimeMillis() + 550;

        mc.playerController.attackEntity(mc.player, targetEntity);
        mc.player.swingArm(Hand.MAIN_HAND);

        if (sprint) {
            mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.START_SPRINTING));
        }
    }
    //Берёт в хотбар топор
    private boolean shouldAttack(LivingEntity targetEntity) {
        return canAttack() && targetEntity != null && (cpsLimit <= System.currentTimeMillis());
    }
    public float[] rotationsBedwars(LivingEntity entity) {
        double x = entity.getPosX() - mc.player.getPosX();
        double y = entity.getPosY() - (mc.player.getPosY() + mc.player.getEyeHeight()) + 1.1;
        double z = entity.getPosZ() - mc.player.getPosZ();

        double u = MathHelper.sqrt(x * x + z * z);

        float u2 = (float) (MathHelper.atan2(z, x) * (180D / Math.PI) - 90.0F);
        float u3 = (float) (-MathHelper.atan2(y, u) * (180D / Math.PI));

        return new float[]{u2, u3};
    }
    // Обычная ротация наводит
    private void setRotation(final LivingEntity base, final boolean attack) {
        this.hasRotated = true;

        Vector3d vec3d = AuraUtil.getVector(base);

        final double diffX = vec3d.x;
        final double diffY = vec3d.y;
        final double diffZ = vec3d.z;

        float[] rotations = new float[]{
                (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F,
                (float) (-Math.toDegrees(Math.atan2(diffY, Math.hypot(diffX, diffZ))))
        };

        float deltaYaw = MathHelper.wrapDegrees(calculateDelta(rotations[0], this.rotate.x));
        float deltaPitch = calculateDelta(rotations[1], this.rotate.y);

        float limitedYaw = min(max(abs(deltaYaw), 1.0F), 180.0F);
        float limitedPitch = (float) min(max(abs(deltaPitch), 1.0F), 15.0F);

        float finalYaw = this.rotate.x + (deltaYaw > 0.0f ? limitedYaw : -limitedYaw) + ThreadLocalRandom.current().nextFloat(-1, 1);
        float finalPitch = MathHelper.clamp(this.rotate.y + (deltaPitch > 0.0f ? limitedPitch : -limitedPitch) + ThreadLocalRandom.current().nextFloat(-1, 1), -89.0f, 89.0f);

        float gcd = GCDUtil.getGCDValue();
        finalYaw = (float) ((double) finalYaw - (double) (finalYaw - this.rotate.x) % gcd);
        finalPitch = (float) ((double) finalPitch - (double) (finalPitch - rotate.y) % gcd);

        this.rotate.x = finalYaw;
        this.rotate.y = finalPitch;
    }
    //Только криты
    public boolean canAttack() {
        final boolean onSpace = onlySpaceCritical.get()
                && mc.player.isOnGround()
                && !mc.gameSettings.keyBindJump.isKeyDown();

        final boolean reasonForAttack = mc.player.isPotionActive(Effects.BLINDNESS)
                || mc.player.isOnLadder()
                || mc.player.isInWater() && mc.player.areEyesInFluid(FluidTags.WATER)
                || mc.player.isRidingHorse()
                || mc.player.abilities.isFlying || mc.player.isElytraFlying();

        if (getDistance(target) >= distance.getValue().floatValue()
                || mc.player.getCooledAttackStrength(1.5F) < 0.92F) {
            return false;
        }
        if (Managment.FUNCTION_MANAGER.freeCam.player != null) return true;

        if (!reasonForAttack && settings.get(0)) {
            return onSpace || !mc.player.isOnGround() && mc.player.fallDistance > 0.0F;
        }
        return true;
    }

    private LivingEntity findTarget() {
        List<LivingEntity> targets = new ArrayList<>();

        for (Entity entity : mc.world.getAllEntities()) {
            if (entity instanceof LivingEntity && isValidTarget((LivingEntity) entity)) {
                targets.add((LivingEntity) entity);
            }
        }

        if (targets.isEmpty()) {
            return null;
        }

        if (targets.size() > 1) {
            switch (sortMode.get()) {
                case "По всему" -> {
                    targets.sort(Comparator.comparingDouble(target -> {
                        if (target instanceof PlayerEntity player) {
                            return -this.getEntityArmor(player);
                        }
                        if (target instanceof LivingEntity livingEntity) {
                            return -livingEntity.getTotalArmorValue();
                        }
                        return 0.0;
                    }).thenComparing((o, o1) -> {
                        double health = getEntityHealth((LivingEntity) o);
                        double health1 = getEntityHealth((LivingEntity) o1);
                        return Double.compare(health, health1);
                    }).thenComparing((object, object2) -> {
                        double d2 = getDistance((LivingEntity) object);
                        double d3 = getDistance((LivingEntity) object2);
                        return Double.compare(d2, d3);
                    }));
                }
                case "По дистанции" -> {
                    targets.sort(Comparator.comparingDouble(Managment.FUNCTION_MANAGER.targetik::getDistance).thenComparingDouble(this::getEntityHealth));
                }
                case "По здоровью" -> {
                    targets.sort(Comparator.comparingDouble(this::getEntityHealth).thenComparingDouble(mc.player::getDistance));
                }
            }
        } else {
            cpsLimit = System.currentTimeMillis();
        }
        return targets.get(0);
    }
    //Проверка Таргета на сочность
    private boolean isValidTarget(final LivingEntity base) {
        if (base.getShouldBeDead() || !base.isAlive() || base == mc.player) return false;

        if (base instanceof PlayerEntity) {
            String playerName = base.getName().getString();
            if (Managment.FRIEND_MANAGER.isFriend(playerName) && !targets.get(1)
                    || Managment.FUNCTION_MANAGER.freeCam.player != null && playerName.equals(Managment.FUNCTION_MANAGER
                    .freeCam.player.getName().getString())
                    || base.getTotalArmorValue() == 0 && (!targets.get(0) || !targets.get(2)))
                return false;
        }

        if ((base instanceof MobEntity || base instanceof AnimalEntity) && !targets.get(3)) return false;

        if (base instanceof ArmorStandEntity || base instanceof PlayerEntity && ((PlayerEntity) base).isBot)
            return false;

        return getDistance(base) <= distance.getValue().floatValue()
                + (rotationMode.is("Обычная") ? rotateDistance.getValue().floatValue() : 0.0f);

    }
    //Дистанция
    private double getDistance(LivingEntity entity) {
        return AuraUtil.getVector(entity).length();
    }

    public double getEntityArmor(PlayerEntity target) {
        double totalArmor = 0.0;

        for (ItemStack armorStack : target.inventory.armorInventory) {
            if (armorStack != null && armorStack.getItem() instanceof ArmorItem) {
                totalArmor += getProtectionLvl(armorStack);
            }
        }

        return totalArmor;
    }
    //Получение здоровья игрока
    public double getEntityHealth(Entity ent) {
        if (ent instanceof PlayerEntity player) {
            double armorValue = getEntityArmor(player) / 20.0;
            return (player.getHealth() + player.getAbsorptionAmount()) * armorValue;
        } else if (ent instanceof LivingEntity livingEntity) {
            return livingEntity.getHealth() + livingEntity.getAbsorptionAmount();
        }
        return 0.0;
    }


    private double getProtectionLvl(ItemStack stack) {
        ArmorItem armor = (ArmorItem) stack.getItem();
        double damageReduce = armor.getDamageReduceAmount();
        if (stack.isEnchanted()) {
            damageReduce += (double) EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25;
        }
        return damageReduce;
    }
    @Override
    public void onEnable() {
        int elytraItem = getElytraSlot();
        if (mc.player.getItemStackFromSlot(EquipmentSlotType.CHEST).getItem() != Items.ELYTRA && mc.player.inventory.getItemStack().getItem() != Items.ELYTRA && getElytraSlot() == -1) {
            noElytra();
            return;
        }
        if (InventoryUtil.getFireWorks() == -1) {
            noFireworks();
            return;
        }

        if (elytraItem != -2) {
            mc.playerController.windowClick(0, elytraItem, 0, ClickType.PICKUP, mc.player);
            mc.playerController.windowClick(0, 6, 0, ClickType.PICKUP, mc.player);
            mc.playerController.windowClick(0, elytraItem, 0, ClickType.PICKUP, mc.player);
            this.oldArmor = elytraItem;
        }
    }

    @Override
    public void onDisable() {
        currentSpeed = 0;
        startFallFlying = false;
        if (oldArmor != -1) {
            mc.playerController.windowClick(0, oldArmor, 0, ClickType.PICKUP, mc.player);
            mc.playerController.windowClick(0, 6, 0, ClickType.PICKUP, mc.player);
            mc.playerController.windowClick(0, oldArmor, 0, ClickType.PICKUP, mc.player);
            oldArmor = -1;
        }
        this.rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
        target = null;
        cpsLimit = System.currentTimeMillis();
        super.onDisable();
    }
}
 
Начинающий
Статус
Оффлайн
Регистрация
5 Апр 2023
Сообщения
389
Реакции[?]
1
Поинты[?]
2K
Летит на феерверках и эликах за тергетом и бьёт его

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


Если добавить таргетить по Крос хаеру тогда всё идеально будет
ещё Добавить плавность в ротации при наводке на игрока



Java:
package wtf.levinov.modules.impl.SelfCode;

import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import lombok.Getter;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.client.gui.screen.inventory.CreativeScreen;
import net.minecraft.client.gui.screen.inventory.InventoryScreen;
import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.item.*;
import net.minecraft.network.play.client.CEntityActionPacket;
import net.minecraft.network.play.client.CHeldItemChangePacket;
import net.minecraft.network.play.client.CPlayerTryUseItemPacket;
import net.minecraft.potion.Effects;
import net.minecraft.tags.FluidTags;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import org.joml.Vector2d;
import org.lwjgl.opengl.GL11;
import wtf.levinov.events.Event;
import wtf.levinov.events.impl.player.*;
import wtf.levinov.events.impl.render.EventRender;
import wtf.levinov.managment.Managment;
import wtf.levinov.modules.Function;
import wtf.levinov.modules.FunctionAnnotation;
import wtf.levinov.modules.Type;
import wtf.levinov.modules.impl.combat.Aura;
import wtf.levinov.util.ClientUtil;
import wtf.levinov.util.MarkerUtils.Mathf;
import wtf.levinov.util.math.*;
import wtf.levinov.modules.settings.imp.BooleanOption;
import wtf.levinov.modules.settings.imp.ModeSetting;
import wtf.levinov.modules.settings.imp.MultiBoxSetting;
import wtf.levinov.modules.settings.imp.SliderSetting;
import wtf.levinov.util.render.ColorUtil;
import wtf.levinov.util.render.Interpolator;
import wtf.levinov.util.render.RenderUtil;
import wtf.levinov.util.world.InventoryUtil;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

import static java.lang.Math.*;
import static java.lang.Math.toRadians;
import static net.minecraft.util.math.MathHelper.clamp;
import static org.lwjgl.opengl.GL11C.GL_ONE;
import static org.lwjgl.opengl.GL11C.GL_SRC_ALPHA;
import static wtf.levinov.util.math.MathUtil.calculateDelta;
/**
* @author levka
* @since 07.06.2023
*/

@SuppressWarnings("all")
@FunctionAnnotation(name = "ElytraTarget", type = Type.SelfCode)
public class Target extends Function {
    @Getter
    // Таргет Энтити
    public static LivingEntity target = null;

    public Vector2f rotate = new Vector2f(0, 0);
    private final SliderSetting fireworkDelay = new SliderSetting("Задержка фейрверка", 1.5f, 0.5f, 5f, 0.1f);
    // Ротация выбор
    private final ModeSetting rotationMode = new ModeSetting("Мод", "Обычная", "Обычная");
    // Убивать кого
    private final ModeSetting sortMode = new ModeSetting("Сортировать",
            "По всему",
            "По всему", "По здоровью", "По дистанции"
    );
    // Цели - кого бить
    private final MultiBoxSetting targets = new MultiBoxSetting("Цели",
            new BooleanOption("Игроки", true),
            new BooleanOption("Друзья", false),
            new BooleanOption("Голые", true),
            new BooleanOption("Мобы", false)
    );
    // Дистация
    private final SliderSetting distance = new SliderSetting("Дистанция удара в полёте", 3.0f, 2.0f, 5.0f, 0.05f);
    // Дистанция ротации / НАВОДКА
    private final SliderSetting rotateDistance = new SliderSetting("Дистанция", 100.5f, 20.0f, 1000.0f, 0.05f).setVisible(() -> rotationMode.is("Обычная"));

    public final MultiBoxSetting settings = new MultiBoxSetting("Настройки",
            new BooleanOption("Только критами", true),
            new BooleanOption("Таргет ЕСП", true)
    );
    // Только криты вкл/выкл
    private final BooleanOption onlySpaceCritical = new BooleanOption("Только с пробелом", false)
            .setVisible(() -> settings.get(0));
    //Оно нахуй тут не нужно
    private final BooleanOption silent = new BooleanOption("Коррекция в полёте", true);
    // Визуал ESP
    private final ModeSetting targetVisualize = new ModeSetting("Визуализация цели",
            "Прицел",
            "Выключен", "Прицел","Круг"
    );

    int ticksUntilNextAttack;
    private boolean hasRotated;
    private long cpsLimit = 0;
    private ItemStack getStackInSlotCopy;
    private Item prevItemInHand = Items.AIR;
    private int slotWithFireWorks = -1;
    private long lastFireworkTime;
    private boolean flying;
    private int currentSpeed;
    private int ticksInAir;
    private boolean startFallFlying;
    private boolean starting;
    private Integer oldArmor = -1;
    public boolean isActive() {
        return state && starting;
    }
    // Добавление сетиннгов
    public Target() {
        this.addSettings(
                distance,
                targets,
                sortMode,
                rotateDistance,
                settings,
                fireworkDelay,
                onlySpaceCritical,
                targetVisualize,
                silent);
    }
    // Настройка коррекции
    @Override
    public void onEvent(final Event event) {
        if (event instanceof EventInteractEntity entity) {
            if (target != null)
                entity.setCancel(true);
        }
        if (event instanceof EventInput eventInput) {
            if (silent.get() && (target == null || !isValidTarget(target)) || !silent.get()) {
                    updateTarget(); //Обновление таргета после 1 килла
            }
        }
        if (event instanceof EventUpdate updateEvent) {
            if (!(target != null && isValidTarget(target))) {
                target = findTarget();
            }
            if (target == null) {
                cpsLimit = System.currentTimeMillis();
                rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
                return;
            }

            attackAndRotateOnEntity(target);
        }
        if (event instanceof EventMotion motionEvent) {
            handleMotionEvent(motionEvent);
        }
        if (event instanceof StartFallFlyingEvent) {
            //fly(false);
        }
        if (event instanceof EventUpdate) {
            if (mc.player.isOnGround()) {
                mc.player.jump();
                startFallFlying = false;
            }
            if (mc.player.fallDistance > 0 && !mc.player.isElytraFlying() && !startFallFlying) {
                mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.START_FALL_FLYING));
                startFallFlying = true;
                fly(false);
            }

            if (mc.player.isElytraFlying()) {
                fly(true);
            }
        }
        //Рендер ЕСП
        if (event instanceof EventRender e) {
            if (target != null) {
                if (targetVisualize.is("Прицел")) {  //Название вашего мода
                    draw(); //Для нового метода
                }
                if (targetVisualize.is("Круг")) {  //Название вашего мода
                    drawCircle(target, e); //Для нового метода
                }
            }
        }
    }
    private void noFireworks() {
        ClientUtil.sendMesage("Для данного Модуля нужны Феерверки");
        setState(false);
        onDisable();
        flying = false;
        ticksInAir = 0;
    }

    private void noElytra() {
        ClientUtil.sendMesage("Для данного Модуля нужны Элитры");
        setState(false);
        onDisable();
        flying = false;
        ticksInAir = 0;
    }

    private void fly(boolean started) {
        if (started && (float) (System.currentTimeMillis() - lastFireworkTime) < fireworkDelay.getValue().floatValue() * 1000.0f) {
            return;
        }
        if (started && !mc.player.isElytraFlying()) {
            return;
        }
        if (!started && ticksInAir > 1) {
            return;
        }
        int n2 = InventoryUtil.getFireWorks();

        if (n2 == -1) {
            slotWithFireWorks = -1;
            return;
        }
        slotWithFireWorks = n2;
        boolean bl3 = mc.player.getHeldItemOffhand().getItem() == Items.FIREWORK_ROCKET;
        if (!bl3) {
            mc.player.connection.sendPacket(new CHeldItemChangePacket(n2));
        }

        mc.player.connection.sendPacket(new CPlayerTryUseItemPacket(bl3 ? Hand.OFF_HAND : Hand.MAIN_HAND));
        if (!bl3) {
            mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
        }
        ++ticksInAir;
        flying = true;
        lastFireworkTime = System.currentTimeMillis();
    }


    public static int getElytraSlot() {
        if (mc.player.getItemStackFromSlot(EquipmentSlotType.CHEST).getItem() == Items.ELYTRA) {
            return -2;
        }
        if (mc.currentScreen instanceof ContainerScreen<?> && !(mc.currentScreen instanceof InventoryScreen) && !(mc.currentScreen instanceof CreativeScreen)) {
            return -1;
        }
        for (int i = 0; i < 45; ++i) {
            ItemStack is = mc.player.inventory.getStackInSlot(i);
            if (is.getItem() != Items.ELYTRA || !ElytraItem.isUsable(is)) continue;
            return i < 9 ? i + 36 : i;
        }
        return -1;
    }
    //Таргетить 1 цель для "Плавная"
    private void updateTarget() {
        List<LivingEntity> targets = new ArrayList<>();

        for (Entity entity : mc.world.getAllEntities()) {
            if (entity instanceof LivingEntity living && isValidTarget(living)) {
                targets.add(living);
            }
        }

        if (targets.isEmpty()) {
            target = null;
            return;
        }

        if (targets.size() == 1) {
            target = targets.get(0);
            return;
        }

        targets.sort(Comparator.comparingDouble(object -> {
            if (object instanceof PlayerEntity player) {
                return -getEntityArmor(player);
            }
            if (object instanceof LivingEntity base) {
                return -base.getTotalArmorValue();
            }
            return 0.0;
        }).thenComparing((object, object2) -> {
            double d2 = getEntityHealth((LivingEntity) object);
            double d3 = getEntityHealth((LivingEntity) object2);
            return Double.compare(d2, d3);
        }).thenComparing((object, object2) -> {
            double d2 = mc.player.getDistance((LivingEntity) object);
            double d3 = mc.player.getDistance((LivingEntity) object2);
            return Double.compare(d2, d3);
        }));

        target = targets.get(0);
    }
    private double distanceToTarget() {
        return mc.player.getDistance(target);
    }
    //Медод
    private double prevCircleStep, circleStep;
    //Где будет ESP для Прицел
    private final Vector2d markerPosition = new Vector2d();
    //target.png локация
    private final ResourceLocation markerLocation = new ResourceLocation("client/images/target.png");
    //Рендеринг ESP нурика
    private void draw() {
        if (target != null && mc.player != null) {
            Vector3d interpolatedPosition = wtf.levinov.util.MarkerUtils.RenderUtil.interpolate(target, mc.getRenderPartialTicks());
            double x = interpolatedPosition.x;
            double y = interpolatedPosition.y;
            double z = interpolatedPosition.z;
            Vector2d marker = wtf.levinov.util.MarkerUtils.RenderUtil.project(x, y + ((target.getEyeHeight() + 0.4F) * 0.5F), z);
            if (marker == null) return;
            markerPosition.x = Interpolator.lerp(markerPosition.x, marker.x, 1F);
            markerPosition.y = Interpolator.lerp(markerPosition.y, marker.y, 1F);
            float size = 120;
            double angle = (float) Mathf.clamp(0, 30, ((sin(System.currentTimeMillis() / 150D) + 1F) / 2F) * 30);
            double scale = (float) Mathf.clamp(0.8, 1, ((sin(System.currentTimeMillis() / 500D) + 1F) / 2F) * 1);
            double rotate = (float) Mathf.clamp(0, 360, ((sin(System.currentTimeMillis() / 1000D) + 1F) / 2F) * 360);
            GlStateManager.pushMatrix();
            GL11.glTranslatef((float) markerPosition.x, (float) markerPosition.y, 0.0F);
            GL11.glScaled(scale, scale, 1F);
            double sc = Mathf.clamp(0.75F, 1F, (1F - distanceToTarget() / distance.getValue().doubleValue()));
            sc = Interpolator.lerp(scale, sc, 0.5F);
            GL11.glScaled(sc, sc, sc);
            GL11.glTranslatef((float) (-markerPosition.x) - (size / 2F), (float) (-markerPosition.y), 0.0F);
            int color = ColorUtil.getColorStyle(0);
            GLUtils.startRotate((float) markerPosition.x + (size / 2F), (float) markerPosition.y, (float) (5F - (angle - 5F) + rotate));
            GlStateManager.enableBlend();
            GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE);
            wtf.levinov.util.MarkerUtils.RenderUtil.drawImage(markerLocation, markerPosition.x, markerPosition.y - (size / 2F), size, size, color);
            GlStateManager.disableBlend();
            GLUtils.endRotate();
            GlStateManager.popMatrix();
        }
    }
    //Рендеринг обычного круга
    private void drawCircle(LivingEntity target, EventRender e) {
        EntityRendererManager rm = mc.getRenderManager();

        double x = target.lastTickPosX + (target.getPosX() - target.lastTickPosX) * e.partialTicks - rm.info.getProjectedView().getX();
        double y = target.lastTickPosY + (target.getPosY() - target.lastTickPosY) * e.partialTicks - rm.info.getProjectedView().getY();
        double z = target.lastTickPosZ + (target.getPosZ() - target.lastTickPosZ) * e.partialTicks - rm.info.getProjectedView().getZ();
        float height = target.getHeight();

        double duration = 2000;
        double elapsed = (System.currentTimeMillis() % duration);

        boolean side = elapsed > (duration / 2);
        double progress = elapsed / (duration / 2);

        if (side) progress -= 1;
        else progress = 1 - progress;
        progress = (progress < 0.5) ? 2 * progress * progress : 1 - pow((-2 * progress + 2), 2) / 2;

        double eased = (height / 2) * ((progress > 0.5) ? 1 - progress : progress) * ((side) ? -1 : 1);
        RenderSystem.pushMatrix();
        GL11.glDepthMask(false);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
        RenderSystem.disableTexture();
        RenderSystem.enableBlend();
        RenderSystem.disableAlphaTest();
        RenderSystem.shadeModel(GL11.GL_SMOOTH);
        RenderSystem.disableCull();

        RenderSystem.lineWidth(1.5f);
        RenderSystem.color4f(-1f, -1f, -1f, -1f);

        buffer.begin(GL11.GL_QUAD_STRIP, DefaultVertexFormats.POSITION_COLOR);

        float[] colors = null;
        int firstColor = ColorUtil.getColorStyle(0.0F);
        for (int i = 0; i <= 360; i++) {
            colors = RenderUtil.IntColor.rgb(Managment.STYLE_MANAGER.getCurrentStyle().getColor(i));

            buffer.pos(x + cos(toRadians(i)) * target.getWidth() * 0.8, y + (height * progress), z + sin(toRadians(i)) * target.getWidth() * 0.8)
                    .color(colors[0], colors[1], colors[2], 0.5F).endVertex();
            buffer.pos(x + cos(toRadians(i)) * target.getWidth() * 0.8, y + (height * progress) + eased, z + sin(toRadians(i)) * target.getWidth() * 0.8)
                    .color(colors[0], colors[1], colors[2], 0F).endVertex();
        }

        buffer.finishDrawing();
        WorldVertexBufferUploader.draw(buffer);
        RenderSystem.color4f(-1f, -1f, -1f, -1f);

        buffer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR);

        for (int i = 0; i <= 360; i++) {
            buffer.pos(x + cos(toRadians(i)) * target.getWidth() * 0.8, y + (height * progress), z + sin(toRadians(i)) * target.getWidth() * 0.8)
                    .color(colors[0], colors[1], colors[2], 0.5F).endVertex();
        }

        buffer.finishDrawing();
        WorldVertexBufferUploader.draw(buffer);
        RenderSystem.enableCull();
        RenderSystem.disableBlend();
        RenderSystem.enableTexture();
        RenderSystem.enableAlphaTest();
        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
        RenderSystem.shadeModel(GL11.GL_FLAT);
        RenderSystem.popMatrix();
    }

    public Vector2f clientRot = null;

    private void handleMotionEvent(EventMotion motionEvent) {
        if (target == null || Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion)
            return;

        motionEvent.setYaw(rotate.x);
        motionEvent.setPitch(rotate.y);
        mc.player.rotationYawHead = rotate.x;
        mc.player.renderYawOffset = rotate.x;
        mc.player.rotationPitchHead = rotate.y;
    }
    private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
        Vector3d vec = target.getPositionVec().add(0, clamp(mc.player.getPosYEye() - target.getPosY(),
                        0, target.getHeight() * (mc.player.getDistance(target) / distance.getValue().floatValue())), 0)
                .subtract(mc.player.getEyePosition(1.0F));
    }

    //Ротации
    private void attackAndRotateOnEntity(LivingEntity target) {
        hasRotated = false;
        switch (rotationMode.getIndex()) {
            case 0 -> {
                hasRotated = false;
                if (shouldAttack(target) && RayTraceUtil.getMouseOver(target, rotate.x, rotate.y, distance.getValue().floatValue()) == target
                        && !Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
                    attackTarget(target);
                }
                if (!hasRotated)
                    setRotation(target, false);
                mc.player.rotationYaw = rotationsBedwars(target)[0];
                mc.player.rotationPitch = rotationsBedwars(target)[1];
                updateTarget();
            }
        }
    }

    private void attackTarget(final LivingEntity targetEntity) {
        if (settings.get(1) && mc.player.isBlocking()) {
            mc.playerController.onStoppedUsingItem(mc.player);
        }
        boolean sprint = false;
        if (CEntityActionPacket.lastUpdatedSprint && !mc.player.isInWater()) {
            mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.STOP_SPRINTING));
            sprint = true;
        }
        cpsLimit = System.currentTimeMillis() + 550;

        mc.playerController.attackEntity(mc.player, targetEntity);
        mc.player.swingArm(Hand.MAIN_HAND);

        if (sprint) {
            mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.START_SPRINTING));
        }
    }
    //Берёт в хотбар топор
    private boolean shouldAttack(LivingEntity targetEntity) {
        return canAttack() && targetEntity != null && (cpsLimit <= System.currentTimeMillis());
    }
    public float[] rotationsBedwars(LivingEntity entity) {
        double x = entity.getPosX() - mc.player.getPosX();
        double y = entity.getPosY() - (mc.player.getPosY() + mc.player.getEyeHeight()) + 1.1;
        double z = entity.getPosZ() - mc.player.getPosZ();

        double u = MathHelper.sqrt(x * x + z * z);

        float u2 = (float) (MathHelper.atan2(z, x) * (180D / Math.PI) - 90.0F);
        float u3 = (float) (-MathHelper.atan2(y, u) * (180D / Math.PI));

        return new float[]{u2, u3};
    }
    // Обычная ротация наводит
    private void setRotation(final LivingEntity base, final boolean attack) {
        this.hasRotated = true;

        Vector3d vec3d = AuraUtil.getVector(base);

        final double diffX = vec3d.x;
        final double diffY = vec3d.y;
        final double diffZ = vec3d.z;

        float[] rotations = new float[]{
                (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F,
                (float) (-Math.toDegrees(Math.atan2(diffY, Math.hypot(diffX, diffZ))))
        };

        float deltaYaw = MathHelper.wrapDegrees(calculateDelta(rotations[0], this.rotate.x));
        float deltaPitch = calculateDelta(rotations[1], this.rotate.y);

        float limitedYaw = min(max(abs(deltaYaw), 1.0F), 180.0F);
        float limitedPitch = (float) min(max(abs(deltaPitch), 1.0F), 15.0F);

        float finalYaw = this.rotate.x + (deltaYaw > 0.0f ? limitedYaw : -limitedYaw) + ThreadLocalRandom.current().nextFloat(-1, 1);
        float finalPitch = MathHelper.clamp(this.rotate.y + (deltaPitch > 0.0f ? limitedPitch : -limitedPitch) + ThreadLocalRandom.current().nextFloat(-1, 1), -89.0f, 89.0f);

        float gcd = GCDUtil.getGCDValue();
        finalYaw = (float) ((double) finalYaw - (double) (finalYaw - this.rotate.x) % gcd);
        finalPitch = (float) ((double) finalPitch - (double) (finalPitch - rotate.y) % gcd);

        this.rotate.x = finalYaw;
        this.rotate.y = finalPitch;
    }
    //Только криты
    public boolean canAttack() {
        final boolean onSpace = onlySpaceCritical.get()
                && mc.player.isOnGround()
                && !mc.gameSettings.keyBindJump.isKeyDown();

        final boolean reasonForAttack = mc.player.isPotionActive(Effects.BLINDNESS)
                || mc.player.isOnLadder()
                || mc.player.isInWater() && mc.player.areEyesInFluid(FluidTags.WATER)
                || mc.player.isRidingHorse()
                || mc.player.abilities.isFlying || mc.player.isElytraFlying();

        if (getDistance(target) >= distance.getValue().floatValue()
                || mc.player.getCooledAttackStrength(1.5F) < 0.92F) {
            return false;
        }
        if (Managment.FUNCTION_MANAGER.freeCam.player != null) return true;

        if (!reasonForAttack && settings.get(0)) {
            return onSpace || !mc.player.isOnGround() && mc.player.fallDistance > 0.0F;
        }
        return true;
    }

    private LivingEntity findTarget() {
        List<LivingEntity> targets = new ArrayList<>();

        for (Entity entity : mc.world.getAllEntities()) {
            if (entity instanceof LivingEntity && isValidTarget((LivingEntity) entity)) {
                targets.add((LivingEntity) entity);
            }
        }

        if (targets.isEmpty()) {
            return null;
        }

        if (targets.size() > 1) {
            switch (sortMode.get()) {
                case "По всему" -> {
                    targets.sort(Comparator.comparingDouble(target -> {
                        if (target instanceof PlayerEntity player) {
                            return -this.getEntityArmor(player);
                        }
                        if (target instanceof LivingEntity livingEntity) {
                            return -livingEntity.getTotalArmorValue();
                        }
                        return 0.0;
                    }).thenComparing((o, o1) -> {
                        double health = getEntityHealth((LivingEntity) o);
                        double health1 = getEntityHealth((LivingEntity) o1);
                        return Double.compare(health, health1);
                    }).thenComparing((object, object2) -> {
                        double d2 = getDistance((LivingEntity) object);
                        double d3 = getDistance((LivingEntity) object2);
                        return Double.compare(d2, d3);
                    }));
                }
                case "По дистанции" -> {
                    targets.sort(Comparator.comparingDouble(Managment.FUNCTION_MANAGER.targetik::getDistance).thenComparingDouble(this::getEntityHealth));
                }
                case "По здоровью" -> {
                    targets.sort(Comparator.comparingDouble(this::getEntityHealth).thenComparingDouble(mc.player::getDistance));
                }
            }
        } else {
            cpsLimit = System.currentTimeMillis();
        }
        return targets.get(0);
    }
    //Проверка Таргета на сочность
    private boolean isValidTarget(final LivingEntity base) {
        if (base.getShouldBeDead() || !base.isAlive() || base == mc.player) return false;

        if (base instanceof PlayerEntity) {
            String playerName = base.getName().getString();
            if (Managment.FRIEND_MANAGER.isFriend(playerName) && !targets.get(1)
                    || Managment.FUNCTION_MANAGER.freeCam.player != null && playerName.equals(Managment.FUNCTION_MANAGER
                    .freeCam.player.getName().getString())
                    || base.getTotalArmorValue() == 0 && (!targets.get(0) || !targets.get(2)))
                return false;
        }

        if ((base instanceof MobEntity || base instanceof AnimalEntity) && !targets.get(3)) return false;

        if (base instanceof ArmorStandEntity || base instanceof PlayerEntity && ((PlayerEntity) base).isBot)
            return false;

        return getDistance(base) <= distance.getValue().floatValue()
                + (rotationMode.is("Обычная") ? rotateDistance.getValue().floatValue() : 0.0f);

    }
    //Дистанция
    private double getDistance(LivingEntity entity) {
        return AuraUtil.getVector(entity).length();
    }

    public double getEntityArmor(PlayerEntity target) {
        double totalArmor = 0.0;

        for (ItemStack armorStack : target.inventory.armorInventory) {
            if (armorStack != null && armorStack.getItem() instanceof ArmorItem) {
                totalArmor += getProtectionLvl(armorStack);
            }
        }

        return totalArmor;
    }
    //Получение здоровья игрока
    public double getEntityHealth(Entity ent) {
        if (ent instanceof PlayerEntity player) {
            double armorValue = getEntityArmor(player) / 20.0;
            return (player.getHealth() + player.getAbsorptionAmount()) * armorValue;
        } else if (ent instanceof LivingEntity livingEntity) {
            return livingEntity.getHealth() + livingEntity.getAbsorptionAmount();
        }
        return 0.0;
    }


    private double getProtectionLvl(ItemStack stack) {
        ArmorItem armor = (ArmorItem) stack.getItem();
        double damageReduce = armor.getDamageReduceAmount();
        if (stack.isEnchanted()) {
            damageReduce += (double) EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25;
        }
        return damageReduce;
    }
    @Override
    public void onEnable() {
        int elytraItem = getElytraSlot();
        if (mc.player.getItemStackFromSlot(EquipmentSlotType.CHEST).getItem() != Items.ELYTRA && mc.player.inventory.getItemStack().getItem() != Items.ELYTRA && getElytraSlot() == -1) {
            noElytra();
            return;
        }
        if (InventoryUtil.getFireWorks() == -1) {
            noFireworks();
            return;
        }

        if (elytraItem != -2) {
            mc.playerController.windowClick(0, elytraItem, 0, ClickType.PICKUP, mc.player);
            mc.playerController.windowClick(0, 6, 0, ClickType.PICKUP, mc.player);
            mc.playerController.windowClick(0, elytraItem, 0, ClickType.PICKUP, mc.player);
            this.oldArmor = elytraItem;
        }
    }

    @Override
    public void onDisable() {
        currentSpeed = 0;
        startFallFlying = false;
        if (oldArmor != -1) {
            mc.playerController.windowClick(0, oldArmor, 0, ClickType.PICKUP, mc.player);
            mc.playerController.windowClick(0, 6, 0, ClickType.PICKUP, mc.player);
            mc.playerController.windowClick(0, oldArmor, 0, ClickType.PICKUP, mc.player);
            oldArmor = -1;
        }
        this.rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
        target = null;
        cpsLimit = System.currentTimeMillis();
        super.onDisable();
    }
}
1711200235860.png
ладно...
aurora code and KILLAURA XD)
XDXD AURORA DEAD XDXD
 
Начинающий
Статус
Оффлайн
Регистрация
31 Июл 2022
Сообщения
397
Реакции[?]
18
Поинты[?]
17K
Летит на феерверках и эликах за тергетом и бьёт его

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


Если добавить таргетить по Крос хаеру тогда всё идеально будет
ещё Добавить плавность в ротации при наводке на игрока



Java:
package wtf.levinov.modules.impl.SelfCode;

import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import lombok.Getter;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.client.gui.screen.inventory.CreativeScreen;
import net.minecraft.client.gui.screen.inventory.InventoryScreen;
import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.item.*;
import net.minecraft.network.play.client.CEntityActionPacket;
import net.minecraft.network.play.client.CHeldItemChangePacket;
import net.minecraft.network.play.client.CPlayerTryUseItemPacket;
import net.minecraft.potion.Effects;
import net.minecraft.tags.FluidTags;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import org.joml.Vector2d;
import org.lwjgl.opengl.GL11;
import wtf.levinov.events.Event;
import wtf.levinov.events.impl.player.*;
import wtf.levinov.events.impl.render.EventRender;
import wtf.levinov.managment.Managment;
import wtf.levinov.modules.Function;
import wtf.levinov.modules.FunctionAnnotation;
import wtf.levinov.modules.Type;
import wtf.levinov.modules.impl.combat.Aura;
import wtf.levinov.util.ClientUtil;
import wtf.levinov.util.MarkerUtils.Mathf;
import wtf.levinov.util.math.*;
import wtf.levinov.modules.settings.imp.BooleanOption;
import wtf.levinov.modules.settings.imp.ModeSetting;
import wtf.levinov.modules.settings.imp.MultiBoxSetting;
import wtf.levinov.modules.settings.imp.SliderSetting;
import wtf.levinov.util.render.ColorUtil;
import wtf.levinov.util.render.Interpolator;
import wtf.levinov.util.render.RenderUtil;
import wtf.levinov.util.world.InventoryUtil;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

import static java.lang.Math.*;
import static java.lang.Math.toRadians;
import static net.minecraft.util.math.MathHelper.clamp;
import static org.lwjgl.opengl.GL11C.GL_ONE;
import static org.lwjgl.opengl.GL11C.GL_SRC_ALPHA;
import static wtf.levinov.util.math.MathUtil.calculateDelta;
/**
* @author levka
* @since 07.06.2023
*/

@SuppressWarnings("all")
@FunctionAnnotation(name = "ElytraTarget", type = Type.SelfCode)
public class Target extends Function {
    @Getter
    // Таргет Энтити
    public static LivingEntity target = null;

    public Vector2f rotate = new Vector2f(0, 0);
    private final SliderSetting fireworkDelay = new SliderSetting("Задержка фейрверка", 1.5f, 0.5f, 5f, 0.1f);
    // Ротация выбор
    private final ModeSetting rotationMode = new ModeSetting("Мод", "Обычная", "Обычная");
    // Убивать кого
    private final ModeSetting sortMode = new ModeSetting("Сортировать",
            "По всему",
            "По всему", "По здоровью", "По дистанции"
    );
    // Цели - кого бить
    private final MultiBoxSetting targets = new MultiBoxSetting("Цели",
            new BooleanOption("Игроки", true),
            new BooleanOption("Друзья", false),
            new BooleanOption("Голые", true),
            new BooleanOption("Мобы", false)
    );
    // Дистация
    private final SliderSetting distance = new SliderSetting("Дистанция удара в полёте", 3.0f, 2.0f, 5.0f, 0.05f);
    // Дистанция ротации / НАВОДКА
    private final SliderSetting rotateDistance = new SliderSetting("Дистанция", 100.5f, 20.0f, 1000.0f, 0.05f).setVisible(() -> rotationMode.is("Обычная"));

    public final MultiBoxSetting settings = new MultiBoxSetting("Настройки",
            new BooleanOption("Только критами", true),
            new BooleanOption("Таргет ЕСП", true)
    );
    // Только криты вкл/выкл
    private final BooleanOption onlySpaceCritical = new BooleanOption("Только с пробелом", false)
            .setVisible(() -> settings.get(0));
    //Оно нахуй тут не нужно
    private final BooleanOption silent = new BooleanOption("Коррекция в полёте", true);
    // Визуал ESP
    private final ModeSetting targetVisualize = new ModeSetting("Визуализация цели",
            "Прицел",
            "Выключен", "Прицел","Круг"
    );

    int ticksUntilNextAttack;
    private boolean hasRotated;
    private long cpsLimit = 0;
    private ItemStack getStackInSlotCopy;
    private Item prevItemInHand = Items.AIR;
    private int slotWithFireWorks = -1;
    private long lastFireworkTime;
    private boolean flying;
    private int currentSpeed;
    private int ticksInAir;
    private boolean startFallFlying;
    private boolean starting;
    private Integer oldArmor = -1;
    public boolean isActive() {
        return state && starting;
    }
    // Добавление сетиннгов
    public Target() {
        this.addSettings(
                distance,
                targets,
                sortMode,
                rotateDistance,
                settings,
                fireworkDelay,
                onlySpaceCritical,
                targetVisualize,
                silent);
    }
    // Настройка коррекции
    @Override
    public void onEvent(final Event event) {
        if (event instanceof EventInteractEntity entity) {
            if (target != null)
                entity.setCancel(true);
        }
        if (event instanceof EventInput eventInput) {
            if (silent.get() && (target == null || !isValidTarget(target)) || !silent.get()) {
                    updateTarget(); //Обновление таргета после 1 килла
            }
        }
        if (event instanceof EventUpdate updateEvent) {
            if (!(target != null && isValidTarget(target))) {
                target = findTarget();
            }
            if (target == null) {
                cpsLimit = System.currentTimeMillis();
                rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
                return;
            }

            attackAndRotateOnEntity(target);
        }
        if (event instanceof EventMotion motionEvent) {
            handleMotionEvent(motionEvent);
        }
        if (event instanceof StartFallFlyingEvent) {
            //fly(false);
        }
        if (event instanceof EventUpdate) {
            if (mc.player.isOnGround()) {
                mc.player.jump();
                startFallFlying = false;
            }
            if (mc.player.fallDistance > 0 && !mc.player.isElytraFlying() && !startFallFlying) {
                mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.START_FALL_FLYING));
                startFallFlying = true;
                fly(false);
            }

            if (mc.player.isElytraFlying()) {
                fly(true);
            }
        }
        //Рендер ЕСП
        if (event instanceof EventRender e) {
            if (target != null) {
                if (targetVisualize.is("Прицел")) {  //Название вашего мода
                    draw(); //Для нового метода
                }
                if (targetVisualize.is("Круг")) {  //Название вашего мода
                    drawCircle(target, e); //Для нового метода
                }
            }
        }
    }
    private void noFireworks() {
        ClientUtil.sendMesage("Для данного Модуля нужны Феерверки");
        setState(false);
        onDisable();
        flying = false;
        ticksInAir = 0;
    }

    private void noElytra() {
        ClientUtil.sendMesage("Для данного Модуля нужны Элитры");
        setState(false);
        onDisable();
        flying = false;
        ticksInAir = 0;
    }

    private void fly(boolean started) {
        if (started && (float) (System.currentTimeMillis() - lastFireworkTime) < fireworkDelay.getValue().floatValue() * 1000.0f) {
            return;
        }
        if (started && !mc.player.isElytraFlying()) {
            return;
        }
        if (!started && ticksInAir > 1) {
            return;
        }
        int n2 = InventoryUtil.getFireWorks();

        if (n2 == -1) {
            slotWithFireWorks = -1;
            return;
        }
        slotWithFireWorks = n2;
        boolean bl3 = mc.player.getHeldItemOffhand().getItem() == Items.FIREWORK_ROCKET;
        if (!bl3) {
            mc.player.connection.sendPacket(new CHeldItemChangePacket(n2));
        }

        mc.player.connection.sendPacket(new CPlayerTryUseItemPacket(bl3 ? Hand.OFF_HAND : Hand.MAIN_HAND));
        if (!bl3) {
            mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
        }
        ++ticksInAir;
        flying = true;
        lastFireworkTime = System.currentTimeMillis();
    }


    public static int getElytraSlot() {
        if (mc.player.getItemStackFromSlot(EquipmentSlotType.CHEST).getItem() == Items.ELYTRA) {
            return -2;
        }
        if (mc.currentScreen instanceof ContainerScreen<?> && !(mc.currentScreen instanceof InventoryScreen) && !(mc.currentScreen instanceof CreativeScreen)) {
            return -1;
        }
        for (int i = 0; i < 45; ++i) {
            ItemStack is = mc.player.inventory.getStackInSlot(i);
            if (is.getItem() != Items.ELYTRA || !ElytraItem.isUsable(is)) continue;
            return i < 9 ? i + 36 : i;
        }
        return -1;
    }
    //Таргетить 1 цель для "Плавная"
    private void updateTarget() {
        List<LivingEntity> targets = new ArrayList<>();

        for (Entity entity : mc.world.getAllEntities()) {
            if (entity instanceof LivingEntity living && isValidTarget(living)) {
                targets.add(living);
            }
        }

        if (targets.isEmpty()) {
            target = null;
            return;
        }

        if (targets.size() == 1) {
            target = targets.get(0);
            return;
        }

        targets.sort(Comparator.comparingDouble(object -> {
            if (object instanceof PlayerEntity player) {
                return -getEntityArmor(player);
            }
            if (object instanceof LivingEntity base) {
                return -base.getTotalArmorValue();
            }
            return 0.0;
        }).thenComparing((object, object2) -> {
            double d2 = getEntityHealth((LivingEntity) object);
            double d3 = getEntityHealth((LivingEntity) object2);
            return Double.compare(d2, d3);
        }).thenComparing((object, object2) -> {
            double d2 = mc.player.getDistance((LivingEntity) object);
            double d3 = mc.player.getDistance((LivingEntity) object2);
            return Double.compare(d2, d3);
        }));

        target = targets.get(0);
    }
    private double distanceToTarget() {
        return mc.player.getDistance(target);
    }
    //Медод
    private double prevCircleStep, circleStep;
    //Где будет ESP для Прицел
    private final Vector2d markerPosition = new Vector2d();
    //target.png локация
    private final ResourceLocation markerLocation = new ResourceLocation("client/images/target.png");
    //Рендеринг ESP нурика
    private void draw() {
        if (target != null && mc.player != null) {
            Vector3d interpolatedPosition = wtf.levinov.util.MarkerUtils.RenderUtil.interpolate(target, mc.getRenderPartialTicks());
            double x = interpolatedPosition.x;
            double y = interpolatedPosition.y;
            double z = interpolatedPosition.z;
            Vector2d marker = wtf.levinov.util.MarkerUtils.RenderUtil.project(x, y + ((target.getEyeHeight() + 0.4F) * 0.5F), z);
            if (marker == null) return;
            markerPosition.x = Interpolator.lerp(markerPosition.x, marker.x, 1F);
            markerPosition.y = Interpolator.lerp(markerPosition.y, marker.y, 1F);
            float size = 120;
            double angle = (float) Mathf.clamp(0, 30, ((sin(System.currentTimeMillis() / 150D) + 1F) / 2F) * 30);
            double scale = (float) Mathf.clamp(0.8, 1, ((sin(System.currentTimeMillis() / 500D) + 1F) / 2F) * 1);
            double rotate = (float) Mathf.clamp(0, 360, ((sin(System.currentTimeMillis() / 1000D) + 1F) / 2F) * 360);
            GlStateManager.pushMatrix();
            GL11.glTranslatef((float) markerPosition.x, (float) markerPosition.y, 0.0F);
            GL11.glScaled(scale, scale, 1F);
            double sc = Mathf.clamp(0.75F, 1F, (1F - distanceToTarget() / distance.getValue().doubleValue()));
            sc = Interpolator.lerp(scale, sc, 0.5F);
            GL11.glScaled(sc, sc, sc);
            GL11.glTranslatef((float) (-markerPosition.x) - (size / 2F), (float) (-markerPosition.y), 0.0F);
            int color = ColorUtil.getColorStyle(0);
            GLUtils.startRotate((float) markerPosition.x + (size / 2F), (float) markerPosition.y, (float) (5F - (angle - 5F) + rotate));
            GlStateManager.enableBlend();
            GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE);
            wtf.levinov.util.MarkerUtils.RenderUtil.drawImage(markerLocation, markerPosition.x, markerPosition.y - (size / 2F), size, size, color);
            GlStateManager.disableBlend();
            GLUtils.endRotate();
            GlStateManager.popMatrix();
        }
    }
    //Рендеринг обычного круга
    private void drawCircle(LivingEntity target, EventRender e) {
        EntityRendererManager rm = mc.getRenderManager();

        double x = target.lastTickPosX + (target.getPosX() - target.lastTickPosX) * e.partialTicks - rm.info.getProjectedView().getX();
        double y = target.lastTickPosY + (target.getPosY() - target.lastTickPosY) * e.partialTicks - rm.info.getProjectedView().getY();
        double z = target.lastTickPosZ + (target.getPosZ() - target.lastTickPosZ) * e.partialTicks - rm.info.getProjectedView().getZ();
        float height = target.getHeight();

        double duration = 2000;
        double elapsed = (System.currentTimeMillis() % duration);

        boolean side = elapsed > (duration / 2);
        double progress = elapsed / (duration / 2);

        if (side) progress -= 1;
        else progress = 1 - progress;
        progress = (progress < 0.5) ? 2 * progress * progress : 1 - pow((-2 * progress + 2), 2) / 2;

        double eased = (height / 2) * ((progress > 0.5) ? 1 - progress : progress) * ((side) ? -1 : 1);
        RenderSystem.pushMatrix();
        GL11.glDepthMask(false);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
        RenderSystem.disableTexture();
        RenderSystem.enableBlend();
        RenderSystem.disableAlphaTest();
        RenderSystem.shadeModel(GL11.GL_SMOOTH);
        RenderSystem.disableCull();

        RenderSystem.lineWidth(1.5f);
        RenderSystem.color4f(-1f, -1f, -1f, -1f);

        buffer.begin(GL11.GL_QUAD_STRIP, DefaultVertexFormats.POSITION_COLOR);

        float[] colors = null;
        int firstColor = ColorUtil.getColorStyle(0.0F);
        for (int i = 0; i <= 360; i++) {
            colors = RenderUtil.IntColor.rgb(Managment.STYLE_MANAGER.getCurrentStyle().getColor(i));

            buffer.pos(x + cos(toRadians(i)) * target.getWidth() * 0.8, y + (height * progress), z + sin(toRadians(i)) * target.getWidth() * 0.8)
                    .color(colors[0], colors[1], colors[2], 0.5F).endVertex();
            buffer.pos(x + cos(toRadians(i)) * target.getWidth() * 0.8, y + (height * progress) + eased, z + sin(toRadians(i)) * target.getWidth() * 0.8)
                    .color(colors[0], colors[1], colors[2], 0F).endVertex();
        }

        buffer.finishDrawing();
        WorldVertexBufferUploader.draw(buffer);
        RenderSystem.color4f(-1f, -1f, -1f, -1f);

        buffer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR);

        for (int i = 0; i <= 360; i++) {
            buffer.pos(x + cos(toRadians(i)) * target.getWidth() * 0.8, y + (height * progress), z + sin(toRadians(i)) * target.getWidth() * 0.8)
                    .color(colors[0], colors[1], colors[2], 0.5F).endVertex();
        }

        buffer.finishDrawing();
        WorldVertexBufferUploader.draw(buffer);
        RenderSystem.enableCull();
        RenderSystem.disableBlend();
        RenderSystem.enableTexture();
        RenderSystem.enableAlphaTest();
        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
        RenderSystem.shadeModel(GL11.GL_FLAT);
        RenderSystem.popMatrix();
    }

    public Vector2f clientRot = null;

    private void handleMotionEvent(EventMotion motionEvent) {
        if (target == null || Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion)
            return;

        motionEvent.setYaw(rotate.x);
        motionEvent.setPitch(rotate.y);
        mc.player.rotationYawHead = rotate.x;
        mc.player.renderYawOffset = rotate.x;
        mc.player.rotationPitchHead = rotate.y;
    }
    private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
        Vector3d vec = target.getPositionVec().add(0, clamp(mc.player.getPosYEye() - target.getPosY(),
                        0, target.getHeight() * (mc.player.getDistance(target) / distance.getValue().floatValue())), 0)
                .subtract(mc.player.getEyePosition(1.0F));
    }

    //Ротации
    private void attackAndRotateOnEntity(LivingEntity target) {
        hasRotated = false;
        switch (rotationMode.getIndex()) {
            case 0 -> {
                hasRotated = false;
                if (shouldAttack(target) && RayTraceUtil.getMouseOver(target, rotate.x, rotate.y, distance.getValue().floatValue()) == target
                        && !Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
                    attackTarget(target);
                }
                if (!hasRotated)
                    setRotation(target, false);
                mc.player.rotationYaw = rotationsBedwars(target)[0];
                mc.player.rotationPitch = rotationsBedwars(target)[1];
                updateTarget();
            }
        }
    }

    private void attackTarget(final LivingEntity targetEntity) {
        if (settings.get(1) && mc.player.isBlocking()) {
            mc.playerController.onStoppedUsingItem(mc.player);
        }
        boolean sprint = false;
        if (CEntityActionPacket.lastUpdatedSprint && !mc.player.isInWater()) {
            mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.STOP_SPRINTING));
            sprint = true;
        }
        cpsLimit = System.currentTimeMillis() + 550;

        mc.playerController.attackEntity(mc.player, targetEntity);
        mc.player.swingArm(Hand.MAIN_HAND);

        if (sprint) {
            mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.START_SPRINTING));
        }
    }
    //Берёт в хотбар топор
    private boolean shouldAttack(LivingEntity targetEntity) {
        return canAttack() && targetEntity != null && (cpsLimit <= System.currentTimeMillis());
    }
    public float[] rotationsBedwars(LivingEntity entity) {
        double x = entity.getPosX() - mc.player.getPosX();
        double y = entity.getPosY() - (mc.player.getPosY() + mc.player.getEyeHeight()) + 1.1;
        double z = entity.getPosZ() - mc.player.getPosZ();

        double u = MathHelper.sqrt(x * x + z * z);

        float u2 = (float) (MathHelper.atan2(z, x) * (180D / Math.PI) - 90.0F);
        float u3 = (float) (-MathHelper.atan2(y, u) * (180D / Math.PI));

        return new float[]{u2, u3};
    }
    // Обычная ротация наводит
    private void setRotation(final LivingEntity base, final boolean attack) {
        this.hasRotated = true;

        Vector3d vec3d = AuraUtil.getVector(base);

        final double diffX = vec3d.x;
        final double diffY = vec3d.y;
        final double diffZ = vec3d.z;

        float[] rotations = new float[]{
                (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F,
                (float) (-Math.toDegrees(Math.atan2(diffY, Math.hypot(diffX, diffZ))))
        };

        float deltaYaw = MathHelper.wrapDegrees(calculateDelta(rotations[0], this.rotate.x));
        float deltaPitch = calculateDelta(rotations[1], this.rotate.y);

        float limitedYaw = min(max(abs(deltaYaw), 1.0F), 180.0F);
        float limitedPitch = (float) min(max(abs(deltaPitch), 1.0F), 15.0F);

        float finalYaw = this.rotate.x + (deltaYaw > 0.0f ? limitedYaw : -limitedYaw) + ThreadLocalRandom.current().nextFloat(-1, 1);
        float finalPitch = MathHelper.clamp(this.rotate.y + (deltaPitch > 0.0f ? limitedPitch : -limitedPitch) + ThreadLocalRandom.current().nextFloat(-1, 1), -89.0f, 89.0f);

        float gcd = GCDUtil.getGCDValue();
        finalYaw = (float) ((double) finalYaw - (double) (finalYaw - this.rotate.x) % gcd);
        finalPitch = (float) ((double) finalPitch - (double) (finalPitch - rotate.y) % gcd);

        this.rotate.x = finalYaw;
        this.rotate.y = finalPitch;
    }
    //Только криты
    public boolean canAttack() {
        final boolean onSpace = onlySpaceCritical.get()
                && mc.player.isOnGround()
                && !mc.gameSettings.keyBindJump.isKeyDown();

        final boolean reasonForAttack = mc.player.isPotionActive(Effects.BLINDNESS)
                || mc.player.isOnLadder()
                || mc.player.isInWater() && mc.player.areEyesInFluid(FluidTags.WATER)
                || mc.player.isRidingHorse()
                || mc.player.abilities.isFlying || mc.player.isElytraFlying();

        if (getDistance(target) >= distance.getValue().floatValue()
                || mc.player.getCooledAttackStrength(1.5F) < 0.92F) {
            return false;
        }
        if (Managment.FUNCTION_MANAGER.freeCam.player != null) return true;

        if (!reasonForAttack && settings.get(0)) {
            return onSpace || !mc.player.isOnGround() && mc.player.fallDistance > 0.0F;
        }
        return true;
    }

    private LivingEntity findTarget() {
        List<LivingEntity> targets = new ArrayList<>();

        for (Entity entity : mc.world.getAllEntities()) {
            if (entity instanceof LivingEntity && isValidTarget((LivingEntity) entity)) {
                targets.add((LivingEntity) entity);
            }
        }

        if (targets.isEmpty()) {
            return null;
        }

        if (targets.size() > 1) {
            switch (sortMode.get()) {
                case "По всему" -> {
                    targets.sort(Comparator.comparingDouble(target -> {
                        if (target instanceof PlayerEntity player) {
                            return -this.getEntityArmor(player);
                        }
                        if (target instanceof LivingEntity livingEntity) {
                            return -livingEntity.getTotalArmorValue();
                        }
                        return 0.0;
                    }).thenComparing((o, o1) -> {
                        double health = getEntityHealth((LivingEntity) o);
                        double health1 = getEntityHealth((LivingEntity) o1);
                        return Double.compare(health, health1);
                    }).thenComparing((object, object2) -> {
                        double d2 = getDistance((LivingEntity) object);
                        double d3 = getDistance((LivingEntity) object2);
                        return Double.compare(d2, d3);
                    }));
                }
                case "По дистанции" -> {
                    targets.sort(Comparator.comparingDouble(Managment.FUNCTION_MANAGER.targetik::getDistance).thenComparingDouble(this::getEntityHealth));
                }
                case "По здоровью" -> {
                    targets.sort(Comparator.comparingDouble(this::getEntityHealth).thenComparingDouble(mc.player::getDistance));
                }
            }
        } else {
            cpsLimit = System.currentTimeMillis();
        }
        return targets.get(0);
    }
    //Проверка Таргета на сочность
    private boolean isValidTarget(final LivingEntity base) {
        if (base.getShouldBeDead() || !base.isAlive() || base == mc.player) return false;

        if (base instanceof PlayerEntity) {
            String playerName = base.getName().getString();
            if (Managment.FRIEND_MANAGER.isFriend(playerName) && !targets.get(1)
                    || Managment.FUNCTION_MANAGER.freeCam.player != null && playerName.equals(Managment.FUNCTION_MANAGER
                    .freeCam.player.getName().getString())
                    || base.getTotalArmorValue() == 0 && (!targets.get(0) || !targets.get(2)))
                return false;
        }

        if ((base instanceof MobEntity || base instanceof AnimalEntity) && !targets.get(3)) return false;

        if (base instanceof ArmorStandEntity || base instanceof PlayerEntity && ((PlayerEntity) base).isBot)
            return false;

        return getDistance(base) <= distance.getValue().floatValue()
                + (rotationMode.is("Обычная") ? rotateDistance.getValue().floatValue() : 0.0f);

    }
    //Дистанция
    private double getDistance(LivingEntity entity) {
        return AuraUtil.getVector(entity).length();
    }

    public double getEntityArmor(PlayerEntity target) {
        double totalArmor = 0.0;

        for (ItemStack armorStack : target.inventory.armorInventory) {
            if (armorStack != null && armorStack.getItem() instanceof ArmorItem) {
                totalArmor += getProtectionLvl(armorStack);
            }
        }

        return totalArmor;
    }
    //Получение здоровья игрока
    public double getEntityHealth(Entity ent) {
        if (ent instanceof PlayerEntity player) {
            double armorValue = getEntityArmor(player) / 20.0;
            return (player.getHealth() + player.getAbsorptionAmount()) * armorValue;
        } else if (ent instanceof LivingEntity livingEntity) {
            return livingEntity.getHealth() + livingEntity.getAbsorptionAmount();
        }
        return 0.0;
    }


    private double getProtectionLvl(ItemStack stack) {
        ArmorItem armor = (ArmorItem) stack.getItem();
        double damageReduce = armor.getDamageReduceAmount();
        if (stack.isEnchanted()) {
            damageReduce += (double) EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25;
        }
        return damageReduce;
    }
    @Override
    public void onEnable() {
        int elytraItem = getElytraSlot();
        if (mc.player.getItemStackFromSlot(EquipmentSlotType.CHEST).getItem() != Items.ELYTRA && mc.player.inventory.getItemStack().getItem() != Items.ELYTRA && getElytraSlot() == -1) {
            noElytra();
            return;
        }
        if (InventoryUtil.getFireWorks() == -1) {
            noFireworks();
            return;
        }

        if (elytraItem != -2) {
            mc.playerController.windowClick(0, elytraItem, 0, ClickType.PICKUP, mc.player);
            mc.playerController.windowClick(0, 6, 0, ClickType.PICKUP, mc.player);
            mc.playerController.windowClick(0, elytraItem, 0, ClickType.PICKUP, mc.player);
            this.oldArmor = elytraItem;
        }
    }

    @Override
    public void onDisable() {
        currentSpeed = 0;
        startFallFlying = false;
        if (oldArmor != -1) {
            mc.playerController.windowClick(0, oldArmor, 0, ClickType.PICKUP, mc.player);
            mc.playerController.windowClick(0, 6, 0, ClickType.PICKUP, mc.player);
            mc.playerController.windowClick(0, oldArmor, 0, ClickType.PICKUP, mc.player);
            oldArmor = -1;
        }
        this.rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
        target = null;
        cpsLimit = System.currentTimeMillis();
        super.onDisable();
    }
}
лёва ти заибал
 
Начинающий
Статус
Оффлайн
Регистрация
14 Июн 2023
Сообщения
77
Реакции[?]
0
Поинты[?]
0
Летит на феерверках и эликах за тергетом и бьёт его

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


Если добавить таргетить по Крос хаеру тогда всё идеально будет
ещё Добавить плавность в ротации при наводке на игрока



Java:
package wtf.levinov.modules.impl.SelfCode;

import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import lombok.Getter;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.client.gui.screen.inventory.CreativeScreen;
import net.minecraft.client.gui.screen.inventory.InventoryScreen;
import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.item.*;
import net.minecraft.network.play.client.CEntityActionPacket;
import net.minecraft.network.play.client.CHeldItemChangePacket;
import net.minecraft.network.play.client.CPlayerTryUseItemPacket;
import net.minecraft.potion.Effects;
import net.minecraft.tags.FluidTags;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import org.joml.Vector2d;
import org.lwjgl.opengl.GL11;
import wtf.levinov.events.Event;
import wtf.levinov.events.impl.player.*;
import wtf.levinov.events.impl.render.EventRender;
import wtf.levinov.managment.Managment;
import wtf.levinov.modules.Function;
import wtf.levinov.modules.FunctionAnnotation;
import wtf.levinov.modules.Type;
import wtf.levinov.modules.impl.combat.Aura;
import wtf.levinov.util.ClientUtil;
import wtf.levinov.util.MarkerUtils.Mathf;
import wtf.levinov.util.math.*;
import wtf.levinov.modules.settings.imp.BooleanOption;
import wtf.levinov.modules.settings.imp.ModeSetting;
import wtf.levinov.modules.settings.imp.MultiBoxSetting;
import wtf.levinov.modules.settings.imp.SliderSetting;
import wtf.levinov.util.render.ColorUtil;
import wtf.levinov.util.render.Interpolator;
import wtf.levinov.util.render.RenderUtil;
import wtf.levinov.util.world.InventoryUtil;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

import static java.lang.Math.*;
import static java.lang.Math.toRadians;
import static net.minecraft.util.math.MathHelper.clamp;
import static org.lwjgl.opengl.GL11C.GL_ONE;
import static org.lwjgl.opengl.GL11C.GL_SRC_ALPHA;
import static wtf.levinov.util.math.MathUtil.calculateDelta;
/**
* @author levka
* @since 07.06.2023
*/

@SuppressWarnings("all")
@FunctionAnnotation(name = "ElytraTarget", type = Type.SelfCode)
public class Target extends Function {
    @Getter
    // Таргет Энтити
    public static LivingEntity target = null;

    public Vector2f rotate = new Vector2f(0, 0);
    private final SliderSetting fireworkDelay = new SliderSetting("Задержка фейрверка", 1.5f, 0.5f, 5f, 0.1f);
    // Ротация выбор
    private final ModeSetting rotationMode = new ModeSetting("Мод", "Обычная", "Обычная");
    // Убивать кого
    private final ModeSetting sortMode = new ModeSetting("Сортировать",
            "По всему",
            "По всему", "По здоровью", "По дистанции"
    );
    // Цели - кого бить
    private final MultiBoxSetting targets = new MultiBoxSetting("Цели",
            new BooleanOption("Игроки", true),
            new BooleanOption("Друзья", false),
            new BooleanOption("Голые", true),
            new BooleanOption("Мобы", false)
    );
    // Дистация
    private final SliderSetting distance = new SliderSetting("Дистанция удара в полёте", 3.0f, 2.0f, 5.0f, 0.05f);
    // Дистанция ротации / НАВОДКА
    private final SliderSetting rotateDistance = new SliderSetting("Дистанция", 100.5f, 20.0f, 1000.0f, 0.05f).setVisible(() -> rotationMode.is("Обычная"));

    public final MultiBoxSetting settings = new MultiBoxSetting("Настройки",
            new BooleanOption("Только критами", true),
            new BooleanOption("Таргет ЕСП", true)
    );
    // Только криты вкл/выкл
    private final BooleanOption onlySpaceCritical = new BooleanOption("Только с пробелом", false)
            .setVisible(() -> settings.get(0));
    //Оно нахуй тут не нужно
    private final BooleanOption silent = new BooleanOption("Коррекция в полёте", true);
    // Визуал ESP
    private final ModeSetting targetVisualize = new ModeSetting("Визуализация цели",
            "Прицел",
            "Выключен", "Прицел","Круг"
    );

    int ticksUntilNextAttack;
    private boolean hasRotated;
    private long cpsLimit = 0;
    private ItemStack getStackInSlotCopy;
    private Item prevItemInHand = Items.AIR;
    private int slotWithFireWorks = -1;
    private long lastFireworkTime;
    private boolean flying;
    private int currentSpeed;
    private int ticksInAir;
    private boolean startFallFlying;
    private boolean starting;
    private Integer oldArmor = -1;
    public boolean isActive() {
        return state && starting;
    }
    // Добавление сетиннгов
    public Target() {
        this.addSettings(
                distance,
                targets,
                sortMode,
                rotateDistance,
                settings,
                fireworkDelay,
                onlySpaceCritical,
                targetVisualize,
                silent);
    }
    // Настройка коррекции
    @Override
    public void onEvent(final Event event) {
        if (event instanceof EventInteractEntity entity) {
            if (target != null)
                entity.setCancel(true);
        }
        if (event instanceof EventInput eventInput) {
            if (silent.get() && (target == null || !isValidTarget(target)) || !silent.get()) {
                    updateTarget(); //Обновление таргета после 1 килла
            }
        }
        if (event instanceof EventUpdate updateEvent) {
            if (!(target != null && isValidTarget(target))) {
                target = findTarget();
            }
            if (target == null) {
                cpsLimit = System.currentTimeMillis();
                rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
                return;
            }

            attackAndRotateOnEntity(target);
        }
        if (event instanceof EventMotion motionEvent) {
            handleMotionEvent(motionEvent);
        }
        if (event instanceof StartFallFlyingEvent) {
            //fly(false);
        }
        if (event instanceof EventUpdate) {
            if (mc.player.isOnGround()) {
                mc.player.jump();
                startFallFlying = false;
            }
            if (mc.player.fallDistance > 0 && !mc.player.isElytraFlying() && !startFallFlying) {
                mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.START_FALL_FLYING));
                startFallFlying = true;
                fly(false);
            }

            if (mc.player.isElytraFlying()) {
                fly(true);
            }
        }
        //Рендер ЕСП
        if (event instanceof EventRender e) {
            if (target != null) {
                if (targetVisualize.is("Прицел")) {  //Название вашего мода
                    draw(); //Для нового метода
                }
                if (targetVisualize.is("Круг")) {  //Название вашего мода
                    drawCircle(target, e); //Для нового метода
                }
            }
        }
    }
    private void noFireworks() {
        ClientUtil.sendMesage("Для данного Модуля нужны Феерверки");
        setState(false);
        onDisable();
        flying = false;
        ticksInAir = 0;
    }

    private void noElytra() {
        ClientUtil.sendMesage("Для данного Модуля нужны Элитры");
        setState(false);
        onDisable();
        flying = false;
        ticksInAir = 0;
    }

    private void fly(boolean started) {
        if (started && (float) (System.currentTimeMillis() - lastFireworkTime) < fireworkDelay.getValue().floatValue() * 1000.0f) {
            return;
        }
        if (started && !mc.player.isElytraFlying()) {
            return;
        }
        if (!started && ticksInAir > 1) {
            return;
        }
        int n2 = InventoryUtil.getFireWorks();

        if (n2 == -1) {
            slotWithFireWorks = -1;
            return;
        }
        slotWithFireWorks = n2;
        boolean bl3 = mc.player.getHeldItemOffhand().getItem() == Items.FIREWORK_ROCKET;
        if (!bl3) {
            mc.player.connection.sendPacket(new CHeldItemChangePacket(n2));
        }

        mc.player.connection.sendPacket(new CPlayerTryUseItemPacket(bl3 ? Hand.OFF_HAND : Hand.MAIN_HAND));
        if (!bl3) {
            mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
        }
        ++ticksInAir;
        flying = true;
        lastFireworkTime = System.currentTimeMillis();
    }


    public static int getElytraSlot() {
        if (mc.player.getItemStackFromSlot(EquipmentSlotType.CHEST).getItem() == Items.ELYTRA) {
            return -2;
        }
        if (mc.currentScreen instanceof ContainerScreen<?> && !(mc.currentScreen instanceof InventoryScreen) && !(mc.currentScreen instanceof CreativeScreen)) {
            return -1;
        }
        for (int i = 0; i < 45; ++i) {
            ItemStack is = mc.player.inventory.getStackInSlot(i);
            if (is.getItem() != Items.ELYTRA || !ElytraItem.isUsable(is)) continue;
            return i < 9 ? i + 36 : i;
        }
        return -1;
    }
    //Таргетить 1 цель для "Плавная"
    private void updateTarget() {
        List<LivingEntity> targets = new ArrayList<>();

        for (Entity entity : mc.world.getAllEntities()) {
            if (entity instanceof LivingEntity living && isValidTarget(living)) {
                targets.add(living);
            }
        }

        if (targets.isEmpty()) {
            target = null;
            return;
        }

        if (targets.size() == 1) {
            target = targets.get(0);
            return;
        }

        targets.sort(Comparator.comparingDouble(object -> {
            if (object instanceof PlayerEntity player) {
                return -getEntityArmor(player);
            }
            if (object instanceof LivingEntity base) {
                return -base.getTotalArmorValue();
            }
            return 0.0;
        }).thenComparing((object, object2) -> {
            double d2 = getEntityHealth((LivingEntity) object);
            double d3 = getEntityHealth((LivingEntity) object2);
            return Double.compare(d2, d3);
        }).thenComparing((object, object2) -> {
            double d2 = mc.player.getDistance((LivingEntity) object);
            double d3 = mc.player.getDistance((LivingEntity) object2);
            return Double.compare(d2, d3);
        }));

        target = targets.get(0);
    }
    private double distanceToTarget() {
        return mc.player.getDistance(target);
    }
    //Медод
    private double prevCircleStep, circleStep;
    //Где будет ESP для Прицел
    private final Vector2d markerPosition = new Vector2d();
    //target.png локация
    private final ResourceLocation markerLocation = new ResourceLocation("client/images/target.png");
    //Рендеринг ESP нурика
    private void draw() {
        if (target != null && mc.player != null) {
            Vector3d interpolatedPosition = wtf.levinov.util.MarkerUtils.RenderUtil.interpolate(target, mc.getRenderPartialTicks());
            double x = interpolatedPosition.x;
            double y = interpolatedPosition.y;
            double z = interpolatedPosition.z;
            Vector2d marker = wtf.levinov.util.MarkerUtils.RenderUtil.project(x, y + ((target.getEyeHeight() + 0.4F) * 0.5F), z);
            if (marker == null) return;
            markerPosition.x = Interpolator.lerp(markerPosition.x, marker.x, 1F);
            markerPosition.y = Interpolator.lerp(markerPosition.y, marker.y, 1F);
            float size = 120;
            double angle = (float) Mathf.clamp(0, 30, ((sin(System.currentTimeMillis() / 150D) + 1F) / 2F) * 30);
            double scale = (float) Mathf.clamp(0.8, 1, ((sin(System.currentTimeMillis() / 500D) + 1F) / 2F) * 1);
            double rotate = (float) Mathf.clamp(0, 360, ((sin(System.currentTimeMillis() / 1000D) + 1F) / 2F) * 360);
            GlStateManager.pushMatrix();
            GL11.glTranslatef((float) markerPosition.x, (float) markerPosition.y, 0.0F);
            GL11.glScaled(scale, scale, 1F);
            double sc = Mathf.clamp(0.75F, 1F, (1F - distanceToTarget() / distance.getValue().doubleValue()));
            sc = Interpolator.lerp(scale, sc, 0.5F);
            GL11.glScaled(sc, sc, sc);
            GL11.glTranslatef((float) (-markerPosition.x) - (size / 2F), (float) (-markerPosition.y), 0.0F);
            int color = ColorUtil.getColorStyle(0);
            GLUtils.startRotate((float) markerPosition.x + (size / 2F), (float) markerPosition.y, (float) (5F - (angle - 5F) + rotate));
            GlStateManager.enableBlend();
            GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE);
            wtf.levinov.util.MarkerUtils.RenderUtil.drawImage(markerLocation, markerPosition.x, markerPosition.y - (size / 2F), size, size, color);
            GlStateManager.disableBlend();
            GLUtils.endRotate();
            GlStateManager.popMatrix();
        }
    }
    //Рендеринг обычного круга
    private void drawCircle(LivingEntity target, EventRender e) {
        EntityRendererManager rm = mc.getRenderManager();

        double x = target.lastTickPosX + (target.getPosX() - target.lastTickPosX) * e.partialTicks - rm.info.getProjectedView().getX();
        double y = target.lastTickPosY + (target.getPosY() - target.lastTickPosY) * e.partialTicks - rm.info.getProjectedView().getY();
        double z = target.lastTickPosZ + (target.getPosZ() - target.lastTickPosZ) * e.partialTicks - rm.info.getProjectedView().getZ();
        float height = target.getHeight();

        double duration = 2000;
        double elapsed = (System.currentTimeMillis() % duration);

        boolean side = elapsed > (duration / 2);
        double progress = elapsed / (duration / 2);

        if (side) progress -= 1;
        else progress = 1 - progress;
        progress = (progress < 0.5) ? 2 * progress * progress : 1 - pow((-2 * progress + 2), 2) / 2;

        double eased = (height / 2) * ((progress > 0.5) ? 1 - progress : progress) * ((side) ? -1 : 1);
        RenderSystem.pushMatrix();
        GL11.glDepthMask(false);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
        RenderSystem.disableTexture();
        RenderSystem.enableBlend();
        RenderSystem.disableAlphaTest();
        RenderSystem.shadeModel(GL11.GL_SMOOTH);
        RenderSystem.disableCull();

        RenderSystem.lineWidth(1.5f);
        RenderSystem.color4f(-1f, -1f, -1f, -1f);

        buffer.begin(GL11.GL_QUAD_STRIP, DefaultVertexFormats.POSITION_COLOR);

        float[] colors = null;
        int firstColor = ColorUtil.getColorStyle(0.0F);
        for (int i = 0; i <= 360; i++) {
            colors = RenderUtil.IntColor.rgb(Managment.STYLE_MANAGER.getCurrentStyle().getColor(i));

            buffer.pos(x + cos(toRadians(i)) * target.getWidth() * 0.8, y + (height * progress), z + sin(toRadians(i)) * target.getWidth() * 0.8)
                    .color(colors[0], colors[1], colors[2], 0.5F).endVertex();
            buffer.pos(x + cos(toRadians(i)) * target.getWidth() * 0.8, y + (height * progress) + eased, z + sin(toRadians(i)) * target.getWidth() * 0.8)
                    .color(colors[0], colors[1], colors[2], 0F).endVertex();
        }

        buffer.finishDrawing();
        WorldVertexBufferUploader.draw(buffer);
        RenderSystem.color4f(-1f, -1f, -1f, -1f);

        buffer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR);

        for (int i = 0; i <= 360; i++) {
            buffer.pos(x + cos(toRadians(i)) * target.getWidth() * 0.8, y + (height * progress), z + sin(toRadians(i)) * target.getWidth() * 0.8)
                    .color(colors[0], colors[1], colors[2], 0.5F).endVertex();
        }

        buffer.finishDrawing();
        WorldVertexBufferUploader.draw(buffer);
        RenderSystem.enableCull();
        RenderSystem.disableBlend();
        RenderSystem.enableTexture();
        RenderSystem.enableAlphaTest();
        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
        RenderSystem.shadeModel(GL11.GL_FLAT);
        RenderSystem.popMatrix();
    }

    public Vector2f clientRot = null;

    private void handleMotionEvent(EventMotion motionEvent) {
        if (target == null || Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion)
            return;

        motionEvent.setYaw(rotate.x);
        motionEvent.setPitch(rotate.y);
        mc.player.rotationYawHead = rotate.x;
        mc.player.renderYawOffset = rotate.x;
        mc.player.rotationPitchHead = rotate.y;
    }
    private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
        Vector3d vec = target.getPositionVec().add(0, clamp(mc.player.getPosYEye() - target.getPosY(),
                        0, target.getHeight() * (mc.player.getDistance(target) / distance.getValue().floatValue())), 0)
                .subtract(mc.player.getEyePosition(1.0F));
    }

    //Ротации
    private void attackAndRotateOnEntity(LivingEntity target) {
        hasRotated = false;
        switch (rotationMode.getIndex()) {
            case 0 -> {
                hasRotated = false;
                if (shouldAttack(target) && RayTraceUtil.getMouseOver(target, rotate.x, rotate.y, distance.getValue().floatValue()) == target
                        && !Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
                    attackTarget(target);
                }
                if (!hasRotated)
                    setRotation(target, false);
                mc.player.rotationYaw = rotationsBedwars(target)[0];
                mc.player.rotationPitch = rotationsBedwars(target)[1];
                updateTarget();
            }
        }
    }

    private void attackTarget(final LivingEntity targetEntity) {
        if (settings.get(1) && mc.player.isBlocking()) {
            mc.playerController.onStoppedUsingItem(mc.player);
        }
        boolean sprint = false;
        if (CEntityActionPacket.lastUpdatedSprint && !mc.player.isInWater()) {
            mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.STOP_SPRINTING));
            sprint = true;
        }
        cpsLimit = System.currentTimeMillis() + 550;

        mc.playerController.attackEntity(mc.player, targetEntity);
        mc.player.swingArm(Hand.MAIN_HAND);

        if (sprint) {
            mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.START_SPRINTING));
        }
    }
    //Берёт в хотбар топор
    private boolean shouldAttack(LivingEntity targetEntity) {
        return canAttack() && targetEntity != null && (cpsLimit <= System.currentTimeMillis());
    }
    public float[] rotationsBedwars(LivingEntity entity) {
        double x = entity.getPosX() - mc.player.getPosX();
        double y = entity.getPosY() - (mc.player.getPosY() + mc.player.getEyeHeight()) + 1.1;
        double z = entity.getPosZ() - mc.player.getPosZ();

        double u = MathHelper.sqrt(x * x + z * z);

        float u2 = (float) (MathHelper.atan2(z, x) * (180D / Math.PI) - 90.0F);
        float u3 = (float) (-MathHelper.atan2(y, u) * (180D / Math.PI));

        return new float[]{u2, u3};
    }
    // Обычная ротация наводит
    private void setRotation(final LivingEntity base, final boolean attack) {
        this.hasRotated = true;

        Vector3d vec3d = AuraUtil.getVector(base);

        final double diffX = vec3d.x;
        final double diffY = vec3d.y;
        final double diffZ = vec3d.z;

        float[] rotations = new float[]{
                (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F,
                (float) (-Math.toDegrees(Math.atan2(diffY, Math.hypot(diffX, diffZ))))
        };

        float deltaYaw = MathHelper.wrapDegrees(calculateDelta(rotations[0], this.rotate.x));
        float deltaPitch = calculateDelta(rotations[1], this.rotate.y);

        float limitedYaw = min(max(abs(deltaYaw), 1.0F), 180.0F);
        float limitedPitch = (float) min(max(abs(deltaPitch), 1.0F), 15.0F);

        float finalYaw = this.rotate.x + (deltaYaw > 0.0f ? limitedYaw : -limitedYaw) + ThreadLocalRandom.current().nextFloat(-1, 1);
        float finalPitch = MathHelper.clamp(this.rotate.y + (deltaPitch > 0.0f ? limitedPitch : -limitedPitch) + ThreadLocalRandom.current().nextFloat(-1, 1), -89.0f, 89.0f);

        float gcd = GCDUtil.getGCDValue();
        finalYaw = (float) ((double) finalYaw - (double) (finalYaw - this.rotate.x) % gcd);
        finalPitch = (float) ((double) finalPitch - (double) (finalPitch - rotate.y) % gcd);

        this.rotate.x = finalYaw;
        this.rotate.y = finalPitch;
    }
    //Только криты
    public boolean canAttack() {
        final boolean onSpace = onlySpaceCritical.get()
                && mc.player.isOnGround()
                && !mc.gameSettings.keyBindJump.isKeyDown();

        final boolean reasonForAttack = mc.player.isPotionActive(Effects.BLINDNESS)
                || mc.player.isOnLadder()
                || mc.player.isInWater() && mc.player.areEyesInFluid(FluidTags.WATER)
                || mc.player.isRidingHorse()
                || mc.player.abilities.isFlying || mc.player.isElytraFlying();

        if (getDistance(target) >= distance.getValue().floatValue()
                || mc.player.getCooledAttackStrength(1.5F) < 0.92F) {
            return false;
        }
        if (Managment.FUNCTION_MANAGER.freeCam.player != null) return true;

        if (!reasonForAttack && settings.get(0)) {
            return onSpace || !mc.player.isOnGround() && mc.player.fallDistance > 0.0F;
        }
        return true;
    }

    private LivingEntity findTarget() {
        List<LivingEntity> targets = new ArrayList<>();

        for (Entity entity : mc.world.getAllEntities()) {
            if (entity instanceof LivingEntity && isValidTarget((LivingEntity) entity)) {
                targets.add((LivingEntity) entity);
            }
        }

        if (targets.isEmpty()) {
            return null;
        }

        if (targets.size() > 1) {
            switch (sortMode.get()) {
                case "По всему" -> {
                    targets.sort(Comparator.comparingDouble(target -> {
                        if (target instanceof PlayerEntity player) {
                            return -this.getEntityArmor(player);
                        }
                        if (target instanceof LivingEntity livingEntity) {
                            return -livingEntity.getTotalArmorValue();
                        }
                        return 0.0;
                    }).thenComparing((o, o1) -> {
                        double health = getEntityHealth((LivingEntity) o);
                        double health1 = getEntityHealth((LivingEntity) o1);
                        return Double.compare(health, health1);
                    }).thenComparing((object, object2) -> {
                        double d2 = getDistance((LivingEntity) object);
                        double d3 = getDistance((LivingEntity) object2);
                        return Double.compare(d2, d3);
                    }));
                }
                case "По дистанции" -> {
                    targets.sort(Comparator.comparingDouble(Managment.FUNCTION_MANAGER.targetik::getDistance).thenComparingDouble(this::getEntityHealth));
                }
                case "По здоровью" -> {
                    targets.sort(Comparator.comparingDouble(this::getEntityHealth).thenComparingDouble(mc.player::getDistance));
                }
            }
        } else {
            cpsLimit = System.currentTimeMillis();
        }
        return targets.get(0);
    }
    //Проверка Таргета на сочность
    private boolean isValidTarget(final LivingEntity base) {
        if (base.getShouldBeDead() || !base.isAlive() || base == mc.player) return false;

        if (base instanceof PlayerEntity) {
            String playerName = base.getName().getString();
            if (Managment.FRIEND_MANAGER.isFriend(playerName) && !targets.get(1)
                    || Managment.FUNCTION_MANAGER.freeCam.player != null && playerName.equals(Managment.FUNCTION_MANAGER
                    .freeCam.player.getName().getString())
                    || base.getTotalArmorValue() == 0 && (!targets.get(0) || !targets.get(2)))
                return false;
        }

        if ((base instanceof MobEntity || base instanceof AnimalEntity) && !targets.get(3)) return false;

        if (base instanceof ArmorStandEntity || base instanceof PlayerEntity && ((PlayerEntity) base).isBot)
            return false;

        return getDistance(base) <= distance.getValue().floatValue()
                + (rotationMode.is("Обычная") ? rotateDistance.getValue().floatValue() : 0.0f);

    }
    //Дистанция
    private double getDistance(LivingEntity entity) {
        return AuraUtil.getVector(entity).length();
    }

    public double getEntityArmor(PlayerEntity target) {
        double totalArmor = 0.0;

        for (ItemStack armorStack : target.inventory.armorInventory) {
            if (armorStack != null && armorStack.getItem() instanceof ArmorItem) {
                totalArmor += getProtectionLvl(armorStack);
            }
        }

        return totalArmor;
    }
    //Получение здоровья игрока
    public double getEntityHealth(Entity ent) {
        if (ent instanceof PlayerEntity player) {
            double armorValue = getEntityArmor(player) / 20.0;
            return (player.getHealth() + player.getAbsorptionAmount()) * armorValue;
        } else if (ent instanceof LivingEntity livingEntity) {
            return livingEntity.getHealth() + livingEntity.getAbsorptionAmount();
        }
        return 0.0;
    }


    private double getProtectionLvl(ItemStack stack) {
        ArmorItem armor = (ArmorItem) stack.getItem();
        double damageReduce = armor.getDamageReduceAmount();
        if (stack.isEnchanted()) {
            damageReduce += (double) EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25;
        }
        return damageReduce;
    }
    @Override
    public void onEnable() {
        int elytraItem = getElytraSlot();
        if (mc.player.getItemStackFromSlot(EquipmentSlotType.CHEST).getItem() != Items.ELYTRA && mc.player.inventory.getItemStack().getItem() != Items.ELYTRA && getElytraSlot() == -1) {
            noElytra();
            return;
        }
        if (InventoryUtil.getFireWorks() == -1) {
            noFireworks();
            return;
        }

        if (elytraItem != -2) {
            mc.playerController.windowClick(0, elytraItem, 0, ClickType.PICKUP, mc.player);
            mc.playerController.windowClick(0, 6, 0, ClickType.PICKUP, mc.player);
            mc.playerController.windowClick(0, elytraItem, 0, ClickType.PICKUP, mc.player);
            this.oldArmor = elytraItem;
        }
    }

    @Override
    public void onDisable() {
        currentSpeed = 0;
        startFallFlying = false;
        if (oldArmor != -1) {
            mc.playerController.windowClick(0, oldArmor, 0, ClickType.PICKUP, mc.player);
            mc.playerController.windowClick(0, 6, 0, ClickType.PICKUP, mc.player);
            mc.playerController.windowClick(0, oldArmor, 0, ClickType.PICKUP, mc.player);
            oldArmor = -1;
        }
        this.rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
        target = null;
        cpsLimit = System.currentTimeMillis();
        super.onDisable();
    }
}
настолько мега умный что он просто наводиться на типа без сайлента, пиздец умный елитратаргет
 
Начинающий
Статус
Оффлайн
Регистрация
24 Сен 2021
Сообщения
34
Реакции[?]
0
Поинты[?]
2K
Начинающий
Статус
Оффлайн
Регистрация
10 Июн 2022
Сообщения
51
Реакции[?]
1
Поинты[?]
1K
Летит на феерверках и эликах за тергетом и бьёт его

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


Если добавить таргетить по Крос хаеру тогда всё идеально будет
ещё Добавить плавность в ротации при наводке на игрока



Java:
package wtf.levinov.modules.impl.SelfCode;

import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import lombok.Getter;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.client.gui.screen.inventory.CreativeScreen;
import net.minecraft.client.gui.screen.inventory.InventoryScreen;
import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.item.*;
import net.minecraft.network.play.client.CEntityActionPacket;
import net.minecraft.network.play.client.CHeldItemChangePacket;
import net.minecraft.network.play.client.CPlayerTryUseItemPacket;
import net.minecraft.potion.Effects;
import net.minecraft.tags.FluidTags;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import org.joml.Vector2d;
import org.lwjgl.opengl.GL11;
import wtf.levinov.events.Event;
import wtf.levinov.events.impl.player.*;
import wtf.levinov.events.impl.render.EventRender;
import wtf.levinov.managment.Managment;
import wtf.levinov.modules.Function;
import wtf.levinov.modules.FunctionAnnotation;
import wtf.levinov.modules.Type;
import wtf.levinov.modules.impl.combat.Aura;
import wtf.levinov.util.ClientUtil;
import wtf.levinov.util.MarkerUtils.Mathf;
import wtf.levinov.util.math.*;
import wtf.levinov.modules.settings.imp.BooleanOption;
import wtf.levinov.modules.settings.imp.ModeSetting;
import wtf.levinov.modules.settings.imp.MultiBoxSetting;
import wtf.levinov.modules.settings.imp.SliderSetting;
import wtf.levinov.util.render.ColorUtil;
import wtf.levinov.util.render.Interpolator;
import wtf.levinov.util.render.RenderUtil;
import wtf.levinov.util.world.InventoryUtil;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

import static java.lang.Math.*;
import static java.lang.Math.toRadians;
import static net.minecraft.util.math.MathHelper.clamp;
import static org.lwjgl.opengl.GL11C.GL_ONE;
import static org.lwjgl.opengl.GL11C.GL_SRC_ALPHA;
import static wtf.levinov.util.math.MathUtil.calculateDelta;
/**
* @author levka
* @since 07.06.2023
*/

@SuppressWarnings("all")
@FunctionAnnotation(name = "ElytraTarget", type = Type.SelfCode)
public class Target extends Function {
    @Getter
    // Таргет Энтити
    public static LivingEntity target = null;

    public Vector2f rotate = new Vector2f(0, 0);
    private final SliderSetting fireworkDelay = new SliderSetting("Задержка фейрверка", 1.5f, 0.5f, 5f, 0.1f);
    // Ротация выбор
    private final ModeSetting rotationMode = new ModeSetting("Мод", "Обычная", "Обычная");
    // Убивать кого
    private final ModeSetting sortMode = new ModeSetting("Сортировать",
            "По всему",
            "По всему", "По здоровью", "По дистанции"
    );
    // Цели - кого бить
    private final MultiBoxSetting targets = new MultiBoxSetting("Цели",
            new BooleanOption("Игроки", true),
            new BooleanOption("Друзья", false),
            new BooleanOption("Голые", true),
            new BooleanOption("Мобы", false)
    );
    // Дистация
    private final SliderSetting distance = new SliderSetting("Дистанция удара в полёте", 3.0f, 2.0f, 5.0f, 0.05f);
    // Дистанция ротации / НАВОДКА
    private final SliderSetting rotateDistance = new SliderSetting("Дистанция", 100.5f, 20.0f, 1000.0f, 0.05f).setVisible(() -> rotationMode.is("Обычная"));

    public final MultiBoxSetting settings = new MultiBoxSetting("Настройки",
            new BooleanOption("Только критами", true),
            new BooleanOption("Таргет ЕСП", true)
    );
    // Только криты вкл/выкл
    private final BooleanOption onlySpaceCritical = new BooleanOption("Только с пробелом", false)
            .setVisible(() -> settings.get(0));
    //Оно нахуй тут не нужно
    private final BooleanOption silent = new BooleanOption("Коррекция в полёте", true);
    // Визуал ESP
    private final ModeSetting targetVisualize = new ModeSetting("Визуализация цели",
            "Прицел",
            "Выключен", "Прицел","Круг"
    );

    int ticksUntilNextAttack;
    private boolean hasRotated;
    private long cpsLimit = 0;
    private ItemStack getStackInSlotCopy;
    private Item prevItemInHand = Items.AIR;
    private int slotWithFireWorks = -1;
    private long lastFireworkTime;
    private boolean flying;
    private int currentSpeed;
    private int ticksInAir;
    private boolean startFallFlying;
    private boolean starting;
    private Integer oldArmor = -1;
    public boolean isActive() {
        return state && starting;
    }
    // Добавление сетиннгов
    public Target() {
        this.addSettings(
                distance,
                targets,
                sortMode,
                rotateDistance,
                settings,
                fireworkDelay,
                onlySpaceCritical,
                targetVisualize,
                silent);
    }
    // Настройка коррекции
    @Override
    public void onEvent(final Event event) {
        if (event instanceof EventInteractEntity entity) {
            if (target != null)
                entity.setCancel(true);
        }
        if (event instanceof EventInput eventInput) {
            if (silent.get() && (target == null || !isValidTarget(target)) || !silent.get()) {
                    updateTarget(); //Обновление таргета после 1 килла
            }
        }
        if (event instanceof EventUpdate updateEvent) {
            if (!(target != null && isValidTarget(target))) {
                target = findTarget();
            }
            if (target == null) {
                cpsLimit = System.currentTimeMillis();
                rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
                return;
            }

            attackAndRotateOnEntity(target);
        }
        if (event instanceof EventMotion motionEvent) {
            handleMotionEvent(motionEvent);
        }
        if (event instanceof StartFallFlyingEvent) {
            //fly(false);
        }
        if (event instanceof EventUpdate) {
            if (mc.player.isOnGround()) {
                mc.player.jump();
                startFallFlying = false;
            }
            if (mc.player.fallDistance > 0 && !mc.player.isElytraFlying() && !startFallFlying) {
                mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.START_FALL_FLYING));
                startFallFlying = true;
                fly(false);
            }

            if (mc.player.isElytraFlying()) {
                fly(true);
            }
        }
        //Рендер ЕСП
        if (event instanceof EventRender e) {
            if (target != null) {
                if (targetVisualize.is("Прицел")) {  //Название вашего мода
                    draw(); //Для нового метода
                }
                if (targetVisualize.is("Круг")) {  //Название вашего мода
                    drawCircle(target, e); //Для нового метода
                }
            }
        }
    }
    private void noFireworks() {
        ClientUtil.sendMesage("Для данного Модуля нужны Феерверки");
        setState(false);
        onDisable();
        flying = false;
        ticksInAir = 0;
    }

    private void noElytra() {
        ClientUtil.sendMesage("Для данного Модуля нужны Элитры");
        setState(false);
        onDisable();
        flying = false;
        ticksInAir = 0;
    }

    private void fly(boolean started) {
        if (started && (float) (System.currentTimeMillis() - lastFireworkTime) < fireworkDelay.getValue().floatValue() * 1000.0f) {
            return;
        }
        if (started && !mc.player.isElytraFlying()) {
            return;
        }
        if (!started && ticksInAir > 1) {
            return;
        }
        int n2 = InventoryUtil.getFireWorks();

        if (n2 == -1) {
            slotWithFireWorks = -1;
            return;
        }
        slotWithFireWorks = n2;
        boolean bl3 = mc.player.getHeldItemOffhand().getItem() == Items.FIREWORK_ROCKET;
        if (!bl3) {
            mc.player.connection.sendPacket(new CHeldItemChangePacket(n2));
        }

        mc.player.connection.sendPacket(new CPlayerTryUseItemPacket(bl3 ? Hand.OFF_HAND : Hand.MAIN_HAND));
        if (!bl3) {
            mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
        }
        ++ticksInAir;
        flying = true;
        lastFireworkTime = System.currentTimeMillis();
    }


    public static int getElytraSlot() {
        if (mc.player.getItemStackFromSlot(EquipmentSlotType.CHEST).getItem() == Items.ELYTRA) {
            return -2;
        }
        if (mc.currentScreen instanceof ContainerScreen<?> && !(mc.currentScreen instanceof InventoryScreen) && !(mc.currentScreen instanceof CreativeScreen)) {
            return -1;
        }
        for (int i = 0; i < 45; ++i) {
            ItemStack is = mc.player.inventory.getStackInSlot(i);
            if (is.getItem() != Items.ELYTRA || !ElytraItem.isUsable(is)) continue;
            return i < 9 ? i + 36 : i;
        }
        return -1;
    }
    //Таргетить 1 цель для "Плавная"
    private void updateTarget() {
        List<LivingEntity> targets = new ArrayList<>();

        for (Entity entity : mc.world.getAllEntities()) {
            if (entity instanceof LivingEntity living && isValidTarget(living)) {
                targets.add(living);
            }
        }

        if (targets.isEmpty()) {
            target = null;
            return;
        }

        if (targets.size() == 1) {
            target = targets.get(0);
            return;
        }

        targets.sort(Comparator.comparingDouble(object -> {
            if (object instanceof PlayerEntity player) {
                return -getEntityArmor(player);
            }
            if (object instanceof LivingEntity base) {
                return -base.getTotalArmorValue();
            }
            return 0.0;
        }).thenComparing((object, object2) -> {
            double d2 = getEntityHealth((LivingEntity) object);
            double d3 = getEntityHealth((LivingEntity) object2);
            return Double.compare(d2, d3);
        }).thenComparing((object, object2) -> {
            double d2 = mc.player.getDistance((LivingEntity) object);
            double d3 = mc.player.getDistance((LivingEntity) object2);
            return Double.compare(d2, d3);
        }));

        target = targets.get(0);
    }
    private double distanceToTarget() {
        return mc.player.getDistance(target);
    }
    //Медод
    private double prevCircleStep, circleStep;
    //Где будет ESP для Прицел
    private final Vector2d markerPosition = new Vector2d();
    //target.png локация
    private final ResourceLocation markerLocation = new ResourceLocation("client/images/target.png");
    //Рендеринг ESP нурика
    private void draw() {
        if (target != null && mc.player != null) {
            Vector3d interpolatedPosition = wtf.levinov.util.MarkerUtils.RenderUtil.interpolate(target, mc.getRenderPartialTicks());
            double x = interpolatedPosition.x;
            double y = interpolatedPosition.y;
            double z = interpolatedPosition.z;
            Vector2d marker = wtf.levinov.util.MarkerUtils.RenderUtil.project(x, y + ((target.getEyeHeight() + 0.4F) * 0.5F), z);
            if (marker == null) return;
            markerPosition.x = Interpolator.lerp(markerPosition.x, marker.x, 1F);
            markerPosition.y = Interpolator.lerp(markerPosition.y, marker.y, 1F);
            float size = 120;
            double angle = (float) Mathf.clamp(0, 30, ((sin(System.currentTimeMillis() / 150D) + 1F) / 2F) * 30);
            double scale = (float) Mathf.clamp(0.8, 1, ((sin(System.currentTimeMillis() / 500D) + 1F) / 2F) * 1);
            double rotate = (float) Mathf.clamp(0, 360, ((sin(System.currentTimeMillis() / 1000D) + 1F) / 2F) * 360);
            GlStateManager.pushMatrix();
            GL11.glTranslatef((float) markerPosition.x, (float) markerPosition.y, 0.0F);
            GL11.glScaled(scale, scale, 1F);
            double sc = Mathf.clamp(0.75F, 1F, (1F - distanceToTarget() / distance.getValue().doubleValue()));
            sc = Interpolator.lerp(scale, sc, 0.5F);
            GL11.glScaled(sc, sc, sc);
            GL11.glTranslatef((float) (-markerPosition.x) - (size / 2F), (float) (-markerPosition.y), 0.0F);
            int color = ColorUtil.getColorStyle(0);
            GLUtils.startRotate((float) markerPosition.x + (size / 2F), (float) markerPosition.y, (float) (5F - (angle - 5F) + rotate));
            GlStateManager.enableBlend();
            GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE);
            wtf.levinov.util.MarkerUtils.RenderUtil.drawImage(markerLocation, markerPosition.x, markerPosition.y - (size / 2F), size, size, color);
            GlStateManager.disableBlend();
            GLUtils.endRotate();
            GlStateManager.popMatrix();
        }
    }
    //Рендеринг обычного круга
    private void drawCircle(LivingEntity target, EventRender e) {
        EntityRendererManager rm = mc.getRenderManager();

        double x = target.lastTickPosX + (target.getPosX() - target.lastTickPosX) * e.partialTicks - rm.info.getProjectedView().getX();
        double y = target.lastTickPosY + (target.getPosY() - target.lastTickPosY) * e.partialTicks - rm.info.getProjectedView().getY();
        double z = target.lastTickPosZ + (target.getPosZ() - target.lastTickPosZ) * e.partialTicks - rm.info.getProjectedView().getZ();
        float height = target.getHeight();

        double duration = 2000;
        double elapsed = (System.currentTimeMillis() % duration);

        boolean side = elapsed > (duration / 2);
        double progress = elapsed / (duration / 2);

        if (side) progress -= 1;
        else progress = 1 - progress;
        progress = (progress < 0.5) ? 2 * progress * progress : 1 - pow((-2 * progress + 2), 2) / 2;

        double eased = (height / 2) * ((progress > 0.5) ? 1 - progress : progress) * ((side) ? -1 : 1);
        RenderSystem.pushMatrix();
        GL11.glDepthMask(false);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
        RenderSystem.disableTexture();
        RenderSystem.enableBlend();
        RenderSystem.disableAlphaTest();
        RenderSystem.shadeModel(GL11.GL_SMOOTH);
        RenderSystem.disableCull();

        RenderSystem.lineWidth(1.5f);
        RenderSystem.color4f(-1f, -1f, -1f, -1f);

        buffer.begin(GL11.GL_QUAD_STRIP, DefaultVertexFormats.POSITION_COLOR);

        float[] colors = null;
        int firstColor = ColorUtil.getColorStyle(0.0F);
        for (int i = 0; i <= 360; i++) {
            colors = RenderUtil.IntColor.rgb(Managment.STYLE_MANAGER.getCurrentStyle().getColor(i));

            buffer.pos(x + cos(toRadians(i)) * target.getWidth() * 0.8, y + (height * progress), z + sin(toRadians(i)) * target.getWidth() * 0.8)
                    .color(colors[0], colors[1], colors[2], 0.5F).endVertex();
            buffer.pos(x + cos(toRadians(i)) * target.getWidth() * 0.8, y + (height * progress) + eased, z + sin(toRadians(i)) * target.getWidth() * 0.8)
                    .color(colors[0], colors[1], colors[2], 0F).endVertex();
        }

        buffer.finishDrawing();
        WorldVertexBufferUploader.draw(buffer);
        RenderSystem.color4f(-1f, -1f, -1f, -1f);

        buffer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR);

        for (int i = 0; i <= 360; i++) {
            buffer.pos(x + cos(toRadians(i)) * target.getWidth() * 0.8, y + (height * progress), z + sin(toRadians(i)) * target.getWidth() * 0.8)
                    .color(colors[0], colors[1], colors[2], 0.5F).endVertex();
        }

        buffer.finishDrawing();
        WorldVertexBufferUploader.draw(buffer);
        RenderSystem.enableCull();
        RenderSystem.disableBlend();
        RenderSystem.enableTexture();
        RenderSystem.enableAlphaTest();
        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
        RenderSystem.shadeModel(GL11.GL_FLAT);
        RenderSystem.popMatrix();
    }

    public Vector2f clientRot = null;

    private void handleMotionEvent(EventMotion motionEvent) {
        if (target == null || Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion)
            return;

        motionEvent.setYaw(rotate.x);
        motionEvent.setPitch(rotate.y);
        mc.player.rotationYawHead = rotate.x;
        mc.player.renderYawOffset = rotate.x;
        mc.player.rotationPitchHead = rotate.y;
    }
    private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
        Vector3d vec = target.getPositionVec().add(0, clamp(mc.player.getPosYEye() - target.getPosY(),
                        0, target.getHeight() * (mc.player.getDistance(target) / distance.getValue().floatValue())), 0)
                .subtract(mc.player.getEyePosition(1.0F));
    }

    //Ротации
    private void attackAndRotateOnEntity(LivingEntity target) {
        hasRotated = false;
        switch (rotationMode.getIndex()) {
            case 0 -> {
                hasRotated = false;
                if (shouldAttack(target) && RayTraceUtil.getMouseOver(target, rotate.x, rotate.y, distance.getValue().floatValue()) == target
                        && !Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
                    attackTarget(target);
                }
                if (!hasRotated)
                    setRotation(target, false);
                mc.player.rotationYaw = rotationsBedwars(target)[0];
                mc.player.rotationPitch = rotationsBedwars(target)[1];
                updateTarget();
            }
        }
    }

    private void attackTarget(final LivingEntity targetEntity) {
        if (settings.get(1) && mc.player.isBlocking()) {
            mc.playerController.onStoppedUsingItem(mc.player);
        }
        boolean sprint = false;
        if (CEntityActionPacket.lastUpdatedSprint && !mc.player.isInWater()) {
            mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.STOP_SPRINTING));
            sprint = true;
        }
        cpsLimit = System.currentTimeMillis() + 550;

        mc.playerController.attackEntity(mc.player, targetEntity);
        mc.player.swingArm(Hand.MAIN_HAND);

        if (sprint) {
            mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.START_SPRINTING));
        }
    }
    //Берёт в хотбар топор
    private boolean shouldAttack(LivingEntity targetEntity) {
        return canAttack() && targetEntity != null && (cpsLimit <= System.currentTimeMillis());
    }
    public float[] rotationsBedwars(LivingEntity entity) {
        double x = entity.getPosX() - mc.player.getPosX();
        double y = entity.getPosY() - (mc.player.getPosY() + mc.player.getEyeHeight()) + 1.1;
        double z = entity.getPosZ() - mc.player.getPosZ();

        double u = MathHelper.sqrt(x * x + z * z);

        float u2 = (float) (MathHelper.atan2(z, x) * (180D / Math.PI) - 90.0F);
        float u3 = (float) (-MathHelper.atan2(y, u) * (180D / Math.PI));

        return new float[]{u2, u3};
    }
    // Обычная ротация наводит
    private void setRotation(final LivingEntity base, final boolean attack) {
        this.hasRotated = true;

        Vector3d vec3d = AuraUtil.getVector(base);

        final double diffX = vec3d.x;
        final double diffY = vec3d.y;
        final double diffZ = vec3d.z;

        float[] rotations = new float[]{
                (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F,
                (float) (-Math.toDegrees(Math.atan2(diffY, Math.hypot(diffX, diffZ))))
        };

        float deltaYaw = MathHelper.wrapDegrees(calculateDelta(rotations[0], this.rotate.x));
        float deltaPitch = calculateDelta(rotations[1], this.rotate.y);

        float limitedYaw = min(max(abs(deltaYaw), 1.0F), 180.0F);
        float limitedPitch = (float) min(max(abs(deltaPitch), 1.0F), 15.0F);

        float finalYaw = this.rotate.x + (deltaYaw > 0.0f ? limitedYaw : -limitedYaw) + ThreadLocalRandom.current().nextFloat(-1, 1);
        float finalPitch = MathHelper.clamp(this.rotate.y + (deltaPitch > 0.0f ? limitedPitch : -limitedPitch) + ThreadLocalRandom.current().nextFloat(-1, 1), -89.0f, 89.0f);

        float gcd = GCDUtil.getGCDValue();
        finalYaw = (float) ((double) finalYaw - (double) (finalYaw - this.rotate.x) % gcd);
        finalPitch = (float) ((double) finalPitch - (double) (finalPitch - rotate.y) % gcd);

        this.rotate.x = finalYaw;
        this.rotate.y = finalPitch;
    }
    //Только криты
    public boolean canAttack() {
        final boolean onSpace = onlySpaceCritical.get()
                && mc.player.isOnGround()
                && !mc.gameSettings.keyBindJump.isKeyDown();

        final boolean reasonForAttack = mc.player.isPotionActive(Effects.BLINDNESS)
                || mc.player.isOnLadder()
                || mc.player.isInWater() && mc.player.areEyesInFluid(FluidTags.WATER)
                || mc.player.isRidingHorse()
                || mc.player.abilities.isFlying || mc.player.isElytraFlying();

        if (getDistance(target) >= distance.getValue().floatValue()
                || mc.player.getCooledAttackStrength(1.5F) < 0.92F) {
            return false;
        }
        if (Managment.FUNCTION_MANAGER.freeCam.player != null) return true;

        if (!reasonForAttack && settings.get(0)) {
            return onSpace || !mc.player.isOnGround() && mc.player.fallDistance > 0.0F;
        }
        return true;
    }

    private LivingEntity findTarget() {
        List<LivingEntity> targets = new ArrayList<>();

        for (Entity entity : mc.world.getAllEntities()) {
            if (entity instanceof LivingEntity && isValidTarget((LivingEntity) entity)) {
                targets.add((LivingEntity) entity);
            }
        }

        if (targets.isEmpty()) {
            return null;
        }

        if (targets.size() > 1) {
            switch (sortMode.get()) {
                case "По всему" -> {
                    targets.sort(Comparator.comparingDouble(target -> {
                        if (target instanceof PlayerEntity player) {
                            return -this.getEntityArmor(player);
                        }
                        if (target instanceof LivingEntity livingEntity) {
                            return -livingEntity.getTotalArmorValue();
                        }
                        return 0.0;
                    }).thenComparing((o, o1) -> {
                        double health = getEntityHealth((LivingEntity) o);
                        double health1 = getEntityHealth((LivingEntity) o1);
                        return Double.compare(health, health1);
                    }).thenComparing((object, object2) -> {
                        double d2 = getDistance((LivingEntity) object);
                        double d3 = getDistance((LivingEntity) object2);
                        return Double.compare(d2, d3);
                    }));
                }
                case "По дистанции" -> {
                    targets.sort(Comparator.comparingDouble(Managment.FUNCTION_MANAGER.targetik::getDistance).thenComparingDouble(this::getEntityHealth));
                }
                case "По здоровью" -> {
                    targets.sort(Comparator.comparingDouble(this::getEntityHealth).thenComparingDouble(mc.player::getDistance));
                }
            }
        } else {
            cpsLimit = System.currentTimeMillis();
        }
        return targets.get(0);
    }
    //Проверка Таргета на сочность
    private boolean isValidTarget(final LivingEntity base) {
        if (base.getShouldBeDead() || !base.isAlive() || base == mc.player) return false;

        if (base instanceof PlayerEntity) {
            String playerName = base.getName().getString();
            if (Managment.FRIEND_MANAGER.isFriend(playerName) && !targets.get(1)
                    || Managment.FUNCTION_MANAGER.freeCam.player != null && playerName.equals(Managment.FUNCTION_MANAGER
                    .freeCam.player.getName().getString())
                    || base.getTotalArmorValue() == 0 && (!targets.get(0) || !targets.get(2)))
                return false;
        }

        if ((base instanceof MobEntity || base instanceof AnimalEntity) && !targets.get(3)) return false;

        if (base instanceof ArmorStandEntity || base instanceof PlayerEntity && ((PlayerEntity) base).isBot)
            return false;

        return getDistance(base) <= distance.getValue().floatValue()
                + (rotationMode.is("Обычная") ? rotateDistance.getValue().floatValue() : 0.0f);

    }
    //Дистанция
    private double getDistance(LivingEntity entity) {
        return AuraUtil.getVector(entity).length();
    }

    public double getEntityArmor(PlayerEntity target) {
        double totalArmor = 0.0;

        for (ItemStack armorStack : target.inventory.armorInventory) {
            if (armorStack != null && armorStack.getItem() instanceof ArmorItem) {
                totalArmor += getProtectionLvl(armorStack);
            }
        }

        return totalArmor;
    }
    //Получение здоровья игрока
    public double getEntityHealth(Entity ent) {
        if (ent instanceof PlayerEntity player) {
            double armorValue = getEntityArmor(player) / 20.0;
            return (player.getHealth() + player.getAbsorptionAmount()) * armorValue;
        } else if (ent instanceof LivingEntity livingEntity) {
            return livingEntity.getHealth() + livingEntity.getAbsorptionAmount();
        }
        return 0.0;
    }


    private double getProtectionLvl(ItemStack stack) {
        ArmorItem armor = (ArmorItem) stack.getItem();
        double damageReduce = armor.getDamageReduceAmount();
        if (stack.isEnchanted()) {
            damageReduce += (double) EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25;
        }
        return damageReduce;
    }
    @Override
    public void onEnable() {
        int elytraItem = getElytraSlot();
        if (mc.player.getItemStackFromSlot(EquipmentSlotType.CHEST).getItem() != Items.ELYTRA && mc.player.inventory.getItemStack().getItem() != Items.ELYTRA && getElytraSlot() == -1) {
            noElytra();
            return;
        }
        if (InventoryUtil.getFireWorks() == -1) {
            noFireworks();
            return;
        }

        if (elytraItem != -2) {
            mc.playerController.windowClick(0, elytraItem, 0, ClickType.PICKUP, mc.player);
            mc.playerController.windowClick(0, 6, 0, ClickType.PICKUP, mc.player);
            mc.playerController.windowClick(0, elytraItem, 0, ClickType.PICKUP, mc.player);
            this.oldArmor = elytraItem;
        }
    }

    @Override
    public void onDisable() {
        currentSpeed = 0;
        startFallFlying = false;
        if (oldArmor != -1) {
            mc.playerController.windowClick(0, oldArmor, 0, ClickType.PICKUP, mc.player);
            mc.playerController.windowClick(0, 6, 0, ClickType.PICKUP, mc.player);
            mc.playerController.windowClick(0, oldArmor, 0, ClickType.PICKUP, mc.player);
            oldArmor = -1;
        }
        this.rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
        target = null;
        cpsLimit = System.currentTimeMillis();
        super.onDisable();
    }
}
1711229404555.png
дай все эти утилки пожалуйста
 
Сверху Снизу