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

Обход античита Spookytime Aura [rockstar 2.0]

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
10 Авг 2025
Сообщения
36
Реакции
0
Выберите загрузчик игры
  1. Fabric
Ротация спуки тамй на 1.21.4 ( база рокстара)
Когда тестил обходило невьебенно хорошо
Сливаю фул ауру, вырежьте лучше сброс legitV2, так как он взаимодейтсвует с моим клиентом и автоспринтов( либо если не лень адаптируйте его)
SS - нахера? обычная ротка
Вырезал с помощью ИИ, сори за говно в коде:
upd: тут всего 132 строки ротации
Java:
Expand Collapse Copy
package moscow.holly.systems.modules.modules.combat;

import lombok.Generated;
import moscow.holly.Holly;
import moscow.holly.systems.event.EventListener;
import moscow.holly.systems.event.impl.player.ClientPlayerTickEvent;
import moscow.holly.systems.event.impl.player.ClientPlayerTickEndEvent;
import moscow.holly.systems.event.impl.network.SendPacketEvent;
import moscow.holly.systems.localization.Localizator;
import moscow.holly.systems.modules.api.ModuleCategory;
import moscow.holly.systems.modules.api.ModuleInfo;
import moscow.holly.systems.modules.impl.BaseModule;
import moscow.holly.systems.setting.settings.BooleanSetting;
import moscow.holly.systems.setting.settings.ModeSetting;
import moscow.holly.systems.setting.settings.SelectSetting;
import moscow.holly.systems.setting.settings.SliderSetting;
import moscow.holly.systems.target.TargetComparators;
import moscow.holly.systems.target.TargetSettings;
import moscow.holly.utility.animation.base.Animation;
import moscow.holly.utility.animation.base.Easing;
import moscow.holly.utility.game.CombatUtility;
import moscow.holly.utility.game.EntityUtility;
import moscow.holly.utility.game.TextUtility;
import moscow.holly.utility.game.prediction.ElytraPredictionSystem;
import moscow.holly.utility.game.prediction.FallingPlayer;
import moscow.holly.utility.game.server.ServerUtility;
import moscow.holly.utility.inventory.slots.HotbarSlot;
import moscow.holly.utility.math.MathUtility;
import moscow.holly.utility.math.PerlinNoise;
import moscow.holly.utility.rotations.MoveCorrection;
import moscow.holly.utility.rotations.Rotation;
import moscow.holly.utility.rotations.RotationHandler;
import moscow.holly.utility.rotations.RotationMath;
import moscow.holly.utility.rotations.RotationPriority;
import moscow.holly.utility.time.Timer;
import net.minecraft.block.Blocks;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.consume.UseAction;
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerInteractItemC2SPacket;
import net.minecraft.network.packet.c2s.play.UpdateSelectedSlotC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket.Action;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.HitResult.Type;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.RaycastContext;
import net.minecraft.world.RaycastContext.FluidHandling;
import net.minecraft.world.RaycastContext.ShapeType;
import org.joml.Vector2f;
import ru.kotopushka.compiler.sdk.annotations.VMProtect;
import ru.kotopushka.compiler.sdk.enums.VMProtectType;

import java.util.Optional;
import java.util.Random;

@ModuleInfo(name = "Aura", category = ModuleCategory.COMBAT, desc = "Бьёт женщин и детей")
public class Aura extends BaseModule {
    private SliderSetting attackDistance;
    private SliderSetting aimDistance;
    private SelectSetting targets;
    private SelectSetting.Value players;
    private SelectSetting.Value animals;
    private SelectSetting.Value mobs;
    private SelectSetting.Value invisibles;
    private SelectSetting.Value nakedPlayers;
    private SelectSetting.Value friends;
    private ModeSetting sortingMode;
    private ModeSetting.Value distanceSorting;
    private ModeSetting.Value healthSorting;
    private ModeSetting.Value fovSorting;
    private ModeSetting moveCorrectionMode;
    private ModeSetting.Value noMoveCorrection;
    private ModeSetting.Value directMoveCorrection;
    private ModeSetting.Value silentMoveCorrection;
    private ModeSetting styleAttack;
    private ModeSetting.Value fastPvp;
    private ModeSetting.Value slowPvp;
    private BooleanSetting onlyCriticals;
    private BooleanSetting walls;
    private BooleanSetting rayTrace;
    private BooleanSetting targeting;
    private BooleanSetting onlyWeapon;
    private BooleanSetting breakShield;
    private BooleanSetting shieldBreaker;
    private BooleanSetting noAttackWhileEating;

    private ModeSetting sprintResetMode;
    private ModeSetting.Value rageSprintReset;
    private ModeSetting.Value legitSprintReset;
    private ModeSetting.Value legitV2SprintReset;
    private ModeSetting.Value noneSprintReset;
    private boolean wasSprinting = false;
    private int sprintResetTicks = 0;
    private boolean legitV2SprintDisabled = false;
    private int legitV2SprintCooldown = 0;

    private final Animation nononoYaw = new Animation(300L, Easing.LINEAR);
    private final Animation nononoPitch = new Animation(1000L, Easing.LINEAR);
    private Timer attackTimer;
    boolean shield;
    private PerlinNoise noise = new PerlinNoise();
    private long rotationStartTime = 0L;
    private float noiseFactor = 0.0F;
    private int attacks;
    private Rotation additional;
    private final Timer collideTimer = new Timer();
    private final Timer eatTimer = new Timer();
    private int tickCounter = 0;

    // SpookyV2 state - улучшенная версия с предсказанием движения
    private int spv2NoiseResetAge = 0;
    private float spv2IdleYawShift = 10.0F;
    private float spv2IdlePitchShift = -20.0F;
    private LivingEntity spv2LastTarget = null;
    private float spv2SmoothYaw = 0.0F;
    private float spv2SmoothPitch = 0.0F;
    private boolean spv2SmoothInit = false;
    private int spv2IdleShiftTimer = 0;
    private Vec3d spv2LastTargetPos = null;
    private Vec3d spv2TargetVelocity = Vec3d.ZERO;
    private float spv2AdaptiveYawSpeed = 1.0F;
    private float spv2AdaptivePitchSpeed = 1.0F;

    private Vector2f rotateVector = new Vector2f(0, 0);

    private boolean isInHitbox = false;
    private boolean isAccelerating = false;
    private long accelerationStartTime = 0L;
    private int accelerationDelay = 0;
    private float currentSpeedMultiplier = 1.0f;
    private float lastYaw = 0f;
    private float lastPitch = 0f;
    private final Random random = new Random();
    private LivingEntity target;

    private final EventListener<ClientPlayerTickEvent> onPlayerTick = event -> {
        if (mc.player != null) {
            tickCounter++;
           
            // Обновляем таргет только каждые 2 тика для снижения нагрузки
            if (tickCounter % 2 == 0) {
                boolean elytraTargetActive = Holly.getInstance().getModuleManager().getModule(ElytraTarget.class).isEnabled();
                boolean isGliding = mc.player.isGliding()
                        && moscow.holly.utility.inventory.InventoryUtility.getChestplateSlot().item() == net.minecraft.item.Items.ELYTRA;

                float requiredAimDistance = elytraTargetActive && isGliding
                        ? 50.0F
                        : this.aimDistance.getCurrentValue();

                TargetSettings.Builder builder = new TargetSettings.Builder()
                        .targetPlayers(this.players.isSelected())
                        .targetAnimals(this.animals.isSelected())
                        .targetMobs(this.mobs.isSelected())
                        .targetInvisibles(this.invisibles.isSelected())
                        .targetNakedPlayers(this.nakedPlayers.isSelected())
                        .targetFriends(this.friends.isSelected())
                        .requiredRange(requiredAimDistance);

                if (this.sortingMode.is(this.distanceSorting)) {
                    builder.sortBy(TargetComparators.DISTANCE);
                } else if (this.sortingMode.is(this.healthSorting)) {
                    builder.sortBy(TargetComparators.HEALTH);
                } else if (this.sortingMode.is(this.fovSorting)) {
                    builder.sortBy(TargetComparators.FOV);
                }

                TargetSettings settings = builder.build();
                target = Holly.getInstance().getTargetManager().getCurrentTarget() instanceof LivingEntity living ? living : null;

                if (!this.targeting.isEnabled()
                        || target == null
                        || MathHelper.sqrt((float)mc.player.squaredDistanceTo(RotationMath.getNearestPoint(target))) > requiredAimDistance
                        || !mc.world.hasEntity(target)
                        || !target.isAlive()) {
                    Holly.getInstance().getTargetManager().update(settings);
                }
            }

            if (target != null) {
                handleSprintReset();

                this.rotateHead(target);
                if (this.shouldAttackEntity(target)) {
                    this.attack(target);
                }
            } else {
                // Восстанавливаем спринт когда нет цели
                handleSprintReset();
               
                this.rotationStartTime = System.currentTimeMillis();
                this.noise = new PerlinNoise();
                this.noiseFactor = 1.0F;
                this.spv2SmoothInit = false;
            }
        }
    };

    // Дополнительный обработчик в конце тика для принудительного контроля спринта
    private final EventListener<ClientPlayerTickEndEvent> onPlayerTickEnd = event -> {
        if (mc.player != null && sprintResetMode.is(legitV2SprintReset)) {
            // Принудительно выключаем спринт если цель в радиусе (локально)
            if (target != null && inRange(target)) {
                try {
                    var field = net.minecraft.entity.Entity.class.getDeclaredField("field_5960");
                    field.setAccessible(true);
                    field.setBoolean(mc.player, false);
                } catch (Exception e) {
                    mc.player.setSprinting(false);
                }
            }
        }
    };

    // Блокируем отправку пакетов спринта в режиме LegitV2
    private final EventListener<SendPacketEvent> onSendPacket = event -> {
        if (sprintResetMode.is(legitV2SprintReset) && target != null && inRange(target)) {
            var packet = event.getPacket();
            if (packet instanceof net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket commandPacket) {
                // Блокируем пакеты START_SPRINTING и STOP_SPRINTING
                try {
                    var modeField = commandPacket.getClass().getDeclaredField("field_52812"); // mode field
                    modeField.setAccessible(true);
                    var mode = modeField.get(commandPacket);
                    String modeName = mode.toString();
                    if (modeName.contains("SPRINT")) {
                        event.cancel();
                    }
                } catch (Exception ignored) {}
            }
        }
    };

    public Aura() {
        this.initialize();
    }

    @VMProtect(type = VMProtectType.VIRTUALIZATION)
    private void initialize() {
        // НАСТРОЙКИ СБРОСА СПРИНТА
        this.sprintResetMode = new ModeSetting(this, "Сброс спринта");
        this.rageSprintReset = new ModeSetting.Value(this.sprintResetMode, "Rage").select();
        this.legitSprintReset = new ModeSetting.Value(this.sprintResetMode, "Legit");
        this.legitV2SprintReset = new ModeSetting.Value(this.sprintResetMode, "LegitV2");
        this.noneSprintReset = new ModeSetting.Value(this.sprintResetMode, "None");

        this.attackDistance = new SliderSetting(this, "modules.settings.aura.attackDistance")
                .min(0.1F)
                .max(6.0F)
                .step(0.1F)
                .currentValue(3.0F)
                .suffix(number -> " %s".formatted(Localizator.translate("block")) + TextUtility.makeCountTranslated(number));
        this.aimDistance = new SliderSetting(this, "modules.settings.aura.aimDistance")
                .min(0.1F)
                .max(6.0F)
                .step(0.1F)
                .currentValue(3.0F)
                .suffix(number -> " %s".formatted(Localizator.translate("block")) + TextUtility.makeCountTranslated(number));

        this.onlyCriticals = new BooleanSetting(this, "Только криты");
        this.walls = new BooleanSetting(this, "Через стены").enable();
        this.rayTrace = new BooleanSetting(this, "Проверка наводки").enable();
        this.targeting = new BooleanSetting(this, "Преследовать").enable();
        this.onlyWeapon = new BooleanSetting(this, "Только с оружием");
        this.breakShield = new BooleanSetting(this, "Ломка щита").enable();
        this.shieldBreaker = new BooleanSetting(this, "Отжим щита").enable();
        this.noAttackWhileEating = new BooleanSetting(this, "Не бить при еде").enable();

        this.targets = new SelectSetting(this, "targets");
        this.players = new SelectSetting.Value(this.targets, "players").select();
        this.animals = new SelectSetting.Value(this.targets, "animals").select();
        this.mobs = new SelectSetting.Value(this.targets, "mobs").select();
        this.invisibles = new SelectSetting.Value(this.targets, "invisibles").select();
        this.nakedPlayers = new SelectSetting.Value(this.targets, "nakedPlayers").select();
        this.friends = new SelectSetting.Value(this.targets, "friends");
        this.sortingMode = new ModeSetting(this, "sorting");
        this.distanceSorting = new ModeSetting.Value(this.sortingMode, "modules.settings.aura.distanceSorting").select();
        this.healthSorting = new ModeSetting.Value(this.sortingMode, "modules.settings.aura.healthSorting");
        this.fovSorting = new ModeSetting.Value(this.sortingMode, "modules.settings.aura.fovSorting");
        this.moveCorrectionMode = new ModeSetting(this, "modules.settings.aura.moveCorrectionMode");
        this.noMoveCorrection = new ModeSetting.Value(this.moveCorrectionMode, "modules.settings.aura.noMoveCorrection");
        this.directMoveCorrection = new ModeSetting.Value(this.moveCorrectionMode, "modules.settings.aura.directMoveCorrection");
        this.silentMoveCorrection = new ModeSetting.Value(this.moveCorrectionMode, "modules.settings.aura.silentMoveCorrection").select();
        this.styleAttack = new ModeSetting(this, "modules.settings.aura.styleAttack");
        this.fastPvp = new ModeSetting.Value(this.styleAttack, "1.8");
        this.slowPvp = new ModeSetting.Value(this.styleAttack, "1.9").select();

        this.attackTimer = new Timer();
    }

    private void handleSprintReset() {
        if (mc.player == null) return;

        if (sprintResetMode.is(rageSprintReset)) {
            legitV2SprintDisabled = false;
            return;
        }

        if (sprintResetMode.is(legitSprintReset)) {
            legitV2SprintDisabled = false;

            if (mc.player.isSprinting()
                    && mc.player.input != null
                    && mc.player.input.hasForwardMovement()
                    && isCooledDown()) {
                wasSprinting = true;

                sprintResetTicks = 2;
                mc.player.setSprinting(false);
            }

            if (sprintResetTicks > 0) {
                sprintResetTicks--;
                if (sprintResetTicks == 0 && wasSprinting) {
                    if (!mc.player.horizontalCollision && !mc.player.isTouchingWater()) {
                        mc.player.setSprinting(true);
                    }
                    wasSprinting = false;
                }
            }
            return;
        }

        if (sprintResetMode.is(legitV2SprintReset)) {
            // LegitV2: выключаем спринт локально (клиент видит что не бежит, но сервер думает что бежит)
           
            // Если есть цель в радиусе атаки - выключаем спринт только локально
            if (target != null && inRange(target)) {
                // Используем рефлексию для прямого изменения поля без пакета
                try {
                    var field = net.minecraft.entity.Entity.class.getDeclaredField("field_5960"); // sprinting field
                    field.setAccessible(true);
                    field.setBoolean(mc.player, false);
                    legitV2SprintDisabled = true;
                } catch (Exception e) {
                    // Fallback на обычный setSprinting если рефлексия не работает
                    mc.player.setSprinting(false);
                    legitV2SprintDisabled = true;
                }
            } else {
                // Цель вне дистанции или нет цели - включаем спринт обратно
                if (legitV2SprintDisabled) {
                    if (mc.player.input != null
                        && mc.player.input.hasForwardMovement()
                        && !mc.player.horizontalCollision
                        && !mc.player.isTouchingWater()) {
                        mc.player.setSprinting(true);
                    }
                    legitV2SprintDisabled = false;
                }
            }
            return;
        }

        if (sprintResetMode.is(noneSprintReset)) {
            legitV2SprintDisabled = false;
            return;
        }
    }

    private MoveCorrection getMoveCorrection() {
        if (this.moveCorrectionMode.is(this.silentMoveCorrection)) {
            return MoveCorrection.SILENT;
        } else if (this.moveCorrectionMode.is(this.directMoveCorrection)) {
            return MoveCorrection.DIRECT;
        }
        return MoveCorrection.NONE;
    }

    private float wrapDegrees(float angle) {
        return MathHelper.wrapDegrees(angle);
    }

    // SpookyV2 — улучшенная версия с предсказанием движения и адаптивной скоростью
    private void handleSpookyV2Rotation(LivingEntity target, MoveCorrection moveCorrection, RotationHandler handler, Rotation currentRot) {
        if (mc.player == null || target == null) return;

        // Рандомизированный сброс noise (350-650 тиков для большей вариативности)
        if (spv2NoiseResetAge == 0) {
            spv2NoiseResetAge = 350 + (int)(Math.random() * 300);
        }
        if (mc.player.age % spv2NoiseResetAge == 0) {
            this.noise = new PerlinNoise();
            this.noiseFactor = 1.0F;
            spv2NoiseResetAge = 350 + (int)(Math.random() * 300);
        }

        // Плавный переход при смене цели с полным сбросом состояния
        if (spv2LastTarget != target) {
            spv2LastTarget = target;
            spv2SmoothInit = false;
            spv2LastTargetPos = target.getPos();
            spv2TargetVelocity = Vec3d.ZERO;
            spv2AdaptiveYawSpeed = 1.0F;
            spv2AdaptivePitchSpeed = 1.0F;
            spv2IdleShiftTimer = 0;
            // Рандомизируем idle смещения при смене цели
            spv2IdleYawShift   = 1.5F + (float)(Math.random() * 5.0F);   // 1.5..6.5
            spv2IdlePitchShift = -(4.0F + (float)(Math.random() * 6.0F)); // -4..-10
        }

        // Вычисление скорости цели для предсказания
        Vec3d currentTargetPos = target.getPos();
        if (spv2LastTargetPos != null) {
            Vec3d rawVelocity = currentTargetPos.subtract(spv2LastTargetPos);
            // Плавное сглаживание скорости (0.3 = 30% новое значение, 70% старое)
            spv2TargetVelocity = spv2TargetVelocity.multiply(0.7).add(rawVelocity.multiply(0.3));
        }
        spv2LastTargetPos = currentTargetPos;

        // Предсказание позиции цели на 3-5 тиков вперед
        int predictionTicks = 3 + (int)(Math.random() * 3); // 3-5 тиков
        Vec3d predictedPos = currentTargetPos.add(spv2TargetVelocity.multiply(predictionTicks));

        boolean collide = EntityUtility.collideWith(target, 1.0F);
        Vec3d nearY = RotationMath.getNearestPoint(target);
       
        // Используем предсказанную позицию для быстро движущихся целей
        double targetSpeed = spv2TargetVelocity.length();
        Vec3d aimPoint = targetSpeed > 0.1 ? predictedPos : nearY;
       
        Rotation targetRot = RotationMath.getRotationTo(
                new Vec3d(
                        aimPoint.x,
                        MathHelper.clamp(
                                MathUtility.interpolate(mc.player.getY(), target.getEyeY(), 0.5),
                                target.getBoundingBox().minY,
                                target.getBoundingBox().maxY
                        ),
                        aimPoint.z
                )
        );
       
        Rotation multipoint = RotationMath.getRotationTo(RotationMath.getNearestPoint(target));
        if (collide) {
            targetRot = RotationMath.getRotationTo(target.getPos().add(0.0, 0.5, 0.0));
        }

        // Оптимизация: проверяем canTraceWithBlock только каждые 4 тика
        if (tickCounter % 4 == 0 && !MathUtility.canTraceWithBlock(
                this.attackDistance.getCurrentValue(), targetRot.getYaw(), targetRot.getPitch(), mc.player, target, !this.walls.isEnabled()
        ) && mc.player.getEyePos().distanceTo(target.getEyePos()) > 3.0) {
            targetRot.setPitch(multipoint.getPitch() + 10.0F);
        }

        boolean idle = this.attackTimer.finished(collide ? 500L : 200L);
        if (this.additional == null) {
            this.additional = new Rotation(0.0F, 0.0F);
        }

        float targetYaw   = targetRot.getYaw();
        float targetPitch = targetRot.getPitch();
        float yawDiff   = RotationMath.getAngleDifference(currentRot.getYaw(),   targetYaw);
        float pitchDiff = RotationMath.getAngleDifference(currentRot.getPitch(), targetPitch);

        // Динамическое изменение idle смещений каждые 60-120 тиков
        spv2IdleShiftTimer++;
        if (spv2IdleShiftTimer > 60 + (int)(Math.random() * 60)) {
            spv2IdleShiftTimer = 0;
            spv2IdleYawShift   = 1.5F + (float)(Math.random() * 5.0F);
            spv2IdlePitchShift = -(4.0F + (float)(Math.random() * 6.0F));
        }

        // Рандомизированное idle смещение
        if (!this.shouldPreventSprinting() && idle && EntityUtility.getBlock(0.0, 2.0, 0.0) == Blocks.AIR) {
            targetYaw   += spv2IdleYawShift;
            targetPitch += spv2IdlePitchShift;
        }

        // Адаптивная скорость: учитываем скорость цели и расстояние
        boolean needCrit = this.shouldPreventSprinting();
        float distanceFactor = (float)Math.min(mc.player.distanceTo(target) / 4.0, 1.5);
        float speedFactor = (float)Math.min(targetSpeed * 10.0, 1.5); // Быстрее для быстрых целей
       
        float baseYawDivisor   = needCrit ? 4.0F  : (!this.shouldPreventSprinting() && idle ? 3.0F  : (idle ? (mc.player.fallDistance > 0.0F ? 15.0F : 6.0F) : 40.0F));
        float basePitchDivisor = needCrit ? 8.0F  : (!this.shouldPreventSprinting() && idle ? 3.0F  : (idle ? (mc.player.fallDistance > 0.0F ? 15.0F : 6.0F) : 30.0F));

        // Применяем адаптивные множители
        baseYawDivisor   /= (distanceFactor * spv2AdaptiveYawSpeed);
        basePitchDivisor /= (distanceFactor * spv2AdaptivePitchSpeed);

        float yawSpeed   = Math.max((90.0F - Math.abs(yawDiff))   / baseYawDivisor,   MathUtility.random(2.0, 7.0)) * MathUtility.random(0.85, 1.15);
        float pitchSpeed = Math.abs(pitchDiff) / basePitchDivisor * MathUtility.random(0.85, 1.15);

        // Адаптация скорости: если долго не попадаем - ускоряемся
        if (Math.abs(yawDiff) > 15.0F || Math.abs(pitchDiff) > 15.0F) {
            spv2AdaptiveYawSpeed = Math.min(spv2AdaptiveYawSpeed + 0.03F, 2.0F);
            spv2AdaptivePitchSpeed = Math.min(spv2AdaptivePitchSpeed + 0.03F, 2.0F);
        } else {
            spv2AdaptiveYawSpeed = Math.max(spv2AdaptiveYawSpeed - 0.02F, 0.8F);
            spv2AdaptivePitchSpeed = Math.max(spv2AdaptivePitchSpeed - 0.02F, 0.8F);
        }

        if (!EntityUtility.collideWith(target)) {
            this.collideTimer.reset();
        }

        if (this.collideTimer.finished(500L) && CombatUtility.stalin(target)) {
            targetPitch = (float)(
                    64.0 + (mc.player.getY() - target.getY() + 1.0) * (5.0 + Math.sin(mc.player.age % 100 / 5 * 1924.12F) * 35.0) - 5.0 + 10.0
            );
            yawSpeed /= MathUtility.random(30.0, 50.0);
        }

        if (!idle && EntityUtility.getBlock(0.0, 2.0, 0.0) == Blocks.AIR && !collide) {
            targetYaw   += this.additional.getYaw();
            targetPitch += this.additional.getPitch();
        }

        if (this.walls.isEnabled() && !MathUtility.canSeen(nearY) && mc.player.fallDistance <= CombatUtility.getFallDistance(target)) {
            targetPitch = -90.0F;
        }

        // Улучшенная логика noise factor с более быстрой адаптацией
        float totalDiff = Math.abs(yawDiff) + Math.abs(pitchDiff);
        if (totalDiff < 8.0F) {
            this.noiseFactor = Math.max(0.0F, this.noiseFactor - 0.06F); // Быстрее убираем noise
        } else if (totalDiff > 20.0F) {
            this.noiseFactor = Math.min(1.0F, this.noiseFactor + 0.04F); // Быстрее добавляем noise
        }

        // Плавная интерполяция для более естественного движения
        if (!spv2SmoothInit) {
            spv2SmoothYaw = currentRot.getYaw();
            spv2SmoothPitch = currentRot.getPitch();
            spv2SmoothInit = true;
        }

        // Интерполяция с учетом скорости (чем ближе к цели, тем плавнее)
        float smoothFactor = MathHelper.clamp(totalDiff / 50.0F, 0.3F, 0.8F);
        spv2SmoothYaw = MathUtility.interpolate(spv2SmoothYaw, targetYaw, smoothFactor);
        spv2SmoothPitch = MathUtility.interpolate(spv2SmoothPitch, targetPitch, smoothFactor);

        long timeElapsed = System.currentTimeMillis() - this.rotationStartTime;
        float yawNoise   = (float) this.noise.noise(timeElapsed * 4.5E-4); // Немного быстрее
        float pitchNoise = (float) this.noise.noise(timeElapsed * 4.5E-4, 10.0);
       
        // Адаптивный noise: меньше для близких целей, больше для дальних
        float noiseScale = MathHelper.clamp((float)mc.player.distanceTo(target) / 5.0F, 0.5F, 1.5F);
        float yawOffset   = yawNoise   * 7.0F * this.noiseFactor * noiseScale;
        float pitchOffset = pitchNoise * 5.0F * this.noiseFactor * noiseScale;

        float finalYaw   = spv2SmoothYaw   + yawOffset;
        float finalPitch = spv2SmoothPitch + pitchOffset;

        handler.rotate(
                new Rotation(finalYaw, MathHelper.clamp(finalPitch, -90.0F, 90.0F)),
                moveCorrection,
                yawSpeed * 25.0F,
                pitchSpeed * 25.0F,
                MathUtility.random(30.0, 70.0),
                RotationPriority.TO_TARGET
        );
    }

    private void rotateHead(LivingEntity targetedEntity) {
        if (!this.onlyWeapon.isEnabled() || EntityUtility.isHoldingWeapon()) {
            MoveCorrection moveCorrection = getMoveCorrection();
            RotationHandler handler = Holly.getInstance().getRotationHandler();
            Rotation currentRot = handler.getCurrentRotation();

            handleSpookyV2Rotation(targetedEntity, moveCorrection, handler, currentRot);
        }
    }

    private boolean isPlayerEating() {
        if (mc.player == null) return false;

        boolean isEating = mc.player.isUsingItem() &&
                mc.player.getActiveItem().getItem().getUseAction(mc.player.getActiveItem()) == UseAction.EAT;

        if (isEating) {
            eatTimer.reset();
            return true;
        }

        return !eatTimer.finished(500);
    }

    private boolean shouldAttackEntity(LivingEntity targetedEntity) {
        if (noAttackWhileEating.isEnabled() && isPlayerEating()) {
            return false;
        }

        if (!this.isCooledDown()) {
            return false;
        } else if (this.onlyWeapon.isEnabled() && !EntityUtility.isHoldingWeapon()) {
            return false;
        } else if (mc.player.isUsingItem() && mc.player.getActiveHand() == Hand.MAIN_HAND) {
            return false;
        } else if (this.inRange(targetedEntity)) {
            return false;
        } else if (this.walls.isEnabled() && tickCounter % 3 == 0) { // Проверяем raycast только каждые 3 тика
            Type rayType = mc.world
                .raycast(
                        new RaycastContext(
                                mc.player.getEyePos(),
                                mc.player
                                        .getEyePos()
                                        .add(
                                                mc.player
                                                        .getRotationVector(-90.0F, Holly.getInstance().getRotationHandler().getCurrentRotation().getYaw())
                                                        .multiply(this.attackDistance.getCurrentValue())
                                        ),
                                ShapeType.COLLIDER,
                                FluidHandling.NONE,
                                mc.player
                        )
                )
                .getType();
            if (rayType == Type.BLOCK) {
                return false;
            }
        }
       
        // Кешируем результат canTraceWithBlock
        if (this.rayTrace.isEnabled() && tickCounter % 2 == 0) {
            return MathUtility.canTraceWithBlock(
                    this.attackDistance.getCurrentValue(),
                    Holly.getInstance().getRotationHandler().getCurrentRotation().getYaw(),
                    Holly.getInstance().getRotationHandler().getCurrentRotation().getPitch(),
                    mc.player,
                    targetedEntity,
                    !this.walls.isEnabled()
            ) && (!this.onlyCriticals.isEnabled() || !this.isCriticalRequired(targetedEntity) || CombatUtility.canPerformCriticalHit(targetedEntity, true));
        }
       
        return !this.onlyCriticals.isEnabled() || !this.isCriticalRequired(targetedEntity) || CombatUtility.canPerformCriticalHit(targetedEntity, true);
    }

    private boolean isCriticalRequired(LivingEntity targetedEntity) {
        float damage = this.calculateDamage(targetedEntity);
        return damage <= targetedEntity.getHealth();
    }

    public boolean isCooledDown() {
        if (mc.player == null) {
            return false;
        } else {
            return CombatUtility.getMace() != null
                    ? this.attackTimer.finished(500L)
                    : mc.player.getAttackCooldownProgress(1.5F) > 0.93F && this.attackTimer.finished(500L)
                    || this.fastPvp.isSelected() && this.attackTimer.finished(50L);
        }
    }

    public float calculateDamage(LivingEntity targetedEntity) {
        return 0.0F;
    }

    private void attack(LivingEntity targetedEntity) {
        if (mc.interactionManager != null && mc.player != null) {

            this.shield = mc.player.isUsingItem() && mc.player.getActiveItem().getItem().getUseAction(mc.player.getActiveItem()) == UseAction.BLOCK;
            if (this.shield) {
                mc.player.networkHandler.sendPacket(new PlayerActionC2SPacket(Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, Direction.DOWN));
            }

            if (this.breakShield.isEnabled() && CombatUtility.shouldBreakShield(targetedEntity) && CombatUtility.canBreakShield(targetedEntity)) {
                CombatUtility.tryBreakShield(targetedEntity);
            }

            if (this.shieldBreaker.isEnabled()) {
                if (targetedEntity.isBlocking()) {

                }
            }

            HotbarSlot slot = CombatUtility.getMace();
            if (slot != null) {
                mc.player.networkHandler.sendPacket(new UpdateSelectedSlotC2SPacket(slot.getSlotId()));
                if (this.breakShield.isEnabled()) {
                    CombatUtility.tryBreakShield(targetedEntity);
                }
            }

            mc.interactionManager.attackEntity(mc.player, targetedEntity);
            mc.player.swingHand(Hand.MAIN_HAND);

            if (slot != null) {
                mc.player.networkHandler.sendPacket(new UpdateSelectedSlotC2SPacket(mc.player.getInventory().selectedSlot));
            }

            if (this.shield) {
                mc.interactionManager
                        .sendSequencedPacket(
                                mc.world,
                                sequence -> new PlayerInteractItemC2SPacket(
                                        mc.player.getActiveHand(),
                                        sequence,
                                        Holly.getInstance().getRotationHandler().getCurrentRotation().getYaw(),
                                        Holly.getInstance().getRotationHandler().getCurrentRotation().getPitch()
                                )
                        );
            }

            this.additional = new Rotation(MathUtility.random(5.0, 20.0), MathUtility.random(5.0, 10.0));
            this.attackTimer.reset();
            this.attacks++;
        }
    }

    public float getGCDValue() {
        double sensitivity = (Double)mc.options.getMouseSensitivity().getValue();
        double value = sensitivity * 0.6 + 0.2;
        double result = Math.pow(value, 3.0) * 0.8;
        return (float)result * 0.15F;
    }

    public float getSensitivity(float rot) {
        return this.getDeltaMouse(rot) * this.getGCDValue();
    }

    public float getDeltaMouse(float delta) {
        return Math.round(delta / this.getGCDValue());
    }

    public boolean shouldPreventSprinting() {
        LivingEntity target = Holly.getInstance().getTargetManager().getCurrentTarget() instanceof LivingEntity living ? living : null;
        if (target == null || mc.player == null) {
            return false;
        }
       
        // LegitV2 режим: блокируем AutoSprint когда цель в радиусе
        if (this.sprintResetMode.is(this.legitV2SprintReset) && target != null && inRange(target)) {
            return true;
        }
       
        if (this.styleAttack.is(this.fastPvp)) {
            return false;
        } else {
            Criticals criticals = Holly.getInstance().getModuleManager().getModule(Criticals.class);
            boolean predict = criticals.isEnabled() && (criticals.canCritical() || mc.player.isOnGround())
                    || !mc.player.isOnGround() && FallingPlayer.fromPlayer(mc.player).findFall(CombatUtility.getFallDistance(target));
            return this.onlyCriticals.isEnabled()
                    && this.isCriticalRequired(target)
                    && (
                    predict
                            || CombatUtility.canPerformCriticalHit(target, true)
                            || !this.attackTimer.finished(!ServerUtility.isHW() && !ServerUtility.isST() ? 50L : (long)MathUtility.random(50.0, 150.0))
            );
        }
    }

    private boolean inRange(LivingEntity target) {
        return MathHelper.sqrt((float)mc.player.squaredDistanceTo(RotationMath.getNearestPoint(target))) > this.attackDistance.getCurrentValue();
    }

    @Override
    public void onEnable() {
        this.rotationStartTime = System.currentTimeMillis();
        this.noise = new PerlinNoise();
        this.noiseFactor = 1.0F;

        wasSprinting = false;
        sprintResetTicks = 0;

        if (mc.player != null) {
            this.rotateVector = new Vector2f(mc.player.getYaw(), mc.player.getPitch());
        }

        super.onEnable();
    }

    @Override
    public void onDisable() {
        Holly.getInstance().getTargetManager().reset();

        if (wasSprinting && mc.player != null) {
            mc.player.setSprinting(true);
        }
       
        // Восстанавливаем спринт при выключении ауры для LegitV2
        if (legitV2SprintDisabled && mc.player != null) {
            if (mc.player.input != null
                && mc.player.input.hasForwardMovement()
                && !mc.player.horizontalCollision
                && !mc.player.isTouchingWater()) {
                mc.player.setSprinting(true);
            }
            legitV2SprintDisabled = false;
        }

        super.onDisable();
    }

    @Generated
    public ModeSetting.Value getFastPvp() {
        return this.fastPvp;
    }

    @Generated
    public ModeSetting.Value getSlowPvp() {
        return this.slowPvp;
    }

    @Generated
    public Timer getAttackTimer() {
        return this.attackTimer;
    }

    @Generated
    public int getAttacks() {
        return this.attacks;
    }

}
 
Последнее редактирование:
Ротация спуки тамй на 1.21.4 ( база рокстара)
Когда тестил обходило невьебенно хорошо
Сливаю фул ауру, вырежьте лучше сброс legitV2, так как он взаимодейтсвует с моим клиентом и автоспринтов( либо если не лень адаптируйте его)
SS - нахера? обычная ротка
Вырезал с помощью ИИ, сори за говно в коде:
Java:
Expand Collapse Copy
package moscow.holly.systems.modules.modules.combat;

import lombok.Generated;
import moscow.holly.Holly;
import moscow.holly.systems.event.EventListener;
import moscow.holly.systems.event.impl.player.ClientPlayerTickEvent;
import moscow.holly.systems.event.impl.player.ClientPlayerTickEndEvent;
import moscow.holly.systems.event.impl.network.SendPacketEvent;
import moscow.holly.systems.localization.Localizator;
import moscow.holly.systems.modules.api.ModuleCategory;
import moscow.holly.systems.modules.api.ModuleInfo;
import moscow.holly.systems.modules.impl.BaseModule;
import moscow.holly.systems.setting.settings.BooleanSetting;
import moscow.holly.systems.setting.settings.ModeSetting;
import moscow.holly.systems.setting.settings.SelectSetting;
import moscow.holly.systems.setting.settings.SliderSetting;
import moscow.holly.systems.target.TargetComparators;
import moscow.holly.systems.target.TargetSettings;
import moscow.holly.utility.animation.base.Animation;
import moscow.holly.utility.animation.base.Easing;
import moscow.holly.utility.game.CombatUtility;
import moscow.holly.utility.game.EntityUtility;
import moscow.holly.utility.game.TextUtility;
import moscow.holly.utility.game.prediction.ElytraPredictionSystem;
import moscow.holly.utility.game.prediction.FallingPlayer;
import moscow.holly.utility.game.server.ServerUtility;
import moscow.holly.utility.inventory.slots.HotbarSlot;
import moscow.holly.utility.math.MathUtility;
import moscow.holly.utility.math.PerlinNoise;
import moscow.holly.utility.rotations.MoveCorrection;
import moscow.holly.utility.rotations.Rotation;
import moscow.holly.utility.rotations.RotationHandler;
import moscow.holly.utility.rotations.RotationMath;
import moscow.holly.utility.rotations.RotationPriority;
import moscow.holly.utility.time.Timer;
import net.minecraft.block.Blocks;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.consume.UseAction;
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerInteractItemC2SPacket;
import net.minecraft.network.packet.c2s.play.UpdateSelectedSlotC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket.Action;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.HitResult.Type;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.RaycastContext;
import net.minecraft.world.RaycastContext.FluidHandling;
import net.minecraft.world.RaycastContext.ShapeType;
import org.joml.Vector2f;
import ru.kotopushka.compiler.sdk.annotations.VMProtect;
import ru.kotopushka.compiler.sdk.enums.VMProtectType;

import java.util.Optional;
import java.util.Random;

@ModuleInfo(name = "Aura", category = ModuleCategory.COMBAT, desc = "Бьёт женщин и детей")
public class Aura extends BaseModule {
    private SliderSetting attackDistance;
    private SliderSetting aimDistance;
    private SelectSetting targets;
    private SelectSetting.Value players;
    private SelectSetting.Value animals;
    private SelectSetting.Value mobs;
    private SelectSetting.Value invisibles;
    private SelectSetting.Value nakedPlayers;
    private SelectSetting.Value friends;
    private ModeSetting sortingMode;
    private ModeSetting.Value distanceSorting;
    private ModeSetting.Value healthSorting;
    private ModeSetting.Value fovSorting;
    private ModeSetting moveCorrectionMode;
    private ModeSetting.Value noMoveCorrection;
    private ModeSetting.Value directMoveCorrection;
    private ModeSetting.Value silentMoveCorrection;
    private ModeSetting styleAttack;
    private ModeSetting.Value fastPvp;
    private ModeSetting.Value slowPvp;
    private BooleanSetting onlyCriticals;
    private BooleanSetting walls;
    private BooleanSetting rayTrace;
    private BooleanSetting targeting;
    private BooleanSetting onlyWeapon;
    private BooleanSetting breakShield;
    private BooleanSetting shieldBreaker;
    private BooleanSetting noAttackWhileEating;

    private ModeSetting sprintResetMode;
    private ModeSetting.Value rageSprintReset;
    private ModeSetting.Value legitSprintReset;
    private ModeSetting.Value legitV2SprintReset;
    private ModeSetting.Value noneSprintReset;
    private boolean wasSprinting = false;
    private int sprintResetTicks = 0;
    private boolean legitV2SprintDisabled = false;
    private int legitV2SprintCooldown = 0;

    private final Animation nononoYaw = new Animation(300L, Easing.LINEAR);
    private final Animation nononoPitch = new Animation(1000L, Easing.LINEAR);
    private Timer attackTimer;
    boolean shield;
    private PerlinNoise noise = new PerlinNoise();
    private long rotationStartTime = 0L;
    private float noiseFactor = 0.0F;
    private int attacks;
    private Rotation additional;
    private final Timer collideTimer = new Timer();
    private final Timer eatTimer = new Timer();
    private int tickCounter = 0;

    // SpookyV2 state - улучшенная версия с предсказанием движения
    private int spv2NoiseResetAge = 0;
    private float spv2IdleYawShift = 10.0F;
    private float spv2IdlePitchShift = -20.0F;
    private LivingEntity spv2LastTarget = null;
    private float spv2SmoothYaw = 0.0F;
    private float spv2SmoothPitch = 0.0F;
    private boolean spv2SmoothInit = false;
    private int spv2IdleShiftTimer = 0;
    private Vec3d spv2LastTargetPos = null;
    private Vec3d spv2TargetVelocity = Vec3d.ZERO;
    private float spv2AdaptiveYawSpeed = 1.0F;
    private float spv2AdaptivePitchSpeed = 1.0F;

    private Vector2f rotateVector = new Vector2f(0, 0);

    private boolean isInHitbox = false;
    private boolean isAccelerating = false;
    private long accelerationStartTime = 0L;
    private int accelerationDelay = 0;
    private float currentSpeedMultiplier = 1.0f;
    private float lastYaw = 0f;
    private float lastPitch = 0f;
    private final Random random = new Random();
    private LivingEntity target;

    private final EventListener<ClientPlayerTickEvent> onPlayerTick = event -> {
        if (mc.player != null) {
            tickCounter++;
           
            // Обновляем таргет только каждые 2 тика для снижения нагрузки
            if (tickCounter % 2 == 0) {
                boolean elytraTargetActive = Holly.getInstance().getModuleManager().getModule(ElytraTarget.class).isEnabled();
                boolean isGliding = mc.player.isGliding()
                        && moscow.holly.utility.inventory.InventoryUtility.getChestplateSlot().item() == net.minecraft.item.Items.ELYTRA;

                float requiredAimDistance = elytraTargetActive && isGliding
                        ? 50.0F
                        : this.aimDistance.getCurrentValue();

                TargetSettings.Builder builder = new TargetSettings.Builder()
                        .targetPlayers(this.players.isSelected())
                        .targetAnimals(this.animals.isSelected())
                        .targetMobs(this.mobs.isSelected())
                        .targetInvisibles(this.invisibles.isSelected())
                        .targetNakedPlayers(this.nakedPlayers.isSelected())
                        .targetFriends(this.friends.isSelected())
                        .requiredRange(requiredAimDistance);

                if (this.sortingMode.is(this.distanceSorting)) {
                    builder.sortBy(TargetComparators.DISTANCE);
                } else if (this.sortingMode.is(this.healthSorting)) {
                    builder.sortBy(TargetComparators.HEALTH);
                } else if (this.sortingMode.is(this.fovSorting)) {
                    builder.sortBy(TargetComparators.FOV);
                }

                TargetSettings settings = builder.build();
                target = Holly.getInstance().getTargetManager().getCurrentTarget() instanceof LivingEntity living ? living : null;

                if (!this.targeting.isEnabled()
                        || target == null
                        || MathHelper.sqrt((float)mc.player.squaredDistanceTo(RotationMath.getNearestPoint(target))) > requiredAimDistance
                        || !mc.world.hasEntity(target)
                        || !target.isAlive()) {
                    Holly.getInstance().getTargetManager().update(settings);
                }
            }

            if (target != null) {
                handleSprintReset();

                this.rotateHead(target);
                if (this.shouldAttackEntity(target)) {
                    this.attack(target);
                }
            } else {
                // Восстанавливаем спринт когда нет цели
                handleSprintReset();
               
                this.rotationStartTime = System.currentTimeMillis();
                this.noise = new PerlinNoise();
                this.noiseFactor = 1.0F;
                this.spv2SmoothInit = false;
            }
        }
    };

    // Дополнительный обработчик в конце тика для принудительного контроля спринта
    private final EventListener<ClientPlayerTickEndEvent> onPlayerTickEnd = event -> {
        if (mc.player != null && sprintResetMode.is(legitV2SprintReset)) {
            // Принудительно выключаем спринт если цель в радиусе (локально)
            if (target != null && inRange(target)) {
                try {
                    var field = net.minecraft.entity.Entity.class.getDeclaredField("field_5960");
                    field.setAccessible(true);
                    field.setBoolean(mc.player, false);
                } catch (Exception e) {
                    mc.player.setSprinting(false);
                }
            }
        }
    };

    // Блокируем отправку пакетов спринта в режиме LegitV2
    private final EventListener<SendPacketEvent> onSendPacket = event -> {
        if (sprintResetMode.is(legitV2SprintReset) && target != null && inRange(target)) {
            var packet = event.getPacket();
            if (packet instanceof net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket commandPacket) {
                // Блокируем пакеты START_SPRINTING и STOP_SPRINTING
                try {
                    var modeField = commandPacket.getClass().getDeclaredField("field_52812"); // mode field
                    modeField.setAccessible(true);
                    var mode = modeField.get(commandPacket);
                    String modeName = mode.toString();
                    if (modeName.contains("SPRINT")) {
                        event.cancel();
                    }
                } catch (Exception ignored) {}
            }
        }
    };

    public Aura() {
        this.initialize();
    }

    @VMProtect(type = VMProtectType.VIRTUALIZATION)
    private void initialize() {
        // НАСТРОЙКИ СБРОСА СПРИНТА
        this.sprintResetMode = new ModeSetting(this, "Сброс спринта");
        this.rageSprintReset = new ModeSetting.Value(this.sprintResetMode, "Rage").select();
        this.legitSprintReset = new ModeSetting.Value(this.sprintResetMode, "Legit");
        this.legitV2SprintReset = new ModeSetting.Value(this.sprintResetMode, "LegitV2");
        this.noneSprintReset = new ModeSetting.Value(this.sprintResetMode, "None");

        this.attackDistance = new SliderSetting(this, "modules.settings.aura.attackDistance")
                .min(0.1F)
                .max(6.0F)
                .step(0.1F)
                .currentValue(3.0F)
                .suffix(number -> " %s".formatted(Localizator.translate("block")) + TextUtility.makeCountTranslated(number));
        this.aimDistance = new SliderSetting(this, "modules.settings.aura.aimDistance")
                .min(0.1F)
                .max(6.0F)
                .step(0.1F)
                .currentValue(3.0F)
                .suffix(number -> " %s".formatted(Localizator.translate("block")) + TextUtility.makeCountTranslated(number));

        this.onlyCriticals = new BooleanSetting(this, "Только криты");
        this.walls = new BooleanSetting(this, "Через стены").enable();
        this.rayTrace = new BooleanSetting(this, "Проверка наводки").enable();
        this.targeting = new BooleanSetting(this, "Преследовать").enable();
        this.onlyWeapon = new BooleanSetting(this, "Только с оружием");
        this.breakShield = new BooleanSetting(this, "Ломка щита").enable();
        this.shieldBreaker = new BooleanSetting(this, "Отжим щита").enable();
        this.noAttackWhileEating = new BooleanSetting(this, "Не бить при еде").enable();

        this.targets = new SelectSetting(this, "targets");
        this.players = new SelectSetting.Value(this.targets, "players").select();
        this.animals = new SelectSetting.Value(this.targets, "animals").select();
        this.mobs = new SelectSetting.Value(this.targets, "mobs").select();
        this.invisibles = new SelectSetting.Value(this.targets, "invisibles").select();
        this.nakedPlayers = new SelectSetting.Value(this.targets, "nakedPlayers").select();
        this.friends = new SelectSetting.Value(this.targets, "friends");
        this.sortingMode = new ModeSetting(this, "sorting");
        this.distanceSorting = new ModeSetting.Value(this.sortingMode, "modules.settings.aura.distanceSorting").select();
        this.healthSorting = new ModeSetting.Value(this.sortingMode, "modules.settings.aura.healthSorting");
        this.fovSorting = new ModeSetting.Value(this.sortingMode, "modules.settings.aura.fovSorting");
        this.moveCorrectionMode = new ModeSetting(this, "modules.settings.aura.moveCorrectionMode");
        this.noMoveCorrection = new ModeSetting.Value(this.moveCorrectionMode, "modules.settings.aura.noMoveCorrection");
        this.directMoveCorrection = new ModeSetting.Value(this.moveCorrectionMode, "modules.settings.aura.directMoveCorrection");
        this.silentMoveCorrection = new ModeSetting.Value(this.moveCorrectionMode, "modules.settings.aura.silentMoveCorrection").select();
        this.styleAttack = new ModeSetting(this, "modules.settings.aura.styleAttack");
        this.fastPvp = new ModeSetting.Value(this.styleAttack, "1.8");
        this.slowPvp = new ModeSetting.Value(this.styleAttack, "1.9").select();

        this.attackTimer = new Timer();
    }

    private void handleSprintReset() {
        if (mc.player == null) return;

        if (sprintResetMode.is(rageSprintReset)) {
            legitV2SprintDisabled = false;
            return;
        }

        if (sprintResetMode.is(legitSprintReset)) {
            legitV2SprintDisabled = false;

            if (mc.player.isSprinting()
                    && mc.player.input != null
                    && mc.player.input.hasForwardMovement()
                    && isCooledDown()) {
                wasSprinting = true;

                sprintResetTicks = 2;
                mc.player.setSprinting(false);
            }

            if (sprintResetTicks > 0) {
                sprintResetTicks--;
                if (sprintResetTicks == 0 && wasSprinting) {
                    if (!mc.player.horizontalCollision && !mc.player.isTouchingWater()) {
                        mc.player.setSprinting(true);
                    }
                    wasSprinting = false;
                }
            }
            return;
        }

        if (sprintResetMode.is(legitV2SprintReset)) {
            // LegitV2: выключаем спринт локально (клиент видит что не бежит, но сервер думает что бежит)
           
            // Если есть цель в радиусе атаки - выключаем спринт только локально
            if (target != null && inRange(target)) {
                // Используем рефлексию для прямого изменения поля без пакета
                try {
                    var field = net.minecraft.entity.Entity.class.getDeclaredField("field_5960"); // sprinting field
                    field.setAccessible(true);
                    field.setBoolean(mc.player, false);
                    legitV2SprintDisabled = true;
                } catch (Exception e) {
                    // Fallback на обычный setSprinting если рефлексия не работает
                    mc.player.setSprinting(false);
                    legitV2SprintDisabled = true;
                }
            } else {
                // Цель вне дистанции или нет цели - включаем спринт обратно
                if (legitV2SprintDisabled) {
                    if (mc.player.input != null
                        && mc.player.input.hasForwardMovement()
                        && !mc.player.horizontalCollision
                        && !mc.player.isTouchingWater()) {
                        mc.player.setSprinting(true);
                    }
                    legitV2SprintDisabled = false;
                }
            }
            return;
        }

        if (sprintResetMode.is(noneSprintReset)) {
            legitV2SprintDisabled = false;
            return;
        }
    }

    private MoveCorrection getMoveCorrection() {
        if (this.moveCorrectionMode.is(this.silentMoveCorrection)) {
            return MoveCorrection.SILENT;
        } else if (this.moveCorrectionMode.is(this.directMoveCorrection)) {
            return MoveCorrection.DIRECT;
        }
        return MoveCorrection.NONE;
    }

    private float wrapDegrees(float angle) {
        return MathHelper.wrapDegrees(angle);
    }

    // SpookyV2 — улучшенная версия с предсказанием движения и адаптивной скоростью
    private void handleSpookyV2Rotation(LivingEntity target, MoveCorrection moveCorrection, RotationHandler handler, Rotation currentRot) {
        if (mc.player == null || target == null) return;

        // Рандомизированный сброс noise (350-650 тиков для большей вариативности)
        if (spv2NoiseResetAge == 0) {
            spv2NoiseResetAge = 350 + (int)(Math.random() * 300);
        }
        if (mc.player.age % spv2NoiseResetAge == 0) {
            this.noise = new PerlinNoise();
            this.noiseFactor = 1.0F;
            spv2NoiseResetAge = 350 + (int)(Math.random() * 300);
        }

        // Плавный переход при смене цели с полным сбросом состояния
        if (spv2LastTarget != target) {
            spv2LastTarget = target;
            spv2SmoothInit = false;
            spv2LastTargetPos = target.getPos();
            spv2TargetVelocity = Vec3d.ZERO;
            spv2AdaptiveYawSpeed = 1.0F;
            spv2AdaptivePitchSpeed = 1.0F;
            spv2IdleShiftTimer = 0;
            // Рандомизируем idle смещения при смене цели
            spv2IdleYawShift   = 1.5F + (float)(Math.random() * 5.0F);   // 1.5..6.5
            spv2IdlePitchShift = -(4.0F + (float)(Math.random() * 6.0F)); // -4..-10
        }

        // Вычисление скорости цели для предсказания
        Vec3d currentTargetPos = target.getPos();
        if (spv2LastTargetPos != null) {
            Vec3d rawVelocity = currentTargetPos.subtract(spv2LastTargetPos);
            // Плавное сглаживание скорости (0.3 = 30% новое значение, 70% старое)
            spv2TargetVelocity = spv2TargetVelocity.multiply(0.7).add(rawVelocity.multiply(0.3));
        }
        spv2LastTargetPos = currentTargetPos;

        // Предсказание позиции цели на 3-5 тиков вперед
        int predictionTicks = 3 + (int)(Math.random() * 3); // 3-5 тиков
        Vec3d predictedPos = currentTargetPos.add(spv2TargetVelocity.multiply(predictionTicks));

        boolean collide = EntityUtility.collideWith(target, 1.0F);
        Vec3d nearY = RotationMath.getNearestPoint(target);
       
        // Используем предсказанную позицию для быстро движущихся целей
        double targetSpeed = spv2TargetVelocity.length();
        Vec3d aimPoint = targetSpeed > 0.1 ? predictedPos : nearY;
       
        Rotation targetRot = RotationMath.getRotationTo(
                new Vec3d(
                        aimPoint.x,
                        MathHelper.clamp(
                                MathUtility.interpolate(mc.player.getY(), target.getEyeY(), 0.5),
                                target.getBoundingBox().minY,
                                target.getBoundingBox().maxY
                        ),
                        aimPoint.z
                )
        );
       
        Rotation multipoint = RotationMath.getRotationTo(RotationMath.getNearestPoint(target));
        if (collide) {
            targetRot = RotationMath.getRotationTo(target.getPos().add(0.0, 0.5, 0.0));
        }

        // Оптимизация: проверяем canTraceWithBlock только каждые 4 тика
        if (tickCounter % 4 == 0 && !MathUtility.canTraceWithBlock(
                this.attackDistance.getCurrentValue(), targetRot.getYaw(), targetRot.getPitch(), mc.player, target, !this.walls.isEnabled()
        ) && mc.player.getEyePos().distanceTo(target.getEyePos()) > 3.0) {
            targetRot.setPitch(multipoint.getPitch() + 10.0F);
        }

        boolean idle = this.attackTimer.finished(collide ? 500L : 200L);
        if (this.additional == null) {
            this.additional = new Rotation(0.0F, 0.0F);
        }

        float targetYaw   = targetRot.getYaw();
        float targetPitch = targetRot.getPitch();
        float yawDiff   = RotationMath.getAngleDifference(currentRot.getYaw(),   targetYaw);
        float pitchDiff = RotationMath.getAngleDifference(currentRot.getPitch(), targetPitch);

        // Динамическое изменение idle смещений каждые 60-120 тиков
        spv2IdleShiftTimer++;
        if (spv2IdleShiftTimer > 60 + (int)(Math.random() * 60)) {
            spv2IdleShiftTimer = 0;
            spv2IdleYawShift   = 1.5F + (float)(Math.random() * 5.0F);
            spv2IdlePitchShift = -(4.0F + (float)(Math.random() * 6.0F));
        }

        // Рандомизированное idle смещение
        if (!this.shouldPreventSprinting() && idle && EntityUtility.getBlock(0.0, 2.0, 0.0) == Blocks.AIR) {
            targetYaw   += spv2IdleYawShift;
            targetPitch += spv2IdlePitchShift;
        }

        // Адаптивная скорость: учитываем скорость цели и расстояние
        boolean needCrit = this.shouldPreventSprinting();
        float distanceFactor = (float)Math.min(mc.player.distanceTo(target) / 4.0, 1.5);
        float speedFactor = (float)Math.min(targetSpeed * 10.0, 1.5); // Быстрее для быстрых целей
       
        float baseYawDivisor   = needCrit ? 4.0F  : (!this.shouldPreventSprinting() && idle ? 3.0F  : (idle ? (mc.player.fallDistance > 0.0F ? 15.0F : 6.0F) : 40.0F));
        float basePitchDivisor = needCrit ? 8.0F  : (!this.shouldPreventSprinting() && idle ? 3.0F  : (idle ? (mc.player.fallDistance > 0.0F ? 15.0F : 6.0F) : 30.0F));

        // Применяем адаптивные множители
        baseYawDivisor   /= (distanceFactor * spv2AdaptiveYawSpeed);
        basePitchDivisor /= (distanceFactor * spv2AdaptivePitchSpeed);

        float yawSpeed   = Math.max((90.0F - Math.abs(yawDiff))   / baseYawDivisor,   MathUtility.random(2.0, 7.0)) * MathUtility.random(0.85, 1.15);
        float pitchSpeed = Math.abs(pitchDiff) / basePitchDivisor * MathUtility.random(0.85, 1.15);

        // Адаптация скорости: если долго не попадаем - ускоряемся
        if (Math.abs(yawDiff) > 15.0F || Math.abs(pitchDiff) > 15.0F) {
            spv2AdaptiveYawSpeed = Math.min(spv2AdaptiveYawSpeed + 0.03F, 2.0F);
            spv2AdaptivePitchSpeed = Math.min(spv2AdaptivePitchSpeed + 0.03F, 2.0F);
        } else {
            spv2AdaptiveYawSpeed = Math.max(spv2AdaptiveYawSpeed - 0.02F, 0.8F);
            spv2AdaptivePitchSpeed = Math.max(spv2AdaptivePitchSpeed - 0.02F, 0.8F);
        }

        if (!EntityUtility.collideWith(target)) {
            this.collideTimer.reset();
        }

        if (this.collideTimer.finished(500L) && CombatUtility.stalin(target)) {
            targetPitch = (float)(
                    64.0 + (mc.player.getY() - target.getY() + 1.0) * (5.0 + Math.sin(mc.player.age % 100 / 5 * 1924.12F) * 35.0) - 5.0 + 10.0
            );
            yawSpeed /= MathUtility.random(30.0, 50.0);
        }

        if (!idle && EntityUtility.getBlock(0.0, 2.0, 0.0) == Blocks.AIR && !collide) {
            targetYaw   += this.additional.getYaw();
            targetPitch += this.additional.getPitch();
        }

        if (this.walls.isEnabled() && !MathUtility.canSeen(nearY) && mc.player.fallDistance <= CombatUtility.getFallDistance(target)) {
            targetPitch = -90.0F;
        }

        // Улучшенная логика noise factor с более быстрой адаптацией
        float totalDiff = Math.abs(yawDiff) + Math.abs(pitchDiff);
        if (totalDiff < 8.0F) {
            this.noiseFactor = Math.max(0.0F, this.noiseFactor - 0.06F); // Быстрее убираем noise
        } else if (totalDiff > 20.0F) {
            this.noiseFactor = Math.min(1.0F, this.noiseFactor + 0.04F); // Быстрее добавляем noise
        }

        // Плавная интерполяция для более естественного движения
        if (!spv2SmoothInit) {
            spv2SmoothYaw = currentRot.getYaw();
            spv2SmoothPitch = currentRot.getPitch();
            spv2SmoothInit = true;
        }

        // Интерполяция с учетом скорости (чем ближе к цели, тем плавнее)
        float smoothFactor = MathHelper.clamp(totalDiff / 50.0F, 0.3F, 0.8F);
        spv2SmoothYaw = MathUtility.interpolate(spv2SmoothYaw, targetYaw, smoothFactor);
        spv2SmoothPitch = MathUtility.interpolate(spv2SmoothPitch, targetPitch, smoothFactor);

        long timeElapsed = System.currentTimeMillis() - this.rotationStartTime;
        float yawNoise   = (float) this.noise.noise(timeElapsed * 4.5E-4); // Немного быстрее
        float pitchNoise = (float) this.noise.noise(timeElapsed * 4.5E-4, 10.0);
       
        // Адаптивный noise: меньше для близких целей, больше для дальних
        float noiseScale = MathHelper.clamp((float)mc.player.distanceTo(target) / 5.0F, 0.5F, 1.5F);
        float yawOffset   = yawNoise   * 7.0F * this.noiseFactor * noiseScale;
        float pitchOffset = pitchNoise * 5.0F * this.noiseFactor * noiseScale;

        float finalYaw   = spv2SmoothYaw   + yawOffset;
        float finalPitch = spv2SmoothPitch + pitchOffset;

        handler.rotate(
                new Rotation(finalYaw, MathHelper.clamp(finalPitch, -90.0F, 90.0F)),
                moveCorrection,
                yawSpeed * 25.0F,
                pitchSpeed * 25.0F,
                MathUtility.random(30.0, 70.0),
                RotationPriority.TO_TARGET
        );
    }

    private void rotateHead(LivingEntity targetedEntity) {
        if (!this.onlyWeapon.isEnabled() || EntityUtility.isHoldingWeapon()) {
            MoveCorrection moveCorrection = getMoveCorrection();
            RotationHandler handler = Holly.getInstance().getRotationHandler();
            Rotation currentRot = handler.getCurrentRotation();

            handleSpookyV2Rotation(targetedEntity, moveCorrection, handler, currentRot);
        }
    }

    private boolean isPlayerEating() {
        if (mc.player == null) return false;

        boolean isEating = mc.player.isUsingItem() &&
                mc.player.getActiveItem().getItem().getUseAction(mc.player.getActiveItem()) == UseAction.EAT;

        if (isEating) {
            eatTimer.reset();
            return true;
        }

        return !eatTimer.finished(500);
    }

    private boolean shouldAttackEntity(LivingEntity targetedEntity) {
        if (noAttackWhileEating.isEnabled() && isPlayerEating()) {
            return false;
        }

        if (!this.isCooledDown()) {
            return false;
        } else if (this.onlyWeapon.isEnabled() && !EntityUtility.isHoldingWeapon()) {
            return false;
        } else if (mc.player.isUsingItem() && mc.player.getActiveHand() == Hand.MAIN_HAND) {
            return false;
        } else if (this.inRange(targetedEntity)) {
            return false;
        } else if (this.walls.isEnabled() && tickCounter % 3 == 0) { // Проверяем raycast только каждые 3 тика
            Type rayType = mc.world
                .raycast(
                        new RaycastContext(
                                mc.player.getEyePos(),
                                mc.player
                                        .getEyePos()
                                        .add(
                                                mc.player
                                                        .getRotationVector(-90.0F, Holly.getInstance().getRotationHandler().getCurrentRotation().getYaw())
                                                        .multiply(this.attackDistance.getCurrentValue())
                                        ),
                                ShapeType.COLLIDER,
                                FluidHandling.NONE,
                                mc.player
                        )
                )
                .getType();
            if (rayType == Type.BLOCK) {
                return false;
            }
        }
       
        // Кешируем результат canTraceWithBlock
        if (this.rayTrace.isEnabled() && tickCounter % 2 == 0) {
            return MathUtility.canTraceWithBlock(
                    this.attackDistance.getCurrentValue(),
                    Holly.getInstance().getRotationHandler().getCurrentRotation().getYaw(),
                    Holly.getInstance().getRotationHandler().getCurrentRotation().getPitch(),
                    mc.player,
                    targetedEntity,
                    !this.walls.isEnabled()
            ) && (!this.onlyCriticals.isEnabled() || !this.isCriticalRequired(targetedEntity) || CombatUtility.canPerformCriticalHit(targetedEntity, true));
        }
       
        return !this.onlyCriticals.isEnabled() || !this.isCriticalRequired(targetedEntity) || CombatUtility.canPerformCriticalHit(targetedEntity, true);
    }

    private boolean isCriticalRequired(LivingEntity targetedEntity) {
        float damage = this.calculateDamage(targetedEntity);
        return damage <= targetedEntity.getHealth();
    }

    public boolean isCooledDown() {
        if (mc.player == null) {
            return false;
        } else {
            return CombatUtility.getMace() != null
                    ? this.attackTimer.finished(500L)
                    : mc.player.getAttackCooldownProgress(1.5F) > 0.93F && this.attackTimer.finished(500L)
                    || this.fastPvp.isSelected() && this.attackTimer.finished(50L);
        }
    }

    public float calculateDamage(LivingEntity targetedEntity) {
        return 0.0F;
    }

    private void attack(LivingEntity targetedEntity) {
        if (mc.interactionManager != null && mc.player != null) {

            this.shield = mc.player.isUsingItem() && mc.player.getActiveItem().getItem().getUseAction(mc.player.getActiveItem()) == UseAction.BLOCK;
            if (this.shield) {
                mc.player.networkHandler.sendPacket(new PlayerActionC2SPacket(Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, Direction.DOWN));
            }

            if (this.breakShield.isEnabled() && CombatUtility.shouldBreakShield(targetedEntity) && CombatUtility.canBreakShield(targetedEntity)) {
                CombatUtility.tryBreakShield(targetedEntity);
            }

            if (this.shieldBreaker.isEnabled()) {
                if (targetedEntity.isBlocking()) {

                }
            }

            HotbarSlot slot = CombatUtility.getMace();
            if (slot != null) {
                mc.player.networkHandler.sendPacket(new UpdateSelectedSlotC2SPacket(slot.getSlotId()));
                if (this.breakShield.isEnabled()) {
                    CombatUtility.tryBreakShield(targetedEntity);
                }
            }

            mc.interactionManager.attackEntity(mc.player, targetedEntity);
            mc.player.swingHand(Hand.MAIN_HAND);

            if (slot != null) {
                mc.player.networkHandler.sendPacket(new UpdateSelectedSlotC2SPacket(mc.player.getInventory().selectedSlot));
            }

            if (this.shield) {
                mc.interactionManager
                        .sendSequencedPacket(
                                mc.world,
                                sequence -> new PlayerInteractItemC2SPacket(
                                        mc.player.getActiveHand(),
                                        sequence,
                                        Holly.getInstance().getRotationHandler().getCurrentRotation().getYaw(),
                                        Holly.getInstance().getRotationHandler().getCurrentRotation().getPitch()
                                )
                        );
            }

            this.additional = new Rotation(MathUtility.random(5.0, 20.0), MathUtility.random(5.0, 10.0));
            this.attackTimer.reset();
            this.attacks++;
        }
    }

    public float getGCDValue() {
        double sensitivity = (Double)mc.options.getMouseSensitivity().getValue();
        double value = sensitivity * 0.6 + 0.2;
        double result = Math.pow(value, 3.0) * 0.8;
        return (float)result * 0.15F;
    }

    public float getSensitivity(float rot) {
        return this.getDeltaMouse(rot) * this.getGCDValue();
    }

    public float getDeltaMouse(float delta) {
        return Math.round(delta / this.getGCDValue());
    }

    public boolean shouldPreventSprinting() {
        LivingEntity target = Holly.getInstance().getTargetManager().getCurrentTarget() instanceof LivingEntity living ? living : null;
        if (target == null || mc.player == null) {
            return false;
        }
       
        // LegitV2 режим: блокируем AutoSprint когда цель в радиусе
        if (this.sprintResetMode.is(this.legitV2SprintReset) && target != null && inRange(target)) {
            return true;
        }
       
        if (this.styleAttack.is(this.fastPvp)) {
            return false;
        } else {
            Criticals criticals = Holly.getInstance().getModuleManager().getModule(Criticals.class);
            boolean predict = criticals.isEnabled() && (criticals.canCritical() || mc.player.isOnGround())
                    || !mc.player.isOnGround() && FallingPlayer.fromPlayer(mc.player).findFall(CombatUtility.getFallDistance(target));
            return this.onlyCriticals.isEnabled()
                    && this.isCriticalRequired(target)
                    && (
                    predict
                            || CombatUtility.canPerformCriticalHit(target, true)
                            || !this.attackTimer.finished(!ServerUtility.isHW() && !ServerUtility.isST() ? 50L : (long)MathUtility.random(50.0, 150.0))
            );
        }
    }

    private boolean inRange(LivingEntity target) {
        return MathHelper.sqrt((float)mc.player.squaredDistanceTo(RotationMath.getNearestPoint(target))) > this.attackDistance.getCurrentValue();
    }

    @Override
    public void onEnable() {
        this.rotationStartTime = System.currentTimeMillis();
        this.noise = new PerlinNoise();
        this.noiseFactor = 1.0F;

        wasSprinting = false;
        sprintResetTicks = 0;

        if (mc.player != null) {
            this.rotateVector = new Vector2f(mc.player.getYaw(), mc.player.getPitch());
        }

        super.onEnable();
    }

    @Override
    public void onDisable() {
        Holly.getInstance().getTargetManager().reset();

        if (wasSprinting && mc.player != null) {
            mc.player.setSprinting(true);
        }
       
        // Восстанавливаем спринт при выключении ауры для LegitV2
        if (legitV2SprintDisabled && mc.player != null) {
            if (mc.player.input != null
                && mc.player.input.hasForwardMovement()
                && !mc.player.horizontalCollision
                && !mc.player.isTouchingWater()) {
                mc.player.setSprinting(true);
            }
            legitV2SprintDisabled = false;
        }

        super.onDisable();
    }

    @Generated
    public ModeSetting.Value getFastPvp() {
        return this.fastPvp;
    }

    @Generated
    public ModeSetting.Value getSlowPvp() {
        return this.slowPvp;
    }

    @Generated
    public Timer getAttackTimer() {
        return this.attackTimer;
    }

    @Generated
    public int getAttacks() {
        return this.attacks;
    }

}
как это без сс принимают боже
 
какие же ты промпты ей пишешь, что она РОТАЦИЮ на 800 строк кода пишет...
тут край 450 строк кода ротации
где сс ? дуэли бупасит?
Дуэли обходит но бывает перестает регать, у меня со всеми почему то так, хз как фиксить, анку без проблем обход
 
впринцепи неплохо, но я чутка скорости поменял и у кого база рич и лень переносить держите
Код:
Expand Collapse Copy
package rich.modules.impl.combat.aura.rotations;

import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import rich.Initialization;
import rich.modules.impl.combat.Aura;
import rich.modules.impl.combat.aura.Angle;
import rich.modules.impl.combat.aura.MathAngle;
import rich.modules.impl.combat.aura.attack.StrikeManager;
import rich.modules.impl.combat.aura.impl.RotateConstructor;

public class SPAngle extends RotateConstructor {
    private static int lastTargetId = Integer.MIN_VALUE;
    private static Vec3d lastTargetPos = null;
    private static Vec3d smoothedTargetVelocity = Vec3d.ZERO;
    private static float smoothYaw = 0.0F;
    private static float smoothPitch = 0.0F;
    private static boolean smoothInitialized = false;

    public SPAngle() {
        super("SpookyTime");
    }

    @Override
    public Angle limitAngleChange(Angle currentAngle, Angle targetAngle, Vec3d vec3d, Entity entity) {
        StrikeManager attackHandler = Initialization.getInstance().getManager().getAttackPerpetrator().getAttackHandler();
        Aura aura = Aura.getInstance();
        boolean canAttack = entity != null && attackHandler.canAttack(aura.getConfig(), 0);
        long now = System.currentTimeMillis();

        if (entity != null && mc.player != null) {
            if (lastTargetId != entity.getId()) {
                lastTargetId = entity.getId();
                lastTargetPos = entity.getEntityPos();
                smoothedTargetVelocity = Vec3d.ZERO;
                smoothInitialized = false;
            }

            Vec3d currentTargetPos = entity.getEntityPos();
            if (lastTargetPos != null) {
                Vec3d rawVelocity = currentTargetPos.subtract(lastTargetPos);
                smoothedTargetVelocity = smoothedTargetVelocity.multiply(0.72).add(rawVelocity.multiply(0.28));
            }
            lastTargetPos = currentTargetPos;

            double distance = mc.player.getEyePos().distanceTo(currentTargetPos);
            double leadTicks = MathHelper.clamp(distance * 0.65, 1.5, 4.2);
            if (canAttack) {
                leadTicks *= 0.85;
            }
            Vec3d predicted = currentTargetPos.add(smoothedTargetVelocity.multiply(leadTicks));

            double yMin = entity.getY() + entity.getHeight() * 0.42;
            double yMax = entity.getY() + entity.getHeight() * 0.94;
            double yTarget = MathHelper.clamp(
                    MathHelper.lerp(0.78, entity.getY() + entity.getHeight() * 0.72, entity.getEyeY()),
                    yMin,
                    yMax
            );
            Vec3d aimPoint = new Vec3d(predicted.x, yTarget, predicted.z);
            targetAngle = MathAngle.calculateAngle(aimPoint);
        } else {
            lastTargetId = Integer.MIN_VALUE;
            lastTargetPos = null;
            smoothedTargetVelocity = Vec3d.ZERO;
            smoothInitialized = false;
        }

        float yawDelta = MathHelper.wrapDegrees(targetAngle.getYaw() - currentAngle.getYaw());
        float pitchDelta = MathHelper.wrapDegrees(targetAngle.getPitch() - currentAngle.getPitch());

        float rotationDiff = (float) Math.hypot(Math.abs(yawDelta), Math.abs(pitchDelta));
        if (rotationDiff < 1.0E-3F) {
            return currentAngle;
        }

        float distanceFactor = 1.0F;
        if (entity != null && mc.player != null) {
            distanceFactor = MathHelper.clamp((float) (mc.player.distanceTo(entity) / 4.0F), 0.75F, 1.45F);
        }

        float speed = canAttack ? 0.90F : 0.78F;
        if (!aura.isState() || entity == null) {
            speed = 0.71F;
        }
        speed = MathHelper.clamp(speed * (1.0F / (distanceFactor * 0.90F)), 0.63F, 0.92F);

        float maxYawStep = MathHelper.clamp(Math.abs(yawDelta) * 0.71F + 2.25F, 2.25F, 30.6F);
        float maxPitchStep = MathHelper.clamp(Math.abs(pitchDelta) * 0.60F + 1.33F, 1.33F, 18.3F);
        float stepYaw = MathHelper.clamp(yawDelta, -maxYawStep, maxYawStep);
        float stepPitch = MathHelper.clamp(pitchDelta, -maxPitchStep, maxPitchStep);

        float rawYaw = MathHelper.lerp(speed, currentAngle.getYaw(), currentAngle.getYaw() + stepYaw);
        float rawPitch = MathHelper.lerp(speed * 0.84F, currentAngle.getPitch(), currentAngle.getPitch() + stepPitch);

        if (!smoothInitialized) {
            smoothYaw = currentAngle.getYaw();
            smoothPitch = currentAngle.getPitch();
            smoothInitialized = true;
        }

        float smoothFactor = MathHelper.clamp(rotationDiff / 38.0F, 0.28F, 0.72F);
        smoothYaw = MathHelper.lerp(smoothFactor, smoothYaw, rawYaw);
        smoothPitch = MathHelper.lerp(smoothFactor, smoothPitch, rawPitch);

        float noiseYaw = (float) (Math.sin(now / 165.0D) * 0.055D + Math.cos(now / 240.0D) * 0.022D);
        float noisePitch = (float) (Math.cos(now / 205.0D) * 0.034D);

        float microYaw = 0.0F;
        float microPitch = 0.0F;
        if (aura.isState() && entity != null) {
            microYaw = (float) (Math.sin(now / 52.0D) * 0.024D + Math.cos(now / 88.0D) * 0.014D);
            microPitch = (float) (Math.cos(now / 61.0D) * 0.014D + Math.sin(now / 96.0D) * 0.010D);
        }

        float finalYaw = smoothYaw + noiseYaw + microYaw;
        float finalPitch = MathHelper.clamp(smoothPitch + noisePitch + microPitch, -90.0F, 90.0F);
        return new Angle(finalYaw, finalPitch).adjustSensitivity();
    }

    @Override
    public Vec3d randomValue() {
        return Vec3d.ZERO;
    }
}
 
Назад
Сверху Снизу