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

Вопрос Вопрос АУРа

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
25 Апр 2026
Сообщения
34
Реакции
0
пацаны хочу спросить нори ли ротации база зенита если что то не так т очто?



КодРотаций:
Expand Collapse Copy
package zenith.zov.utility.game.player;

import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import zenith.zov.utility.interfaces.IMinecraft;

import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

public class Rotate implements IMinecraft {

    public static float snapYaw, snapPitch;
    public static boolean snapActive;
    public static float snapsYaw, snapsPitch;
    public static boolean snapsActive;
    public static float legitSnapYaw, legitSnapPitch;
    public static boolean legitSnapActive;
    public static float smoothYaw, smoothPitch;
    public static float funYaw, funPitch;
    public static float spookyYaw, spookyPitch;
    public static float reallyWorldYaw, reallyWorldPitch;
    public static float holyWorldYaw, holyWorldPitch;
    public static float aiYaw, aiPitch;
    public static boolean reallyWorldActive;
    public static boolean holyWorldActive;
    public static boolean aiActive;

    private static int legitSnapTicks;
    private static boolean funInit;
    private static long funReturnMs = -1L;
    private static boolean spookyInit;
    private static boolean reallyWorldInit;
    private static boolean holyWorldInit;
    private static boolean aiInit;
    private static final Random rand = new Random();

    // SpookyTime мультипоинты
    private static float spookyTick = 0f;
    private static int spookyHitCount = 0;
    private static boolean spookyLastAttack = false;
    private static float spookySpinProgress = 0f;
    private static int spookyMultipointIndex = 0;
    private static long spookyLastMultipointSwitch = 0;

    private static final Vec3d[] SPOOKY_MULTIPOINTS = {
        new Vec3d(0, 1.0, 0),    // Голова
        new Vec3d(0, 0.85, 0),   // Шея
        new Vec3d(0, 0.7, 0),    // Ниже шеи
        new Vec3d(-0.3, 0.8, 0), // Левое плечо
        new Vec3d(0.3, 0.8, 0),  // Правое плечо
    };

    private static float[] getRotations(LivingEntity target) {
        Vec3d diff = target.getEyePos().subtract(mc.player.getEyePos());
        double hDist = Math.sqrt(diff.x * diff.x + diff.z * diff.z);
        float yaw = (float) Math.toDegrees(Math.atan2(-diff.x, diff.z));
        float pitch = MathHelper.clamp((float) -Math.toDegrees(Math.atan2(diff.y, hDist)), -90, 90);
        return new float[]{yaw, pitch};
    }

    public static boolean isWithinFov(LivingEntity target, double maxFov) {
        if (mc.player == null) return false;
        Vec3d eyePos = mc.player.getEyePos();
        Vec3d targetVec = new Vec3d(target.getX(), target.getY(), target.getZ())
                .add(0, target.getEyeHeight(target.getPose()), 0).subtract(eyePos);
        double yawToTarget = Math.toDegrees(Math.atan2(targetVec.z, targetVec.x)) - 90;
        double pitchToTarget = -Math.toDegrees(Math.atan2(targetVec.y, Math.hypot(targetVec.x, targetVec.z)));
        float yawDelta = MathHelper.wrapDegrees((float) yawToTarget - mc.player.getYaw());
        float pitchDelta = MathHelper.wrapDegrees((float) pitchToTarget - mc.player.getPitch());
        return Math.sqrt(yawDelta * yawDelta + pitchDelta * pitchDelta) <= maxFov;
    }

    private static float randomFloat(float min, float max) {
        return min + rand.nextFloat() * (max - min);
    }

    private static float randomBetween(float min, float max) {
        if (min == max) return min;
        if (min > max) { float tmp = min; min = max; max = tmp; }
        return (float) ThreadLocalRandom.current().nextDouble(min, max);
    }

    private static long randomBetween(long min, long max) {
        return min + ThreadLocalRandom.current().nextLong(max - min);
    }

    // ==================== SNAP ====================
    public static void onSnapRotation(LivingEntity target, boolean attack, String type) {
        if (attack && target != null) {
            float[] rots = getRotations(target);
            snapYaw = rots[0];
            snapPitch = rots[1];
            snapActive = true;
        } else {
            snapActive = false;
        }
    }

    // ==================== SNAPS ====================
    public static void onSnapsRotation(LivingEntity target, boolean attack, float attackRange) {
        if (target == null) { snapsActive = false; return; }
        Vec3d vec = new Vec3d(target.getX(), target.getY(), target.getZ())
                .add(0, MathHelper.clamp(mc.player.getEyePos().y - target.getY(), 0,
                    target.getHeight() * (mc.player.distanceTo(target) / Math.max(3, attackRange))), 0)
                .subtract(mc.player.getEyePos()).normalize();
        float rawYaw = (float) Math.toDegrees(Math.atan2(-vec.x, vec.z));
        float rawPitch = (float) MathHelper.clamp(Math.toDegrees(Math.asin(-vec.y)), -89, 89);
        snapsYaw = mc.player.getYaw() + MathHelper.clamp(MathHelper.wrapDegrees(rawYaw - mc.player.getYaw()), -125, 125);
        snapsPitch = mc.player.getPitch() + MathHelper.clamp(rawPitch - mc.player.getPitch(), -50, 50);
        snapsActive = true;
    }

    // ==================== LEGIT SNAP ====================
    public static void onLegitSnapRotation(LivingEntity target, boolean attack, float fov) {
        if (target == null || !isWithinFov(target, fov)) { legitSnapActive = false; legitSnapTicks = 0; return; }
        float[] rots = getRotations(target);
        legitSnapYaw = rots[0];
        legitSnapPitch = rots[1];
        if (attack) { legitSnapActive = true; legitSnapTicks = 2; }
        else if (legitSnapTicks > 0) legitSnapTicks--;
        else legitSnapActive = false;
    }

    // ==================== SMOOTH ====================
    public static void onSmoothRotation(LivingEntity target, boolean attack, float speed) {
        if (target == null) return;
        float[] rots = getRotations(target);
        smoothYaw = rots[0];
        smoothPitch = rots[1];
    }

    // ==================== FUNTIME (из Rich) ====================
    public static void onFunTimeRotation(LivingEntity target, boolean attack, float range) {
        if (mc.player == null) return;

        // Атака — плавно доворачиваемся к цели
        if (target != null && attack) {
            funReturnMs = -1L;
            if (!funInit) { funYaw = mc.player.getYaw(); funPitch = mc.player.getPitch(); funInit = true; }

            float[] rots = getRotations(target);
            float yawDelta = MathHelper.wrapDegrees(rots[0] - funYaw);
            float pitchDelta = rots[1] - funPitch;
            float totalDelta = (float) Math.hypot(yawDelta, pitchDelta);

            float yawLimit = Math.abs(yawDelta / totalDelta) * 130.0F;
            float pitchLimit = Math.abs(pitchDelta / totalDelta) * 130.0F;

            funYaw = MathHelper.lerp(0.85F, funYaw, funYaw + MathHelper.clamp(yawDelta, -yawLimit, yawLimit));
            funPitch = MathHelper.lerp(0.85F, funPitch, funPitch + MathHelper.clamp(pitchDelta, -pitchLimit, pitchLimit));
            return;
        }

        // Возврат камеры с тряской
        float retYaw = MathHelper.wrapDegrees(mc.player.getYaw() - funYaw);
        float retPitch = mc.player.getPitch() - funPitch;
        float retTotal = (float) Math.hypot(retYaw, retPitch);

        long now = System.currentTimeMillis();
        float shakeYaw = (float) (randomBetween(18.0F, 28.0F) * Math.sin(now / 60.0));
        float shakePitch = (float) (randomBetween(6.0F, 16.0F) * Math.cos(now / 60.0));

        if (target != null) {
            funReturnMs = -1L;
        } else {
            if (funReturnMs < 0L) funReturnMs = now;
            float fadeRatio = 1.0F - MathHelper.clamp((now - funReturnMs) / 1000.0F, 0.0F, 1.0F);
            shakeYaw *= fadeRatio;
            shakePitch *= fadeRatio;
        }

        float limitMultiplier = attack ? 0.0F : 45.0F;
        float yawLimit = Math.abs(retYaw / retTotal) * limitMultiplier;
        float pitchLimit = Math.abs(retPitch / retTotal) * limitMultiplier;

        funYaw = MathHelper.lerp(0.85F, funYaw, funYaw + MathHelper.clamp(retYaw, -yawLimit, yawLimit) + shakeYaw);
        funPitch = MathHelper.lerp(0.85F, funPitch, funPitch + MathHelper.clamp(retPitch, -pitchLimit, pitchLimit) + shakePitch);

        funYaw = MathHelper.wrapDegrees(funYaw);
        funPitch = MathHelper.clamp(funPitch, -90, 90);
    }

    // ==================== SPOOKYTIME (мультипоинты + спин) ====================
    public static void onSpookyTimeRotation(LivingEntity target, boolean canHit, float range) {
        if (mc.player == null || mc.world == null) return;
        if (target == null) return;

        Vec3d eyePos = mc.player.getEyePos();

        // Мультипоинт — меняем точку прицеливания каждые 200-400мс
        if (System.currentTimeMillis() - spookyLastMultipointSwitch > randomBetween(200, 400)) {
            spookyMultipointIndex = rand.nextInt(SPOOKY_MULTIPOINTS.length);
            spookyLastMultipointSwitch = System.currentTimeMillis();
        }

        Vec3d multipoint = SPOOKY_MULTIPOINTS[spookyMultipointIndex];

        float timeVar = (float) Math.cos((double) System.currentTimeMillis() / randomBetween(700L, 834L));
        float addyVact = 0.16f * timeVar;
        float timeVarZ = (float) Math.cos((double) System.currentTimeMillis() / 1200L);
        float addyVacZ = randomBetween(0.06F, 0.21F) * timeVarZ;
        float timeVarX = (float) Math.cos((double) System.currentTimeMillis() / 750L);
        float addyVacX = randomBetween(0.20f, 0.41f) * timeVarX;

        Vec3d targetPos = target.getPos().add(multipoint);
        Vec3d directionVec = targetPos.add(
                addyVacZ,
                MathHelper.clamp(eyePos.y - target.getY(), 0.0f, 1f + addyVact),
                addyVacX
        ).subtract(eyePos).normalize();

        boolean isAttack = canHit && mc.player.getAttackCooldownProgress(0.5f) >= 1.0f;
        if (isAttack && !spookyLastAttack) {
            spookyHitCount++;
            if (spookyHitCount >= 10) {
                spookySpinProgress = 50f;
                spookyHitCount = 0;
            }
        }
        spookyLastAttack = isAttack;

        if (isAttack) spookyTick = 4f;

        boolean attack = false;
        if (spookyTick > 0f) {
            attack = true;
            spookyTick--;
        }

        float baseYaw = (float) Math.toDegrees(Math.atan2(-directionVec.x, directionVec.z));
        float basePitch = (float) MathHelper.clamp(
                -Math.toDegrees(Math.atan2(directionVec.y, Math.hypot(directionVec.x, directionVec.z))),
                -89f, 90f
        );

        float waveA = (float) Math.cos(System.currentTimeMillis() / 67.0);
        float waveB = (float) Math.sin(System.currentTimeMillis() / 45.0);
        float waveC = (float) Math.cos(System.currentTimeMillis() / 12.0);

        float randomAttackShift = 0f;
        if (attack) {
            randomAttackShift = ThreadLocalRandom.current().nextFloat(-0.8f, 0.8f);
        }

        float yawJitter = (perlinNoise(0.002F) * 0.15f * waveB) + (waveA * 0.13f) + (waveC * 0.08f);
        float pitchJitter = (perlinNoise(0.001F) * 0.08f * waveA) + (waveB * 0.11f) + (waveC * 0.05f);

        float currentSwayAmplitude = attack ? 8f : 20f;
        float sway = (float) Math.sin(System.currentTimeMillis() / 130.0) * currentSwayAmplitude;

        float newYaw = baseYaw + yawJitter + randomAttackShift + sway;
        float newPitch = basePitch + pitchJitter + randomAttackShift;
        newPitch = MathHelper.clamp(newPitch, -90f, 90f);

        if (!spookyInit) { spookyYaw = mc.player.getYaw(); spookyPitch = mc.player.getPitch(); spookyInit = true; }

        if (spookySpinProgress > 0) {
            float step = Math.min(12f, spookySpinProgress);
            spookyYaw += step;
            spookySpinProgress -= step;
        } else {
            spookyYaw = MathHelper.lerpAngleDegrees(0.85f, spookyYaw, newYaw);
            spookyPitch = MathHelper.lerp(0.85f, spookyPitch, newPitch);
        }

        spookyYaw = MathHelper.wrapDegrees(spookyYaw);
        spookyPitch = MathHelper.clamp(spookyPitch, -90f, 90f);
    }

    private static float perlinNoise(float freq) {
        return (float) (Math.sin(System.currentTimeMillis() * freq) * Math.cos(System.currentTimeMillis() * freq * 1.3));
    }

    // ==================== REALLY WORLD ====================
    public static void onReallyWorldRotation(LivingEntity target, boolean attack, float attackRange) {
        if (target == null) { reallyWorldActive = false; reallyWorldInit = false; return; }
        if (!reallyWorldInit) { reallyWorldYaw = mc.player.getYaw(); reallyWorldPitch = mc.player.getPitch(); reallyWorldInit = true; }
        float[] rots = getRotations(target);
        float step = 0.35f;
        reallyWorldYaw += MathHelper.wrapDegrees(rots[0] - reallyWorldYaw) * step;
        reallyWorldPitch += (rots[1] - reallyWorldPitch) * step;
        reallyWorldYaw = MathHelper.wrapDegrees(reallyWorldYaw);
        reallyWorldPitch = MathHelper.clamp(reallyWorldPitch, -89, 89);
        reallyWorldActive = true;
    }

    // ==================== HOLY WORLD ====================
    public static void onHolyWorldRotation(LivingEntity target, boolean attack, float attackRange) {
        if (target == null) { holyWorldActive = false; holyWorldInit = false; return; }
        if (!holyWorldInit) { holyWorldYaw = mc.player.getYaw(); holyWorldPitch = mc.player.getPitch(); holyWorldInit = true; }
        Vec3d targetVec = new Vec3d(target.getX(), target.getY(), target.getZ())
                .add(0, MathHelper.clamp(mc.player.getEyePos().y - target.getY(), 0,
                    target.getHeight() * (mc.player.distanceTo(target) / Math.max(3, attackRange))), 0)
                .subtract(mc.player.getEyePos());
        float yaw = (float) Math.toDegrees(Math.atan2(-targetVec.x, targetVec.z));
        float pitch = MathHelper.clamp((float) -Math.toDegrees(Math.atan2(targetVec.y, Math.hypot(targetVec.x, targetVec.z))), -90, 90);
        float step = 0.5f;
        holyWorldYaw += MathHelper.wrapDegrees(yaw - holyWorldYaw) * step;
        holyWorldPitch += (pitch - holyWorldPitch) * step;
        float gcd = (float)(Math.pow(mc.options.getMouseSensitivity().getValue() * 0.6f + 0.2f, 3.0) * 1.2f);
        holyWorldYaw -= (holyWorldYaw - mc.player.getYaw()) % gcd;
        holyWorldPitch -= (holyWorldPitch - mc.player.getPitch()) % gcd;
        holyWorldYaw = MathHelper.wrapDegrees(holyWorldYaw);
        holyWorldPitch = MathHelper.clamp(holyWorldPitch, -90, 90);
        holyWorldActive = true;
    }

    // ==================== AI ====================
    public static void onAIRotation(LivingEntity target, boolean attack, float attackRange) {
        if (target == null) { aiActive = false; aiInit = false; return; }
        if (!aiInit) { aiYaw = mc.player.getYaw(); aiPitch = mc.player.getPitch(); aiInit = true; }
        double x = target.getX() + (rand.nextDouble() - 0.5) * target.getWidth();
        double y = target.getY() + rand.nextDouble() * target.getHeight();
        double z = target.getZ() + (rand.nextDouble() - 0.5) * target.getWidth();
        Vec3d point = new Vec3d(x, y, z);
        Vec3d diff = point.subtract(mc.player.getEyePos());
        float yaw = (float) Math.toDegrees(Math.atan2(-diff.x, diff.z));
        float pitch = MathHelper.clamp((float) -Math.toDegrees(Math.atan2(diff.y, Math.hypot(diff.x, diff.z))), -90, 90);
        float step = attack ? 0.5f : 0.25f;
        aiYaw += MathHelper.wrapDegrees(yaw - aiYaw) * step;
        aiPitch += (pitch - aiPitch) * step;
        aiYaw = MathHelper.wrapDegrees(aiYaw);
        aiPitch = MathHelper.clamp(aiPitch, -90, 90);
        aiActive = true;
    }

    // ==================== RESET ====================
    public static void reset() {
        funInit = false; funReturnMs = -1L;
        spookyInit = false;
        spookyTick = 0f; spookyHitCount = 0; spookyLastAttack = false;
        spookySpinProgress = 0f; spookyMultipointIndex = 0; spookyLastMultipointSwitch = 0;
        snapActive = false; snapsActive = false; legitSnapActive = false; legitSnapTicks = 0;
        reallyWorldActive = false; reallyWorldInit = false;
        holyWorldActive = false; holyWorldInit = false;
        aiActive = false; aiInit = false;
    }
}
 
Назад
Сверху Снизу