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

Часть функционала Килька 3.1

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
1 Май 2025
Сообщения
12
Реакции
0
Выберите загрузчик игры
  1. Прочие моды
с алгоритма спиздил пока ошибки фиксить это пиздец короче сливаю чтоб вы мозги не ебали
добавлены ротации grim hw rw

Код:
Expand Collapse Copy
import static java.lang.Math.hypot;
import static net.minecraft.util.math.MathHelper.clamp;
import static net.minecraft.util.math.MathHelper.wrapDegrees;

@FunctionRegister(name = "KillAura", type = Category.Combat)
public class KillAura extends Function {
    @Getter
    private final ModeSetting type = new ModeSetting("Тип", "Плавная", "Плавная", "Резкая" ,"HW" , "Grim" ,"ReallyWorld");
    private final SliderSetting attackRange = new SliderSetting("Дистанция аттаки", 3f, 3f, 6f, 0.1f);

    final ModeListSetting targets = new ModeListSetting("Таргеты",
            new BooleanSetting("Игроки", true),
            new BooleanSetting("Голые", true),
            new BooleanSetting("Мобы", false),
            new BooleanSetting("Животные", false),
            new BooleanSetting("Друзья", false),
            new BooleanSetting("Голые невидимки", true),
            new BooleanSetting("Невидимки", true));

    @Getter
    final ModeListSetting options = new ModeListSetting("Опции",
            new BooleanSetting("Только криты", true),
            new BooleanSetting("Ломать щит", true),
            new BooleanSetting("Отжимать щит", true),
            new BooleanSetting("Ускорять ротацию при атаке", false),
            new BooleanSetting("Синхронизировать атаку с ТПС", false),
            new BooleanSetting("Фокусировать одну цель", true),
            new BooleanSetting("Коррекция движения", true));
    final ModeSetting correctionType = new ModeSetting("Тип коррекции", "Незаметный", "Незаметный", "Сфокусированный");

    @Getter
    private final StopWatch stopWatch = new StopWatch();
    private Vector2f rotateVector = new Vector2f(0, 0);
    @Getter
    private LivingEntity target;
    private Entity selected;

    int ticks = 0;
    boolean isRotated;

    final AutoPotion autoPotion;

    public KillAura(AutoPotion autoPotion) {
        this.autoPotion = autoPotion;
        addSettings(type, attackRange, targets, options, correctionType);
    }

    @Subscribe
    public void onInput(EventInput eventInput) {
        if (options.getValueByName("Коррекция движения").get() && correctionType.is("Незаметная") && target != null && mc.player != null) {
            MoveUtils.fixMovement(eventInput, rotateVector.x);
        }
    }

    @Subscribe
    public void onUpdate(EventUpdate e) {
        if (options.getValueByName("Фокусировать одну цель").get() && (target == null || !isValid(target)) || !options.getValueByName("Фокусировать одну цель").get()) {
            updateTarget();
        }


        if (target != null && !(autoPotion.isState() && autoPotion.isActive())) {
            isRotated = false;
            if (shouldPlayerFalling() && (stopWatch.hasTimeElapsed())) {
                updateAttack();
                ticks = 2;
            }
            if (type.is("Резкая")) {
                if (ticks > 0) {
                    updateRotation(true, 180, 90);
                    ticks--;
                } else {
                    reset();
                }
            } else {
                if (!isRotated) {
                    updateRotation(false, 80, 35);
                }
            }

        } else {
            stopWatch.setLastMS(0);
            reset();
        }
    }

    @Subscribe
    private void onWalking(EventMotion e) {
        if (target == null || autoPotion.isState() && autoPotion.isActive()) return;

        float yaw = rotateVector.x;
        float pitch = rotateVector.y;

        e.setYaw(yaw);
        e.setPitch(pitch);
        mc.player.rotationYawHead = yaw;
        mc.player.renderYawOffset = yaw;
        mc.player.rotationPitchHead = pitch;
    }

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

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

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

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

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

        target = targets.get(0);
    }

    float lastYaw, lastPitch;

    private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
        Vector3d vec = target.getPositionVec().add(0, clamp(mc.player.getPosYEye() - target.getPosY(),
                        0, target.getHeight() * (mc.player.getDistanceEyePos(target) / attackRange.get())), 0)
                .subtract(mc.player.getEyePosition(1.0F));

        isRotated = true;

        float yawToTarget = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90);
        float pitchToTarget = (float) (-Math.toDegrees(Math.atan2(vec.y, hypot(vec.x, vec.z))));

        float yawDelta = (wrapDegrees(yawToTarget - rotateVector.x));
        float pitchDelta = (wrapDegrees(pitchToTarget - rotateVector.y));
        int roundedYaw = (int) yawDelta;

        switch (type.get()) {
            case "Плавная" -> {
                float clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 1.0f), rotationYawSpeed);
                float clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 1.0f), rotationPitchSpeed);

                if (attack && selected != target && options.getValueByName("Ускорять ротацию при атаке").get()) {
                    clampedPitch = Math.max(Math.abs(pitchDelta), 1.0f);
                } else {
                    clampedPitch /= 3f;
                }


                if (Math.abs(clampedYaw - this.lastYaw) <= 3.0f) {
                    clampedYaw = this.lastYaw + 3.1f;
                }

                float yaw = rotateVector.x + (yawDelta > 0 ? clampedYaw : -clampedYaw);
                float pitch = clamp(rotateVector.y + (pitchDelta > 0 ? clampedPitch : -clampedPitch), -89.0F, 89.0F);


                float gcd = SensUtils.getGCDValue();
                yaw -= (yaw - rotateVector.x) % gcd;
                pitch -= (pitch - rotateVector.y) % gcd;


                rotateVector = new Vector2f(yaw, pitch);
                lastYaw = clampedYaw;
                lastPitch = clampedPitch;
                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = yaw;
                }
            }
            case "Резкая" -> {
                float yaw = rotateVector.x + roundedYaw;
                float pitch = clamp(rotateVector.y + pitchDelta, -90, 90);

                float gcd = SensUtils.getGCDValue();
                yaw -= (yaw - rotateVector.x) % gcd;
                pitch -= (pitch - rotateVector.y) % gcd;

                rotateVector = new Vector2f(yaw, pitch);

                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = yaw;
                }
            }
            case "HW" -> {
                float yaw;
                float pitch;
                if (attack && selected != target && options.getValueByName("Ускорять ротацию при атаке").get()) {
                    yaw = rotateVector.x + yawDelta;
                    pitch = clamp(rotateVector.y + pitchDelta, -89.0F, 89.0F);
                } else {
                    float yawSpeed = Math.min(Math.max(Math.abs(yawDelta), 1.0f), rotationYawSpeed * 2.0f);
                    float pitchSpeed = Math.min(Math.max(Math.abs(pitchDelta), 1.0f), rotationPitchSpeed * 2.0f);
                    yaw = rotateVector.x + (yawDelta > 0 ? yawSpeed : -yawSpeed);
                    pitch = clamp(rotateVector.y + (pitchDelta > 0 ? pitchSpeed : -pitchSpeed), -89.0F, 89.0F);
                }
                float twitchIntensity = 0.15f;
                float twitchFrequency = 0.03f;
                if (mc.player.ticksExisted % Math.max(1, (int) (twitchFrequency * 15)) == 0) {
                    yaw += (float) (Math.random() - 0.5) * twitchIntensity;
                    pitch += (float) (Math.random() - 0.5) * twitchIntensity;
                }
                yaw += (float) (Math.random() - 0.5) * 0.03f;
                pitch += (float) (Math.random() - 0.5) * 0.03f;
                float gcd = SensUtils.getGCDValue();
                float gcdRandomizer = (float) (Math.random() * 0.008f + 0.996f);
                yaw -= (yaw - rotateVector.x) % (gcd * gcdRandomizer);
                pitch -= (pitch - rotateVector.y) % (gcd * gcdRandomizer);
                float maxYawChange = 40.0f;
                float maxPitchChange = 35.0f;
                yaw = rotateVector.x + clamp(yaw - rotateVector.x, -maxYawChange, maxYawChange);
                pitch = clamp(rotateVector.y + clamp(pitch - rotateVector.y, -maxPitchChange, maxPitchChange), -89.0F, 89.0F);
                rotateVector = new Vector2f(yaw, pitch);
                lastYaw = yaw;
                lastPitch = pitch;
                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = yaw;
                }
            }
            case "Grim" -> {
                float yaw;
                float pitch;
                if (attack && selected != target && options.getValueByName("Ускорять ротацию при атаке").get()) {
                    yaw = rotateVector.x + yawDelta;
                    pitch = clamp(rotateVector.y + pitchDelta, -89.0F, 89.0F);
                } else {
                    float yawSpeed = Math.min(Math.max(Math.abs(yawDelta), 1.0f), rotationYawSpeed * 2.5f);
                    float pitchSpeed = Math.min(Math.max(Math.abs(pitchDelta), 1.0f), rotationPitchSpeed * 2.5f);
                    yaw = rotateVector.x + (yawDelta > 0 ? yawSpeed : -yawSpeed);
                    pitch = clamp(rotateVector.y + (pitchDelta > 0 ? pitchSpeed : -pitchSpeed), -89.0F, 89.0F);
                }
                float shakeIntensity = 0.08f;
                float shakeFrequency = 0.05f;
                if (mc.player.ticksExisted % Math.max(1, (int) (shakeFrequency * 20)) == 0) {
                    yaw += (float) (Math.random() - 0.5) * shakeIntensity;
                    pitch += (float) (Math.random() - 0.5) * shakeIntensity;
                }
                float circleAmplitude = 4.2f;
                float circleSpeed = 0.6f;
                float time = mc.player.ticksExisted * circleSpeed;
                yaw += (float) Math.sin(time) * circleAmplitude;
                pitch += (float) Math.cos(time) * circleAmplitude;
                yaw += (float) (Math.random() - 0.5) * 0.02f;
                pitch += (float) (Math.random() - 0.5) * 0.02f;
                float gcd = SensUtils.getGCDValue();
                float gcdRandomizer = (float) (Math.random() * 0.005f + 0.9975f);
                yaw -= (yaw - rotateVector.x) % (gcd * gcdRandomizer);
                pitch -= (pitch - rotateVector.y) % (gcd * gcdRandomizer);
                float maxYawChange = 35.0f;
                float maxPitchChange = 30.0f;
                yaw = rotateVector.x + clamp(yaw - rotateVector.x, -maxYawChange, maxYawChange);
                pitch = clamp(rotateVector.y + clamp(pitch - rotateVector.y, -maxPitchChange, maxPitchChange), -89.0F, 89.0F);
                rotateVector = new Vector2f(yaw, pitch);
                lastYaw = yaw;
                lastPitch = pitch;
                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = yaw;
                }
            }
            case "ReallyWorld" -> {
                float currentYaw = mc.player.rotationYaw;
                float currentPitch = mc.player.rotationPitch;
                float targetYaw = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90);
                float targetPitch = (float) (-Math.toDegrees(Math.atan2(vec.y, hypot(vec.x, vec.z))));
                targetPitch = clamp(targetPitch, -89.0F, 89.0F);
                if (attack) {
                    float yawDelta1 = wrapDegrees(targetYaw - rotateVector.x);
                    float pitchDelta1 = wrapDegrees(targetPitch - rotateVector.y);
                    float baseSpeed = 95f;
                    float accelFactor = 3.5f;
                    float snapSpeed = baseSpeed * (1 + Math.min(Math.abs(yawDelta1) / 90f, 1) * (accelFactor - 1));
                    float snapFactor = Math.min(1.0f, snapSpeed / Math.max(1.0f, Math.abs(yawDelta1)));
                    float snapYaw = rotateVector.x + yawDelta1 * snapFactor;
                    snapSpeed = baseSpeed * (1 + Math.min(Math.abs(pitchDelta) / 90f, 1) * (accelFactor - 1));
                    snapFactor = Math.min(1.0f, snapSpeed / Math.max(1.0f, Math.abs(pitchDelta1)));
                    float snapPitch = rotateVector.y + pitchDelta1 * snapFactor;
                    if (Math.abs(wrapDegrees(targetYaw - snapYaw)) < 0.1f) {
                        snapYaw = targetYaw;
                    }
                    if (Math.abs(wrapDegrees(targetPitch - snapPitch)) < 0.1f) {
                        snapPitch = targetPitch;
                    }
                    rotateVector = new Vector2f(snapYaw, snapPitch);
                } else {
                    float returnSpeed = 80f;
                    float yawDiff = wrapDegrees(currentYaw - rotateVector.x);
                    float pitchDiff = wrapDegrees(currentPitch - rotateVector.y);
                    float returnFactor = Math.min(1.0f, returnSpeed / Math.max(1.0f, Math.abs(yawDiff)));
                    float returnYaw = rotateVector.x + yawDiff * returnFactor;
                    returnFactor = Math.min(1.0f, returnSpeed / Math.max(1.0f, Math.abs(pitchDiff)));
                    float returnPitch = rotateVector.y + pitchDiff * returnFactor;
                    rotateVector = new Vector2f(returnYaw, returnPitch);
                }
                lastYaw = rotateVector.x;
                lastPitch = rotateVector.y;
                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = rotateVector.x;
                }
            }
        }
    }


    private void updateAttack() {
        selected = MouseUtil.getMouseOver(target, rotateVector.x, rotateVector.y, attackRange.get());

        if (options.getValueByName("Ускорять ротацию при атаке").get()) {
            updateRotation(true, 60, 35);
        }

        if ((selected == null || selected != target) && !mc.player.isElytraFlying()) {
            return;
        }

        if (mc.player.isBlocking() && options.getValueByName("Отжимать щит").get()) {
            mc.playerController.onStoppedUsingItem(mc.player);
        }

        stopWatch.setLastMS(500);
        mc.playerController.attackEntity(mc.player, target);
        mc.player.swingArm(Hand.MAIN_HAND);

        if (target instanceof PlayerEntity player && options.getValueByName("Ломать щит").get()) {
            breakShieldPlayer(player);
        }
    }

    private boolean shouldPlayerFalling() {
        boolean cancelReason = mc.player.isInWater() && mc.player.areEyesInFluid(FluidTags.WATER) || mc.player.isInLava() || mc.player.isOnLadder() || mc.player.isPassenger() || mc.player.abilities.isFlying;

        float attackStrength = mc.player.getCooledAttackStrength(options.getValueByName("Синхронизировать атаку с ТПС").get()
                ? Expensive.getInstance().getTpsCalc().getAdjustTicks() : 1.5f);

        if (attackStrength < 0.92f) {
            return false;
        }

        if (!cancelReason && options.getValueByName("Только криты").get()) {
            return !mc.player.isOnGround() && mc.player.fallDistance > 0;
        }

        return true;
    }

    private boolean isValid(LivingEntity entity) {
        if (entity instanceof ClientPlayerEntity) return false;

        if (entity.ticksExisted < 3) return false;
        if (mc.player.getDistanceEyePos(entity) > attackRange.get()) return false;

        if (entity instanceof PlayerEntity p) {
            if (AntiBot.isBot(entity)) {
                return false;
            }
            if (!targets.getValueByName("Друзья").get() && FriendStorage.isFriend(p.getName().getString())) {
                return false;
            }
            if (p.getName().getString().equalsIgnoreCase(mc.player.getName().getString())) return false;
        }

        if (entity instanceof PlayerEntity && !targets.getValueByName("Игроки").get()) {
            return false;
        }
        if (entity instanceof PlayerEntity && entity.getTotalArmorValue() == 0 && !targets.getValueByName("Голые").get()) {
            return false;
        }
        if (entity instanceof PlayerEntity && entity.isInvisible() && entity.getTotalArmorValue() == 0 && !targets.getValueByName("Голые невидимки").get()) {
            return false;
        }
        if (entity instanceof PlayerEntity && entity.isInvisible() && !targets.getValueByName("Невидимки").get()) {
            return false;
        }

        if (entity instanceof MonsterEntity && !targets.getValueByName("Мобы").get()) {
            return false;
        }
        if (entity instanceof AnimalEntity && !targets.getValueByName("Животные").get()) {
            return false;
        }

        return !entity.isInvulnerable() && entity.isAlive() && !(entity instanceof ArmorStandEntity);
    }

    private void breakShieldPlayer(PlayerEntity entity) {
        if (entity.isBlocking()) {
            int invSlot = InventoryUtil.getInstance().getAxeInInventory(false);
            int hotBarSlot = InventoryUtil.getInstance().getAxeInInventory(true);

            if (hotBarSlot == -1 && invSlot != -1) {
                int bestSlot = InventoryUtil.getInstance().findBestSlotInHotBar();
                mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, mc.player);
                mc.playerController.windowClick(0, bestSlot + 36, 0, ClickType.PICKUP, mc.player);

                mc.player.connection.sendPacket(new CHeldItemChangePacket(bestSlot));
                mc.playerController.attackEntity(mc.player, entity);
                mc.player.swingArm(Hand.MAIN_HAND);
                mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));

                mc.playerController.windowClick(0, bestSlot + 36, 0, ClickType.PICKUP, mc.player);
                mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, mc.player);
            }

            if (hotBarSlot != -1) {
                mc.player.connection.sendPacket(new CHeldItemChangePacket(hotBarSlot));
                mc.playerController.attackEntity(mc.player, entity);
                mc.player.swingArm(Hand.MAIN_HAND);
                mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
            }
        }
    }


    private void reset() {
        if (options.getValueByName("Коррекция движения").get()) {
            mc.player.rotationYawOffset = Integer.MIN_VALUE;
        }
        rotateVector = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
    }

    @Override
    public void onEnable() {
        super.onEnable();
        reset();
        target = null;
    }

    @Override
    public void onDisable() {
        super.onDisable();
        reset();
        stopWatch.setLastMS(0);
        target = null;
    }

    private double getEntityArmor(PlayerEntity entityPlayer2) {
        double d2 = 0.0;
        for (int i2 = 0; i2 < 4; ++i2) {
            ItemStack is = entityPlayer2.inventory.armorInventory.get(i2);
            if (!(is.getItem() instanceof ArmorItem)) continue;
            d2 += getProtectionLvl(is);
        }
        return d2;
    }

    private double getProtectionLvl(ItemStack stack) {
        if (stack.getItem() instanceof ArmorItem i) {
            double damageReduceAmount = i.getDamageReduceAmount();
            if (stack.isEnchanted()) {
                damageReduceAmount += (double) EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25;
            }
            return damageReduceAmount;
        }
        return 0;
    }

    private double getEntityHealth(LivingEntity ent) {
        if (ent instanceof PlayerEntity player) {
            return (double) (player.getHealth() + player.getAbsorptionAmount()) * (getEntityArmor(player) / 20.0);
        }
        return ent.getHealth() + ent.getAbsorptionAmount();
    }
}
Я УМРУ ПОКА ОДБРЯТ
 
Последнее редактирование:
с алгоритма спиздил пока ошибки фиксить это пиздец короче сливаю чтоб вы мозги не ебали
добавлены ротации grim hw rw

Код:
Expand Collapse Copy
import static java.lang.Math.hypot;
import static net.minecraft.util.math.MathHelper.clamp;
import static net.minecraft.util.math.MathHelper.wrapDegrees;

@FunctionRegister(name = "KillAura", type = Category.Combat)
public class KillAura extends Function {
    @Getter
    private final ModeSetting type = new ModeSetting("Тип", "Плавная", "Плавная", "Резкая" ,"HW" , "Grim" ,"ReallyWorld");
    private final SliderSetting attackRange = new SliderSetting("Дистанция аттаки", 3f, 3f, 6f, 0.1f);

    final ModeListSetting targets = new ModeListSetting("Таргеты",
            new BooleanSetting("Игроки", true),
            new BooleanSetting("Голые", true),
            new BooleanSetting("Мобы", false),
            new BooleanSetting("Животные", false),
            new BooleanSetting("Друзья", false),
            new BooleanSetting("Голые невидимки", true),
            new BooleanSetting("Невидимки", true));

    @Getter
    final ModeListSetting options = new ModeListSetting("Опции",
            new BooleanSetting("Только криты", true),
            new BooleanSetting("Ломать щит", true),
            new BooleanSetting("Отжимать щит", true),
            new BooleanSetting("Ускорять ротацию при атаке", false),
            new BooleanSetting("Синхронизировать атаку с ТПС", false),
            new BooleanSetting("Фокусировать одну цель", true),
            new BooleanSetting("Коррекция движения", true));
    final ModeSetting correctionType = new ModeSetting("Тип коррекции", "Незаметный", "Незаметный", "Сфокусированный");

    @Getter
    private final StopWatch stopWatch = new StopWatch();
    private Vector2f rotateVector = new Vector2f(0, 0);
    @Getter
    private LivingEntity target;
    private Entity selected;

    int ticks = 0;
    boolean isRotated;

    final AutoPotion autoPotion;

    public KillAura(AutoPotion autoPotion) {
        this.autoPotion = autoPotion;
        addSettings(type, attackRange, targets, options, correctionType);
    }

    @Subscribe
    public void onInput(EventInput eventInput) {
        if (options.getValueByName("Коррекция движения").get() && correctionType.is("Незаметная") && target != null && mc.player != null) {
            MoveUtils.fixMovement(eventInput, rotateVector.x);
        }
    }

    @Subscribe
    public void onUpdate(EventUpdate e) {
        if (options.getValueByName("Фокусировать одну цель").get() && (target == null || !isValid(target)) || !options.getValueByName("Фокусировать одну цель").get()) {
            updateTarget();
        }


        if (target != null && !(autoPotion.isState() && autoPotion.isActive())) {
            isRotated = false;
            if (shouldPlayerFalling() && (stopWatch.hasTimeElapsed())) {
                updateAttack();
                ticks = 2;
            }
            if (type.is("Резкая")) {
                if (ticks > 0) {
                    updateRotation(true, 180, 90);
                    ticks--;
                } else {
                    reset();
                }
            } else {
                if (!isRotated) {
                    updateRotation(false, 80, 35);
                }
            }

        } else {
            stopWatch.setLastMS(0);
            reset();
        }
    }

    @Subscribe
    private void onWalking(EventMotion e) {
        if (target == null || autoPotion.isState() && autoPotion.isActive()) return;

        float yaw = rotateVector.x;
        float pitch = rotateVector.y;

        e.setYaw(yaw);
        e.setPitch(pitch);
        mc.player.rotationYawHead = yaw;
        mc.player.renderYawOffset = yaw;
        mc.player.rotationPitchHead = pitch;
    }

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

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

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

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

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

        target = targets.get(0);
    }

    float lastYaw, lastPitch;

    private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
        Vector3d vec = target.getPositionVec().add(0, clamp(mc.player.getPosYEye() - target.getPosY(),
                        0, target.getHeight() * (mc.player.getDistanceEyePos(target) / attackRange.get())), 0)
                .subtract(mc.player.getEyePosition(1.0F));

        isRotated = true;

        float yawToTarget = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90);
        float pitchToTarget = (float) (-Math.toDegrees(Math.atan2(vec.y, hypot(vec.x, vec.z))));

        float yawDelta = (wrapDegrees(yawToTarget - rotateVector.x));
        float pitchDelta = (wrapDegrees(pitchToTarget - rotateVector.y));
        int roundedYaw = (int) yawDelta;

        switch (type.get()) {
            case "Плавная" -> {
                float clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 1.0f), rotationYawSpeed);
                float clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 1.0f), rotationPitchSpeed);

                if (attack && selected != target && options.getValueByName("Ускорять ротацию при атаке").get()) {
                    clampedPitch = Math.max(Math.abs(pitchDelta), 1.0f);
                } else {
                    clampedPitch /= 3f;
                }


                if (Math.abs(clampedYaw - this.lastYaw) <= 3.0f) {
                    clampedYaw = this.lastYaw + 3.1f;
                }

                float yaw = rotateVector.x + (yawDelta > 0 ? clampedYaw : -clampedYaw);
                float pitch = clamp(rotateVector.y + (pitchDelta > 0 ? clampedPitch : -clampedPitch), -89.0F, 89.0F);


                float gcd = SensUtils.getGCDValue();
                yaw -= (yaw - rotateVector.x) % gcd;
                pitch -= (pitch - rotateVector.y) % gcd;


                rotateVector = new Vector2f(yaw, pitch);
                lastYaw = clampedYaw;
                lastPitch = clampedPitch;
                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = yaw;
                }
            }
            case "Резкая" -> {
                float yaw = rotateVector.x + roundedYaw;
                float pitch = clamp(rotateVector.y + pitchDelta, -90, 90);

                float gcd = SensUtils.getGCDValue();
                yaw -= (yaw - rotateVector.x) % gcd;
                pitch -= (pitch - rotateVector.y) % gcd;

                rotateVector = new Vector2f(yaw, pitch);

                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = yaw;
                }
            }
            case "HW" -> {
                float yaw;
                float pitch;
                if (attack && selected != target && options.getValueByName("Ускорять ротацию при атаке").get()) {
                    yaw = rotateVector.x + yawDelta;
                    pitch = clamp(rotateVector.y + pitchDelta, -89.0F, 89.0F);
                } else {
                    float yawSpeed = Math.min(Math.max(Math.abs(yawDelta), 1.0f), rotationYawSpeed * 2.0f);
                    float pitchSpeed = Math.min(Math.max(Math.abs(pitchDelta), 1.0f), rotationPitchSpeed * 2.0f);
                    yaw = rotateVector.x + (yawDelta > 0 ? yawSpeed : -yawSpeed);
                    pitch = clamp(rotateVector.y + (pitchDelta > 0 ? pitchSpeed : -pitchSpeed), -89.0F, 89.0F);
                }
                float twitchIntensity = 0.15f;
                float twitchFrequency = 0.03f;
                if (mc.player.ticksExisted % Math.max(1, (int) (twitchFrequency * 15)) == 0) {
                    yaw += (float) (Math.random() - 0.5) * twitchIntensity;
                    pitch += (float) (Math.random() - 0.5) * twitchIntensity;
                }
                yaw += (float) (Math.random() - 0.5) * 0.03f;
                pitch += (float) (Math.random() - 0.5) * 0.03f;
                float gcd = SensUtils.getGCDValue();
                float gcdRandomizer = (float) (Math.random() * 0.008f + 0.996f);
                yaw -= (yaw - rotateVector.x) % (gcd * gcdRandomizer);
                pitch -= (pitch - rotateVector.y) % (gcd * gcdRandomizer);
                float maxYawChange = 40.0f;
                float maxPitchChange = 35.0f;
                yaw = rotateVector.x + clamp(yaw - rotateVector.x, -maxYawChange, maxYawChange);
                pitch = clamp(rotateVector.y + clamp(pitch - rotateVector.y, -maxPitchChange, maxPitchChange), -89.0F, 89.0F);
                rotateVector = new Vector2f(yaw, pitch);
                lastYaw = yaw;
                lastPitch = pitch;
                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = yaw;
                }
            }
            case "Grim" -> {
                float yaw;
                float pitch;
                if (attack && selected != target && options.getValueByName("Ускорять ротацию при атаке").get()) {
                    yaw = rotateVector.x + yawDelta;
                    pitch = clamp(rotateVector.y + pitchDelta, -89.0F, 89.0F);
                } else {
                    float yawSpeed = Math.min(Math.max(Math.abs(yawDelta), 1.0f), rotationYawSpeed * 2.5f);
                    float pitchSpeed = Math.min(Math.max(Math.abs(pitchDelta), 1.0f), rotationPitchSpeed * 2.5f);
                    yaw = rotateVector.x + (yawDelta > 0 ? yawSpeed : -yawSpeed);
                    pitch = clamp(rotateVector.y + (pitchDelta > 0 ? pitchSpeed : -pitchSpeed), -89.0F, 89.0F);
                }
                float shakeIntensity = 0.08f;
                float shakeFrequency = 0.05f;
                if (mc.player.ticksExisted % Math.max(1, (int) (shakeFrequency * 20)) == 0) {
                    yaw += (float) (Math.random() - 0.5) * shakeIntensity;
                    pitch += (float) (Math.random() - 0.5) * shakeIntensity;
                }
                float circleAmplitude = 4.2f;
                float circleSpeed = 0.6f;
                float time = mc.player.ticksExisted * circleSpeed;
                yaw += (float) Math.sin(time) * circleAmplitude;
                pitch += (float) Math.cos(time) * circleAmplitude;
                yaw += (float) (Math.random() - 0.5) * 0.02f;
                pitch += (float) (Math.random() - 0.5) * 0.02f;
                float gcd = SensUtils.getGCDValue();
                float gcdRandomizer = (float) (Math.random() * 0.005f + 0.9975f);
                yaw -= (yaw - rotateVector.x) % (gcd * gcdRandomizer);
                pitch -= (pitch - rotateVector.y) % (gcd * gcdRandomizer);
                float maxYawChange = 35.0f;
                float maxPitchChange = 30.0f;
                yaw = rotateVector.x + clamp(yaw - rotateVector.x, -maxYawChange, maxYawChange);
                pitch = clamp(rotateVector.y + clamp(pitch - rotateVector.y, -maxPitchChange, maxPitchChange), -89.0F, 89.0F);
                rotateVector = new Vector2f(yaw, pitch);
                lastYaw = yaw;
                lastPitch = pitch;
                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = yaw;
                }
            }
            case "ReallyWorld" -> {
                float currentYaw = mc.player.rotationYaw;
                float currentPitch = mc.player.rotationPitch;
                float targetYaw = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90);
                float targetPitch = (float) (-Math.toDegrees(Math.atan2(vec.y, hypot(vec.x, vec.z))));
                targetPitch = clamp(targetPitch, -89.0F, 89.0F);
                if (attack) {
                    float yawDelta1 = wrapDegrees(targetYaw - rotateVector.x);
                    float pitchDelta1 = wrapDegrees(targetPitch - rotateVector.y);
                    float baseSpeed = 95f;
                    float accelFactor = 3.5f;
                    float snapSpeed = baseSpeed * (1 + Math.min(Math.abs(yawDelta1) / 90f, 1) * (accelFactor - 1));
                    float snapFactor = Math.min(1.0f, snapSpeed / Math.max(1.0f, Math.abs(yawDelta1)));
                    float snapYaw = rotateVector.x + yawDelta1 * snapFactor;
                    snapSpeed = baseSpeed * (1 + Math.min(Math.abs(pitchDelta) / 90f, 1) * (accelFactor - 1));
                    snapFactor = Math.min(1.0f, snapSpeed / Math.max(1.0f, Math.abs(pitchDelta1)));
                    float snapPitch = rotateVector.y + pitchDelta1 * snapFactor;
                    if (Math.abs(wrapDegrees(targetYaw - snapYaw)) < 0.1f) {
                        snapYaw = targetYaw;
                    }
                    if (Math.abs(wrapDegrees(targetPitch - snapPitch)) < 0.1f) {
                        snapPitch = targetPitch;
                    }
                    rotateVector = new Vector2f(snapYaw, snapPitch);
                } else {
                    float returnSpeed = 80f;
                    float yawDiff = wrapDegrees(currentYaw - rotateVector.x);
                    float pitchDiff = wrapDegrees(currentPitch - rotateVector.y);
                    float returnFactor = Math.min(1.0f, returnSpeed / Math.max(1.0f, Math.abs(yawDiff)));
                    float returnYaw = rotateVector.x + yawDiff * returnFactor;
                    returnFactor = Math.min(1.0f, returnSpeed / Math.max(1.0f, Math.abs(pitchDiff)));
                    float returnPitch = rotateVector.y + pitchDiff * returnFactor;
                    rotateVector = new Vector2f(returnYaw, returnPitch);
                }
                lastYaw = rotateVector.x;
                lastPitch = rotateVector.y;
                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = rotateVector.x;
                }
            }
        }
    }


    private void updateAttack() {
        selected = MouseUtil.getMouseOver(target, rotateVector.x, rotateVector.y, attackRange.get());

        if (options.getValueByName("Ускорять ротацию при атаке").get()) {
            updateRotation(true, 60, 35);
        }

        if ((selected == null || selected != target) && !mc.player.isElytraFlying()) {
            return;
        }

        if (mc.player.isBlocking() && options.getValueByName("Отжимать щит").get()) {
            mc.playerController.onStoppedUsingItem(mc.player);
        }

        stopWatch.setLastMS(500);
        mc.playerController.attackEntity(mc.player, target);
        mc.player.swingArm(Hand.MAIN_HAND);

        if (target instanceof PlayerEntity player && options.getValueByName("Ломать щит").get()) {
            breakShieldPlayer(player);
        }
    }

    private boolean shouldPlayerFalling() {
        boolean cancelReason = mc.player.isInWater() && mc.player.areEyesInFluid(FluidTags.WATER) || mc.player.isInLava() || mc.player.isOnLadder() || mc.player.isPassenger() || mc.player.abilities.isFlying;

        float attackStrength = mc.player.getCooledAttackStrength(options.getValueByName("Синхронизировать атаку с ТПС").get()
                ? Expensive.getInstance().getTpsCalc().getAdjustTicks() : 1.5f);

        if (attackStrength < 0.92f) {
            return false;
        }

        if (!cancelReason && options.getValueByName("Только криты").get()) {
            return !mc.player.isOnGround() && mc.player.fallDistance > 0;
        }

        return true;
    }

    private boolean isValid(LivingEntity entity) {
        if (entity instanceof ClientPlayerEntity) return false;

        if (entity.ticksExisted < 3) return false;
        if (mc.player.getDistanceEyePos(entity) > attackRange.get()) return false;

        if (entity instanceof PlayerEntity p) {
            if (AntiBot.isBot(entity)) {
                return false;
            }
            if (!targets.getValueByName("Друзья").get() && FriendStorage.isFriend(p.getName().getString())) {
                return false;
            }
            if (p.getName().getString().equalsIgnoreCase(mc.player.getName().getString())) return false;
        }

        if (entity instanceof PlayerEntity && !targets.getValueByName("Игроки").get()) {
            return false;
        }
        if (entity instanceof PlayerEntity && entity.getTotalArmorValue() == 0 && !targets.getValueByName("Голые").get()) {
            return false;
        }
        if (entity instanceof PlayerEntity && entity.isInvisible() && entity.getTotalArmorValue() == 0 && !targets.getValueByName("Голые невидимки").get()) {
            return false;
        }
        if (entity instanceof PlayerEntity && entity.isInvisible() && !targets.getValueByName("Невидимки").get()) {
            return false;
        }

        if (entity instanceof MonsterEntity && !targets.getValueByName("Мобы").get()) {
            return false;
        }
        if (entity instanceof AnimalEntity && !targets.getValueByName("Животные").get()) {
            return false;
        }

        return !entity.isInvulnerable() && entity.isAlive() && !(entity instanceof ArmorStandEntity);
    }

    private void breakShieldPlayer(PlayerEntity entity) {
        if (entity.isBlocking()) {
            int invSlot = InventoryUtil.getInstance().getAxeInInventory(false);
            int hotBarSlot = InventoryUtil.getInstance().getAxeInInventory(true);

            if (hotBarSlot == -1 && invSlot != -1) {
                int bestSlot = InventoryUtil.getInstance().findBestSlotInHotBar();
                mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, mc.player);
                mc.playerController.windowClick(0, bestSlot + 36, 0, ClickType.PICKUP, mc.player);

                mc.player.connection.sendPacket(new CHeldItemChangePacket(bestSlot));
                mc.playerController.attackEntity(mc.player, entity);
                mc.player.swingArm(Hand.MAIN_HAND);
                mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));

                mc.playerController.windowClick(0, bestSlot + 36, 0, ClickType.PICKUP, mc.player);
                mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, mc.player);
            }

            if (hotBarSlot != -1) {
                mc.player.connection.sendPacket(new CHeldItemChangePacket(hotBarSlot));
                mc.playerController.attackEntity(mc.player, entity);
                mc.player.swingArm(Hand.MAIN_HAND);
                mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
            }
        }
    }


    private void reset() {
        if (options.getValueByName("Коррекция движения").get()) {
            mc.player.rotationYawOffset = Integer.MIN_VALUE;
        }
        rotateVector = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
    }

    @Override
    public void onEnable() {
        super.onEnable();
        reset();
        target = null;
    }

    @Override
    public void onDisable() {
        super.onDisable();
        reset();
        stopWatch.setLastMS(0);
        target = null;
    }

    private double getEntityArmor(PlayerEntity entityPlayer2) {
        double d2 = 0.0;
        for (int i2 = 0; i2 < 4; ++i2) {
            ItemStack is = entityPlayer2.inventory.armorInventory.get(i2);
            if (!(is.getItem() instanceof ArmorItem)) continue;
            d2 += getProtectionLvl(is);
        }
        return d2;
    }

    private double getProtectionLvl(ItemStack stack) {
        if (stack.getItem() instanceof ArmorItem i) {
            double damageReduceAmount = i.getDamageReduceAmount();
            if (stack.isEnchanted()) {
                damageReduceAmount += (double) EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25;
            }
            return damageReduceAmount;
        }
        return 0;
    }

    private double getEntityHealth(LivingEntity ent) {
        if (ent instanceof PlayerEntity player) {
            return (double) (player.getHealth() + player.getAbsorptionAmount()) * (getEntityArmor(player) / 20.0);
        }
        return ent.getHealth() + ent.getAbsorptionAmount();
    }
}
Я УМРУ ПОКА ОДБРЯТ
килка хв 100000% не бупасит и откуда вы знаете как меня мама називает (Меня називала Килька Риба такая)
 
с алгоритма спиздил пока ошибки фиксить это пиздец короче сливаю чтоб вы мозги не ебали
добавлены ротации grim hw rw

Код:
Expand Collapse Copy
import static java.lang.Math.hypot;
import static net.minecraft.util.math.MathHelper.clamp;
import static net.minecraft.util.math.MathHelper.wrapDegrees;

@FunctionRegister(name = "KillAura", type = Category.Combat)
public class KillAura extends Function {
    @Getter
    private final ModeSetting type = new ModeSetting("Тип", "Плавная", "Плавная", "Резкая" ,"HW" , "Grim" ,"ReallyWorld");
    private final SliderSetting attackRange = new SliderSetting("Дистанция аттаки", 3f, 3f, 6f, 0.1f);

    final ModeListSetting targets = new ModeListSetting("Таргеты",
            new BooleanSetting("Игроки", true),
            new BooleanSetting("Голые", true),
            new BooleanSetting("Мобы", false),
            new BooleanSetting("Животные", false),
            new BooleanSetting("Друзья", false),
            new BooleanSetting("Голые невидимки", true),
            new BooleanSetting("Невидимки", true));

    @Getter
    final ModeListSetting options = new ModeListSetting("Опции",
            new BooleanSetting("Только криты", true),
            new BooleanSetting("Ломать щит", true),
            new BooleanSetting("Отжимать щит", true),
            new BooleanSetting("Ускорять ротацию при атаке", false),
            new BooleanSetting("Синхронизировать атаку с ТПС", false),
            new BooleanSetting("Фокусировать одну цель", true),
            new BooleanSetting("Коррекция движения", true));
    final ModeSetting correctionType = new ModeSetting("Тип коррекции", "Незаметный", "Незаметный", "Сфокусированный");

    @Getter
    private final StopWatch stopWatch = new StopWatch();
    private Vector2f rotateVector = new Vector2f(0, 0);
    @Getter
    private LivingEntity target;
    private Entity selected;

    int ticks = 0;
    boolean isRotated;

    final AutoPotion autoPotion;

    public KillAura(AutoPotion autoPotion) {
        this.autoPotion = autoPotion;
        addSettings(type, attackRange, targets, options, correctionType);
    }

    @Subscribe
    public void onInput(EventInput eventInput) {
        if (options.getValueByName("Коррекция движения").get() && correctionType.is("Незаметная") && target != null && mc.player != null) {
            MoveUtils.fixMovement(eventInput, rotateVector.x);
        }
    }

    @Subscribe
    public void onUpdate(EventUpdate e) {
        if (options.getValueByName("Фокусировать одну цель").get() && (target == null || !isValid(target)) || !options.getValueByName("Фокусировать одну цель").get()) {
            updateTarget();
        }


        if (target != null && !(autoPotion.isState() && autoPotion.isActive())) {
            isRotated = false;
            if (shouldPlayerFalling() && (stopWatch.hasTimeElapsed())) {
                updateAttack();
                ticks = 2;
            }
            if (type.is("Резкая")) {
                if (ticks > 0) {
                    updateRotation(true, 180, 90);
                    ticks--;
                } else {
                    reset();
                }
            } else {
                if (!isRotated) {
                    updateRotation(false, 80, 35);
                }
            }

        } else {
            stopWatch.setLastMS(0);
            reset();
        }
    }

    @Subscribe
    private void onWalking(EventMotion e) {
        if (target == null || autoPotion.isState() && autoPotion.isActive()) return;

        float yaw = rotateVector.x;
        float pitch = rotateVector.y;

        e.setYaw(yaw);
        e.setPitch(pitch);
        mc.player.rotationYawHead = yaw;
        mc.player.renderYawOffset = yaw;
        mc.player.rotationPitchHead = pitch;
    }

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

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

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

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

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

        target = targets.get(0);
    }

    float lastYaw, lastPitch;

    private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
        Vector3d vec = target.getPositionVec().add(0, clamp(mc.player.getPosYEye() - target.getPosY(),
                        0, target.getHeight() * (mc.player.getDistanceEyePos(target) / attackRange.get())), 0)
                .subtract(mc.player.getEyePosition(1.0F));

        isRotated = true;

        float yawToTarget = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90);
        float pitchToTarget = (float) (-Math.toDegrees(Math.atan2(vec.y, hypot(vec.x, vec.z))));

        float yawDelta = (wrapDegrees(yawToTarget - rotateVector.x));
        float pitchDelta = (wrapDegrees(pitchToTarget - rotateVector.y));
        int roundedYaw = (int) yawDelta;

        switch (type.get()) {
            case "Плавная" -> {
                float clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 1.0f), rotationYawSpeed);
                float clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 1.0f), rotationPitchSpeed);

                if (attack && selected != target && options.getValueByName("Ускорять ротацию при атаке").get()) {
                    clampedPitch = Math.max(Math.abs(pitchDelta), 1.0f);
                } else {
                    clampedPitch /= 3f;
                }


                if (Math.abs(clampedYaw - this.lastYaw) <= 3.0f) {
                    clampedYaw = this.lastYaw + 3.1f;
                }

                float yaw = rotateVector.x + (yawDelta > 0 ? clampedYaw : -clampedYaw);
                float pitch = clamp(rotateVector.y + (pitchDelta > 0 ? clampedPitch : -clampedPitch), -89.0F, 89.0F);


                float gcd = SensUtils.getGCDValue();
                yaw -= (yaw - rotateVector.x) % gcd;
                pitch -= (pitch - rotateVector.y) % gcd;


                rotateVector = new Vector2f(yaw, pitch);
                lastYaw = clampedYaw;
                lastPitch = clampedPitch;
                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = yaw;
                }
            }
            case "Резкая" -> {
                float yaw = rotateVector.x + roundedYaw;
                float pitch = clamp(rotateVector.y + pitchDelta, -90, 90);

                float gcd = SensUtils.getGCDValue();
                yaw -= (yaw - rotateVector.x) % gcd;
                pitch -= (pitch - rotateVector.y) % gcd;

                rotateVector = new Vector2f(yaw, pitch);

                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = yaw;
                }
            }
            case "HW" -> {
                float yaw;
                float pitch;
                if (attack && selected != target && options.getValueByName("Ускорять ротацию при атаке").get()) {
                    yaw = rotateVector.x + yawDelta;
                    pitch = clamp(rotateVector.y + pitchDelta, -89.0F, 89.0F);
                } else {
                    float yawSpeed = Math.min(Math.max(Math.abs(yawDelta), 1.0f), rotationYawSpeed * 2.0f);
                    float pitchSpeed = Math.min(Math.max(Math.abs(pitchDelta), 1.0f), rotationPitchSpeed * 2.0f);
                    yaw = rotateVector.x + (yawDelta > 0 ? yawSpeed : -yawSpeed);
                    pitch = clamp(rotateVector.y + (pitchDelta > 0 ? pitchSpeed : -pitchSpeed), -89.0F, 89.0F);
                }
                float twitchIntensity = 0.15f;
                float twitchFrequency = 0.03f;
                if (mc.player.ticksExisted % Math.max(1, (int) (twitchFrequency * 15)) == 0) {
                    yaw += (float) (Math.random() - 0.5) * twitchIntensity;
                    pitch += (float) (Math.random() - 0.5) * twitchIntensity;
                }
                yaw += (float) (Math.random() - 0.5) * 0.03f;
                pitch += (float) (Math.random() - 0.5) * 0.03f;
                float gcd = SensUtils.getGCDValue();
                float gcdRandomizer = (float) (Math.random() * 0.008f + 0.996f);
                yaw -= (yaw - rotateVector.x) % (gcd * gcdRandomizer);
                pitch -= (pitch - rotateVector.y) % (gcd * gcdRandomizer);
                float maxYawChange = 40.0f;
                float maxPitchChange = 35.0f;
                yaw = rotateVector.x + clamp(yaw - rotateVector.x, -maxYawChange, maxYawChange);
                pitch = clamp(rotateVector.y + clamp(pitch - rotateVector.y, -maxPitchChange, maxPitchChange), -89.0F, 89.0F);
                rotateVector = new Vector2f(yaw, pitch);
                lastYaw = yaw;
                lastPitch = pitch;
                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = yaw;
                }
            }
            case "Grim" -> {
                float yaw;
                float pitch;
                if (attack && selected != target && options.getValueByName("Ускорять ротацию при атаке").get()) {
                    yaw = rotateVector.x + yawDelta;
                    pitch = clamp(rotateVector.y + pitchDelta, -89.0F, 89.0F);
                } else {
                    float yawSpeed = Math.min(Math.max(Math.abs(yawDelta), 1.0f), rotationYawSpeed * 2.5f);
                    float pitchSpeed = Math.min(Math.max(Math.abs(pitchDelta), 1.0f), rotationPitchSpeed * 2.5f);
                    yaw = rotateVector.x + (yawDelta > 0 ? yawSpeed : -yawSpeed);
                    pitch = clamp(rotateVector.y + (pitchDelta > 0 ? pitchSpeed : -pitchSpeed), -89.0F, 89.0F);
                }
                float shakeIntensity = 0.08f;
                float shakeFrequency = 0.05f;
                if (mc.player.ticksExisted % Math.max(1, (int) (shakeFrequency * 20)) == 0) {
                    yaw += (float) (Math.random() - 0.5) * shakeIntensity;
                    pitch += (float) (Math.random() - 0.5) * shakeIntensity;
                }
                float circleAmplitude = 4.2f;
                float circleSpeed = 0.6f;
                float time = mc.player.ticksExisted * circleSpeed;
                yaw += (float) Math.sin(time) * circleAmplitude;
                pitch += (float) Math.cos(time) * circleAmplitude;
                yaw += (float) (Math.random() - 0.5) * 0.02f;
                pitch += (float) (Math.random() - 0.5) * 0.02f;
                float gcd = SensUtils.getGCDValue();
                float gcdRandomizer = (float) (Math.random() * 0.005f + 0.9975f);
                yaw -= (yaw - rotateVector.x) % (gcd * gcdRandomizer);
                pitch -= (pitch - rotateVector.y) % (gcd * gcdRandomizer);
                float maxYawChange = 35.0f;
                float maxPitchChange = 30.0f;
                yaw = rotateVector.x + clamp(yaw - rotateVector.x, -maxYawChange, maxYawChange);
                pitch = clamp(rotateVector.y + clamp(pitch - rotateVector.y, -maxPitchChange, maxPitchChange), -89.0F, 89.0F);
                rotateVector = new Vector2f(yaw, pitch);
                lastYaw = yaw;
                lastPitch = pitch;
                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = yaw;
                }
            }
            case "ReallyWorld" -> {
                float currentYaw = mc.player.rotationYaw;
                float currentPitch = mc.player.rotationPitch;
                float targetYaw = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90);
                float targetPitch = (float) (-Math.toDegrees(Math.atan2(vec.y, hypot(vec.x, vec.z))));
                targetPitch = clamp(targetPitch, -89.0F, 89.0F);
                if (attack) {
                    float yawDelta1 = wrapDegrees(targetYaw - rotateVector.x);
                    float pitchDelta1 = wrapDegrees(targetPitch - rotateVector.y);
                    float baseSpeed = 95f;
                    float accelFactor = 3.5f;
                    float snapSpeed = baseSpeed * (1 + Math.min(Math.abs(yawDelta1) / 90f, 1) * (accelFactor - 1));
                    float snapFactor = Math.min(1.0f, snapSpeed / Math.max(1.0f, Math.abs(yawDelta1)));
                    float snapYaw = rotateVector.x + yawDelta1 * snapFactor;
                    snapSpeed = baseSpeed * (1 + Math.min(Math.abs(pitchDelta) / 90f, 1) * (accelFactor - 1));
                    snapFactor = Math.min(1.0f, snapSpeed / Math.max(1.0f, Math.abs(pitchDelta1)));
                    float snapPitch = rotateVector.y + pitchDelta1 * snapFactor;
                    if (Math.abs(wrapDegrees(targetYaw - snapYaw)) < 0.1f) {
                        snapYaw = targetYaw;
                    }
                    if (Math.abs(wrapDegrees(targetPitch - snapPitch)) < 0.1f) {
                        snapPitch = targetPitch;
                    }
                    rotateVector = new Vector2f(snapYaw, snapPitch);
                } else {
                    float returnSpeed = 80f;
                    float yawDiff = wrapDegrees(currentYaw - rotateVector.x);
                    float pitchDiff = wrapDegrees(currentPitch - rotateVector.y);
                    float returnFactor = Math.min(1.0f, returnSpeed / Math.max(1.0f, Math.abs(yawDiff)));
                    float returnYaw = rotateVector.x + yawDiff * returnFactor;
                    returnFactor = Math.min(1.0f, returnSpeed / Math.max(1.0f, Math.abs(pitchDiff)));
                    float returnPitch = rotateVector.y + pitchDiff * returnFactor;
                    rotateVector = new Vector2f(returnYaw, returnPitch);
                }
                lastYaw = rotateVector.x;
                lastPitch = rotateVector.y;
                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = rotateVector.x;
                }
            }
        }
    }


    private void updateAttack() {
        selected = MouseUtil.getMouseOver(target, rotateVector.x, rotateVector.y, attackRange.get());

        if (options.getValueByName("Ускорять ротацию при атаке").get()) {
            updateRotation(true, 60, 35);
        }

        if ((selected == null || selected != target) && !mc.player.isElytraFlying()) {
            return;
        }

        if (mc.player.isBlocking() && options.getValueByName("Отжимать щит").get()) {
            mc.playerController.onStoppedUsingItem(mc.player);
        }

        stopWatch.setLastMS(500);
        mc.playerController.attackEntity(mc.player, target);
        mc.player.swingArm(Hand.MAIN_HAND);

        if (target instanceof PlayerEntity player && options.getValueByName("Ломать щит").get()) {
            breakShieldPlayer(player);
        }
    }

    private boolean shouldPlayerFalling() {
        boolean cancelReason = mc.player.isInWater() && mc.player.areEyesInFluid(FluidTags.WATER) || mc.player.isInLava() || mc.player.isOnLadder() || mc.player.isPassenger() || mc.player.abilities.isFlying;

        float attackStrength = mc.player.getCooledAttackStrength(options.getValueByName("Синхронизировать атаку с ТПС").get()
                ? Expensive.getInstance().getTpsCalc().getAdjustTicks() : 1.5f);

        if (attackStrength < 0.92f) {
            return false;
        }

        if (!cancelReason && options.getValueByName("Только криты").get()) {
            return !mc.player.isOnGround() && mc.player.fallDistance > 0;
        }

        return true;
    }

    private boolean isValid(LivingEntity entity) {
        if (entity instanceof ClientPlayerEntity) return false;

        if (entity.ticksExisted < 3) return false;
        if (mc.player.getDistanceEyePos(entity) > attackRange.get()) return false;

        if (entity instanceof PlayerEntity p) {
            if (AntiBot.isBot(entity)) {
                return false;
            }
            if (!targets.getValueByName("Друзья").get() && FriendStorage.isFriend(p.getName().getString())) {
                return false;
            }
            if (p.getName().getString().equalsIgnoreCase(mc.player.getName().getString())) return false;
        }

        if (entity instanceof PlayerEntity && !targets.getValueByName("Игроки").get()) {
            return false;
        }
        if (entity instanceof PlayerEntity && entity.getTotalArmorValue() == 0 && !targets.getValueByName("Голые").get()) {
            return false;
        }
        if (entity instanceof PlayerEntity && entity.isInvisible() && entity.getTotalArmorValue() == 0 && !targets.getValueByName("Голые невидимки").get()) {
            return false;
        }
        if (entity instanceof PlayerEntity && entity.isInvisible() && !targets.getValueByName("Невидимки").get()) {
            return false;
        }

        if (entity instanceof MonsterEntity && !targets.getValueByName("Мобы").get()) {
            return false;
        }
        if (entity instanceof AnimalEntity && !targets.getValueByName("Животные").get()) {
            return false;
        }

        return !entity.isInvulnerable() && entity.isAlive() && !(entity instanceof ArmorStandEntity);
    }

    private void breakShieldPlayer(PlayerEntity entity) {
        if (entity.isBlocking()) {
            int invSlot = InventoryUtil.getInstance().getAxeInInventory(false);
            int hotBarSlot = InventoryUtil.getInstance().getAxeInInventory(true);

            if (hotBarSlot == -1 && invSlot != -1) {
                int bestSlot = InventoryUtil.getInstance().findBestSlotInHotBar();
                mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, mc.player);
                mc.playerController.windowClick(0, bestSlot + 36, 0, ClickType.PICKUP, mc.player);

                mc.player.connection.sendPacket(new CHeldItemChangePacket(bestSlot));
                mc.playerController.attackEntity(mc.player, entity);
                mc.player.swingArm(Hand.MAIN_HAND);
                mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));

                mc.playerController.windowClick(0, bestSlot + 36, 0, ClickType.PICKUP, mc.player);
                mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, mc.player);
            }

            if (hotBarSlot != -1) {
                mc.player.connection.sendPacket(new CHeldItemChangePacket(hotBarSlot));
                mc.playerController.attackEntity(mc.player, entity);
                mc.player.swingArm(Hand.MAIN_HAND);
                mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
            }
        }
    }


    private void reset() {
        if (options.getValueByName("Коррекция движения").get()) {
            mc.player.rotationYawOffset = Integer.MIN_VALUE;
        }
        rotateVector = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
    }

    @Override
    public void onEnable() {
        super.onEnable();
        reset();
        target = null;
    }

    @Override
    public void onDisable() {
        super.onDisable();
        reset();
        stopWatch.setLastMS(0);
        target = null;
    }

    private double getEntityArmor(PlayerEntity entityPlayer2) {
        double d2 = 0.0;
        for (int i2 = 0; i2 < 4; ++i2) {
            ItemStack is = entityPlayer2.inventory.armorInventory.get(i2);
            if (!(is.getItem() instanceof ArmorItem)) continue;
            d2 += getProtectionLvl(is);
        }
        return d2;
    }

    private double getProtectionLvl(ItemStack stack) {
        if (stack.getItem() instanceof ArmorItem i) {
            double damageReduceAmount = i.getDamageReduceAmount();
            if (stack.isEnchanted()) {
                damageReduceAmount += (double) EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25;
            }
            return damageReduceAmount;
        }
        return 0;
    }

    private double getEntityHealth(LivingEntity ent) {
        if (ent instanceof PlayerEntity player) {
            return (double) (player.getHealth() + player.getAbsorptionAmount()) * (getEntityArmor(player) / 20.0);
        }
        return ent.getHealth() + ent.getAbsorptionAmount();
    }
}
Я УМРУ ПОКА ОДБРЯТ
Дефолт ротации , /del
 
с алгоритма спиздил пока ошибки фиксить это пиздец короче сливаю чтоб вы мозги не ебали
добавлены ротации grim hw rw

Код:
Expand Collapse Copy
import static java.lang.Math.hypot;
import static net.minecraft.util.math.MathHelper.clamp;
import static net.minecraft.util.math.MathHelper.wrapDegrees;

@FunctionRegister(name = "KillAura", type = Category.Combat)
public class KillAura extends Function {
    @Getter
    private final ModeSetting type = new ModeSetting("Тип", "Плавная", "Плавная", "Резкая" ,"HW" , "Grim" ,"ReallyWorld");
    private final SliderSetting attackRange = new SliderSetting("Дистанция аттаки", 3f, 3f, 6f, 0.1f);

    final ModeListSetting targets = new ModeListSetting("Таргеты",
            new BooleanSetting("Игроки", true),
            new BooleanSetting("Голые", true),
            new BooleanSetting("Мобы", false),
            new BooleanSetting("Животные", false),
            new BooleanSetting("Друзья", false),
            new BooleanSetting("Голые невидимки", true),
            new BooleanSetting("Невидимки", true));

    @Getter
    final ModeListSetting options = new ModeListSetting("Опции",
            new BooleanSetting("Только криты", true),
            new BooleanSetting("Ломать щит", true),
            new BooleanSetting("Отжимать щит", true),
            new BooleanSetting("Ускорять ротацию при атаке", false),
            new BooleanSetting("Синхронизировать атаку с ТПС", false),
            new BooleanSetting("Фокусировать одну цель", true),
            new BooleanSetting("Коррекция движения", true));
    final ModeSetting correctionType = new ModeSetting("Тип коррекции", "Незаметный", "Незаметный", "Сфокусированный");

    @Getter
    private final StopWatch stopWatch = new StopWatch();
    private Vector2f rotateVector = new Vector2f(0, 0);
    @Getter
    private LivingEntity target;
    private Entity selected;

    int ticks = 0;
    boolean isRotated;

    final AutoPotion autoPotion;

    public KillAura(AutoPotion autoPotion) {
        this.autoPotion = autoPotion;
        addSettings(type, attackRange, targets, options, correctionType);
    }

    @Subscribe
    public void onInput(EventInput eventInput) {
        if (options.getValueByName("Коррекция движения").get() && correctionType.is("Незаметная") && target != null && mc.player != null) {
            MoveUtils.fixMovement(eventInput, rotateVector.x);
        }
    }

    @Subscribe
    public void onUpdate(EventUpdate e) {
        if (options.getValueByName("Фокусировать одну цель").get() && (target == null || !isValid(target)) || !options.getValueByName("Фокусировать одну цель").get()) {
            updateTarget();
        }


        if (target != null && !(autoPotion.isState() && autoPotion.isActive())) {
            isRotated = false;
            if (shouldPlayerFalling() && (stopWatch.hasTimeElapsed())) {
                updateAttack();
                ticks = 2;
            }
            if (type.is("Резкая")) {
                if (ticks > 0) {
                    updateRotation(true, 180, 90);
                    ticks--;
                } else {
                    reset();
                }
            } else {
                if (!isRotated) {
                    updateRotation(false, 80, 35);
                }
            }

        } else {
            stopWatch.setLastMS(0);
            reset();
        }
    }

    @Subscribe
    private void onWalking(EventMotion e) {
        if (target == null || autoPotion.isState() && autoPotion.isActive()) return;

        float yaw = rotateVector.x;
        float pitch = rotateVector.y;

        e.setYaw(yaw);
        e.setPitch(pitch);
        mc.player.rotationYawHead = yaw;
        mc.player.renderYawOffset = yaw;
        mc.player.rotationPitchHead = pitch;
    }

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

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

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

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

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

        target = targets.get(0);
    }

    float lastYaw, lastPitch;

    private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
        Vector3d vec = target.getPositionVec().add(0, clamp(mc.player.getPosYEye() - target.getPosY(),
                        0, target.getHeight() * (mc.player.getDistanceEyePos(target) / attackRange.get())), 0)
                .subtract(mc.player.getEyePosition(1.0F));

        isRotated = true;

        float yawToTarget = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90);
        float pitchToTarget = (float) (-Math.toDegrees(Math.atan2(vec.y, hypot(vec.x, vec.z))));

        float yawDelta = (wrapDegrees(yawToTarget - rotateVector.x));
        float pitchDelta = (wrapDegrees(pitchToTarget - rotateVector.y));
        int roundedYaw = (int) yawDelta;

        switch (type.get()) {
            case "Плавная" -> {
                float clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 1.0f), rotationYawSpeed);
                float clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 1.0f), rotationPitchSpeed);

                if (attack && selected != target && options.getValueByName("Ускорять ротацию при атаке").get()) {
                    clampedPitch = Math.max(Math.abs(pitchDelta), 1.0f);
                } else {
                    clampedPitch /= 3f;
                }


                if (Math.abs(clampedYaw - this.lastYaw) <= 3.0f) {
                    clampedYaw = this.lastYaw + 3.1f;
                }

                float yaw = rotateVector.x + (yawDelta > 0 ? clampedYaw : -clampedYaw);
                float pitch = clamp(rotateVector.y + (pitchDelta > 0 ? clampedPitch : -clampedPitch), -89.0F, 89.0F);


                float gcd = SensUtils.getGCDValue();
                yaw -= (yaw - rotateVector.x) % gcd;
                pitch -= (pitch - rotateVector.y) % gcd;


                rotateVector = new Vector2f(yaw, pitch);
                lastYaw = clampedYaw;
                lastPitch = clampedPitch;
                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = yaw;
                }
            }
            case "Резкая" -> {
                float yaw = rotateVector.x + roundedYaw;
                float pitch = clamp(rotateVector.y + pitchDelta, -90, 90);

                float gcd = SensUtils.getGCDValue();
                yaw -= (yaw - rotateVector.x) % gcd;
                pitch -= (pitch - rotateVector.y) % gcd;

                rotateVector = new Vector2f(yaw, pitch);

                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = yaw;
                }
            }
            case "HW" -> {
                float yaw;
                float pitch;
                if (attack && selected != target && options.getValueByName("Ускорять ротацию при атаке").get()) {
                    yaw = rotateVector.x + yawDelta;
                    pitch = clamp(rotateVector.y + pitchDelta, -89.0F, 89.0F);
                } else {
                    float yawSpeed = Math.min(Math.max(Math.abs(yawDelta), 1.0f), rotationYawSpeed * 2.0f);
                    float pitchSpeed = Math.min(Math.max(Math.abs(pitchDelta), 1.0f), rotationPitchSpeed * 2.0f);
                    yaw = rotateVector.x + (yawDelta > 0 ? yawSpeed : -yawSpeed);
                    pitch = clamp(rotateVector.y + (pitchDelta > 0 ? pitchSpeed : -pitchSpeed), -89.0F, 89.0F);
                }
                float twitchIntensity = 0.15f;
                float twitchFrequency = 0.03f;
                if (mc.player.ticksExisted % Math.max(1, (int) (twitchFrequency * 15)) == 0) {
                    yaw += (float) (Math.random() - 0.5) * twitchIntensity;
                    pitch += (float) (Math.random() - 0.5) * twitchIntensity;
                }
                yaw += (float) (Math.random() - 0.5) * 0.03f;
                pitch += (float) (Math.random() - 0.5) * 0.03f;
                float gcd = SensUtils.getGCDValue();
                float gcdRandomizer = (float) (Math.random() * 0.008f + 0.996f);
                yaw -= (yaw - rotateVector.x) % (gcd * gcdRandomizer);
                pitch -= (pitch - rotateVector.y) % (gcd * gcdRandomizer);
                float maxYawChange = 40.0f;
                float maxPitchChange = 35.0f;
                yaw = rotateVector.x + clamp(yaw - rotateVector.x, -maxYawChange, maxYawChange);
                pitch = clamp(rotateVector.y + clamp(pitch - rotateVector.y, -maxPitchChange, maxPitchChange), -89.0F, 89.0F);
                rotateVector = new Vector2f(yaw, pitch);
                lastYaw = yaw;
                lastPitch = pitch;
                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = yaw;
                }
            }
            case "Grim" -> {
                float yaw;
                float pitch;
                if (attack && selected != target && options.getValueByName("Ускорять ротацию при атаке").get()) {
                    yaw = rotateVector.x + yawDelta;
                    pitch = clamp(rotateVector.y + pitchDelta, -89.0F, 89.0F);
                } else {
                    float yawSpeed = Math.min(Math.max(Math.abs(yawDelta), 1.0f), rotationYawSpeed * 2.5f);
                    float pitchSpeed = Math.min(Math.max(Math.abs(pitchDelta), 1.0f), rotationPitchSpeed * 2.5f);
                    yaw = rotateVector.x + (yawDelta > 0 ? yawSpeed : -yawSpeed);
                    pitch = clamp(rotateVector.y + (pitchDelta > 0 ? pitchSpeed : -pitchSpeed), -89.0F, 89.0F);
                }
                float shakeIntensity = 0.08f;
                float shakeFrequency = 0.05f;
                if (mc.player.ticksExisted % Math.max(1, (int) (shakeFrequency * 20)) == 0) {
                    yaw += (float) (Math.random() - 0.5) * shakeIntensity;
                    pitch += (float) (Math.random() - 0.5) * shakeIntensity;
                }
                float circleAmplitude = 4.2f;
                float circleSpeed = 0.6f;
                float time = mc.player.ticksExisted * circleSpeed;
                yaw += (float) Math.sin(time) * circleAmplitude;
                pitch += (float) Math.cos(time) * circleAmplitude;
                yaw += (float) (Math.random() - 0.5) * 0.02f;
                pitch += (float) (Math.random() - 0.5) * 0.02f;
                float gcd = SensUtils.getGCDValue();
                float gcdRandomizer = (float) (Math.random() * 0.005f + 0.9975f);
                yaw -= (yaw - rotateVector.x) % (gcd * gcdRandomizer);
                pitch -= (pitch - rotateVector.y) % (gcd * gcdRandomizer);
                float maxYawChange = 35.0f;
                float maxPitchChange = 30.0f;
                yaw = rotateVector.x + clamp(yaw - rotateVector.x, -maxYawChange, maxYawChange);
                pitch = clamp(rotateVector.y + clamp(pitch - rotateVector.y, -maxPitchChange, maxPitchChange), -89.0F, 89.0F);
                rotateVector = new Vector2f(yaw, pitch);
                lastYaw = yaw;
                lastPitch = pitch;
                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = yaw;
                }
            }
            case "ReallyWorld" -> {
                float currentYaw = mc.player.rotationYaw;
                float currentPitch = mc.player.rotationPitch;
                float targetYaw = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90);
                float targetPitch = (float) (-Math.toDegrees(Math.atan2(vec.y, hypot(vec.x, vec.z))));
                targetPitch = clamp(targetPitch, -89.0F, 89.0F);
                if (attack) {
                    float yawDelta1 = wrapDegrees(targetYaw - rotateVector.x);
                    float pitchDelta1 = wrapDegrees(targetPitch - rotateVector.y);
                    float baseSpeed = 95f;
                    float accelFactor = 3.5f;
                    float snapSpeed = baseSpeed * (1 + Math.min(Math.abs(yawDelta1) / 90f, 1) * (accelFactor - 1));
                    float snapFactor = Math.min(1.0f, snapSpeed / Math.max(1.0f, Math.abs(yawDelta1)));
                    float snapYaw = rotateVector.x + yawDelta1 * snapFactor;
                    snapSpeed = baseSpeed * (1 + Math.min(Math.abs(pitchDelta) / 90f, 1) * (accelFactor - 1));
                    snapFactor = Math.min(1.0f, snapSpeed / Math.max(1.0f, Math.abs(pitchDelta1)));
                    float snapPitch = rotateVector.y + pitchDelta1 * snapFactor;
                    if (Math.abs(wrapDegrees(targetYaw - snapYaw)) < 0.1f) {
                        snapYaw = targetYaw;
                    }
                    if (Math.abs(wrapDegrees(targetPitch - snapPitch)) < 0.1f) {
                        snapPitch = targetPitch;
                    }
                    rotateVector = new Vector2f(snapYaw, snapPitch);
                } else {
                    float returnSpeed = 80f;
                    float yawDiff = wrapDegrees(currentYaw - rotateVector.x);
                    float pitchDiff = wrapDegrees(currentPitch - rotateVector.y);
                    float returnFactor = Math.min(1.0f, returnSpeed / Math.max(1.0f, Math.abs(yawDiff)));
                    float returnYaw = rotateVector.x + yawDiff * returnFactor;
                    returnFactor = Math.min(1.0f, returnSpeed / Math.max(1.0f, Math.abs(pitchDiff)));
                    float returnPitch = rotateVector.y + pitchDiff * returnFactor;
                    rotateVector = new Vector2f(returnYaw, returnPitch);
                }
                lastYaw = rotateVector.x;
                lastPitch = rotateVector.y;
                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = rotateVector.x;
                }
            }
        }
    }


    private void updateAttack() {
        selected = MouseUtil.getMouseOver(target, rotateVector.x, rotateVector.y, attackRange.get());

        if (options.getValueByName("Ускорять ротацию при атаке").get()) {
            updateRotation(true, 60, 35);
        }

        if ((selected == null || selected != target) && !mc.player.isElytraFlying()) {
            return;
        }

        if (mc.player.isBlocking() && options.getValueByName("Отжимать щит").get()) {
            mc.playerController.onStoppedUsingItem(mc.player);
        }

        stopWatch.setLastMS(500);
        mc.playerController.attackEntity(mc.player, target);
        mc.player.swingArm(Hand.MAIN_HAND);

        if (target instanceof PlayerEntity player && options.getValueByName("Ломать щит").get()) {
            breakShieldPlayer(player);
        }
    }

    private boolean shouldPlayerFalling() {
        boolean cancelReason = mc.player.isInWater() && mc.player.areEyesInFluid(FluidTags.WATER) || mc.player.isInLava() || mc.player.isOnLadder() || mc.player.isPassenger() || mc.player.abilities.isFlying;

        float attackStrength = mc.player.getCooledAttackStrength(options.getValueByName("Синхронизировать атаку с ТПС").get()
                ? Expensive.getInstance().getTpsCalc().getAdjustTicks() : 1.5f);

        if (attackStrength < 0.92f) {
            return false;
        }

        if (!cancelReason && options.getValueByName("Только криты").get()) {
            return !mc.player.isOnGround() && mc.player.fallDistance > 0;
        }

        return true;
    }

    private boolean isValid(LivingEntity entity) {
        if (entity instanceof ClientPlayerEntity) return false;

        if (entity.ticksExisted < 3) return false;
        if (mc.player.getDistanceEyePos(entity) > attackRange.get()) return false;

        if (entity instanceof PlayerEntity p) {
            if (AntiBot.isBot(entity)) {
                return false;
            }
            if (!targets.getValueByName("Друзья").get() && FriendStorage.isFriend(p.getName().getString())) {
                return false;
            }
            if (p.getName().getString().equalsIgnoreCase(mc.player.getName().getString())) return false;
        }

        if (entity instanceof PlayerEntity && !targets.getValueByName("Игроки").get()) {
            return false;
        }
        if (entity instanceof PlayerEntity && entity.getTotalArmorValue() == 0 && !targets.getValueByName("Голые").get()) {
            return false;
        }
        if (entity instanceof PlayerEntity && entity.isInvisible() && entity.getTotalArmorValue() == 0 && !targets.getValueByName("Голые невидимки").get()) {
            return false;
        }
        if (entity instanceof PlayerEntity && entity.isInvisible() && !targets.getValueByName("Невидимки").get()) {
            return false;
        }

        if (entity instanceof MonsterEntity && !targets.getValueByName("Мобы").get()) {
            return false;
        }
        if (entity instanceof AnimalEntity && !targets.getValueByName("Животные").get()) {
            return false;
        }

        return !entity.isInvulnerable() && entity.isAlive() && !(entity instanceof ArmorStandEntity);
    }

    private void breakShieldPlayer(PlayerEntity entity) {
        if (entity.isBlocking()) {
            int invSlot = InventoryUtil.getInstance().getAxeInInventory(false);
            int hotBarSlot = InventoryUtil.getInstance().getAxeInInventory(true);

            if (hotBarSlot == -1 && invSlot != -1) {
                int bestSlot = InventoryUtil.getInstance().findBestSlotInHotBar();
                mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, mc.player);
                mc.playerController.windowClick(0, bestSlot + 36, 0, ClickType.PICKUP, mc.player);

                mc.player.connection.sendPacket(new CHeldItemChangePacket(bestSlot));
                mc.playerController.attackEntity(mc.player, entity);
                mc.player.swingArm(Hand.MAIN_HAND);
                mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));

                mc.playerController.windowClick(0, bestSlot + 36, 0, ClickType.PICKUP, mc.player);
                mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, mc.player);
            }

            if (hotBarSlot != -1) {
                mc.player.connection.sendPacket(new CHeldItemChangePacket(hotBarSlot));
                mc.playerController.attackEntity(mc.player, entity);
                mc.player.swingArm(Hand.MAIN_HAND);
                mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
            }
        }
    }


    private void reset() {
        if (options.getValueByName("Коррекция движения").get()) {
            mc.player.rotationYawOffset = Integer.MIN_VALUE;
        }
        rotateVector = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
    }

    @Override
    public void onEnable() {
        super.onEnable();
        reset();
        target = null;
    }

    @Override
    public void onDisable() {
        super.onDisable();
        reset();
        stopWatch.setLastMS(0);
        target = null;
    }

    private double getEntityArmor(PlayerEntity entityPlayer2) {
        double d2 = 0.0;
        for (int i2 = 0; i2 < 4; ++i2) {
            ItemStack is = entityPlayer2.inventory.armorInventory.get(i2);
            if (!(is.getItem() instanceof ArmorItem)) continue;
            d2 += getProtectionLvl(is);
        }
        return d2;
    }

    private double getProtectionLvl(ItemStack stack) {
        if (stack.getItem() instanceof ArmorItem i) {
            double damageReduceAmount = i.getDamageReduceAmount();
            if (stack.isEnchanted()) {
                damageReduceAmount += (double) EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25;
            }
            return damageReduceAmount;
        }
        return 0;
    }

    private double getEntityHealth(LivingEntity ent) {
        if (ent instanceof PlayerEntity player) {
            return (double) (player.getHealth() + player.getAbsorptionAmount()) * (getEntityArmor(player) / 20.0);
        }
        return ent.getHealth() + ent.getAbsorptionAmount();
    }
}
Я УМРУ ПОКА ОДБРЯТ
case "HW" -&gt; {<br> float yaw;<br> float pitch;<br> if (attack &amp;&amp; selected != target &amp;&amp; options.getValueByName("Ускорять ротацию при атаке").get()) {<br> yaw = rotateVector.x + yawDelta;<br> pitch = clamp(rotateVector.y + pitchDelta, -89.0F, 89.0F);<br> } else {<br> float yawSpeed = Math.min(Math.max(Math.abs(yawDelta), 1.0f), rotationYawSpeed * 2.0f);<br> float pitchSpeed = Math.min(Math.max(Math.abs(pitchDelta), 1.0f), rotationPitchSpeed * 2.0f);<br> yaw = rotateVector.x + (yawDelta &gt; 0 ? yawSpeed : -yawSpeed);<br> pitch = clamp(rotateVector.y + (pitchDelta &gt; 0 ? pitchSpeed : -pitchSpeed), -89.0F, 89.0F);<br> }<br> float twitchIntensity = 0.15f;<br> float twitchFrequency = 0.03f;<br> if (mc.player.ticksExisted % Math.max(1, (int) (twitchFrequency * 15)) == 0) {<br> yaw += (float) (Math.random() - 0.5) * twitchIntensity;<br> pitch += (float) (Math.random() - 0.5) * twitchIntensity;<br> }<br> yaw += (float) (Math.random() - 0.5) * 0.03f;<br> pitch += (float) (Math.random() - 0.5) * 0.03f;<br> float gcd = SensUtils.getGCDValue();<br> float gcdRandomizer = (float) (Math.random() * 0.008f + 0.996f);<br> yaw -= (yaw - rotateVector.x) % (gcd * gcdRandomizer);<br> pitch -= (pitch - rotateVector.y) % (gcd * gcdRandomizer);<br> float maxYawChange = 40.0f;<br> float maxPitchChange = 35.0f;<br> yaw = rotateVector.x + clamp(yaw - rotateVector.x, -maxYawChange, maxYawChange);<br> pitch = clamp(rotateVector.y + clamp(pitch - rotateVector.y, -maxPitchChange, maxPitchChange), -89.0F, 89.0F);<br> rotateVector = new Vector2f(yaw, pitch);<br> lastYaw = yaw;<br> lastPitch = pitch;<br> if (options.getValueByName("Коррекция движения").get()) {<br> mc.player.rotationYawOffset = yaw;<br> }<br> }

Это что за пиздец я тебя понял
 
Назад
Сверху Снизу