Исходник Слив KillAura под фт | EXP 2.0

Начинающий
Статус
Оффлайн
Регистрация
12 Фев 2023
Сообщения
33
Реакции[?]
0
Поинты[?]
1K

Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:

  • бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
  • маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
  • приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
  • обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.

Спасибо!

Всем дарова сегодня у нас на сливе Киллка под фт Exp 2.0 делал с помощью чат гпт можете юзать нормальное воркает под фт. Также сделана нормальное ограничение фов и рендер круга)
KillAura:
@FunctionAnnotation(name = "Aura", type = Type.Combat)
public class AuraFunction extends Function {
    public static LivingEntity target = null;
    public Vector2f rotation = new Vector2f(0, 0);
    public Vector2f rotate = new Vector2f(0.0F, 0.0F);
    private final ModeSetting rotationMode = new ModeSetting("Обход античита", "Funtime", new String[]{"Funtime", "Funtime Snap"});
    private final ModeSetting sprintMode = new ModeSetting("Обход спринта", "Grim", new String[]{"Grim", "Intave"});
    private final ModeSetting sortMode = new ModeSetting("Сортировать", "По всему", new String[]{"По всему", "По здоровью", "По дистанции"});
    private final MultiBoxSetting targets = new MultiBoxSetting("Цели", new BooleanOption("Игроки", true), new BooleanOption("Голые", true), new BooleanOption("Мобы", false), new BooleanOption("Животные", false), new BooleanOption("Друзья", false), new BooleanOption("Голые невидимки", true), new BooleanOption("Невидимки", true));
    private final SliderSetting distance = new SliderSetting("Дистанция аттаки", 3, 2, 6, 1);
    private final SliderSetting rotateDistance = new SliderSetting("Дистанция ротации", 0.5f, 0, 3, 1).setVisible(() -> !rotationMode.is("Снапы"));
public final BooleanOption fovCircleOption = new BooleanOption("Fov круг", false);
    public final MultiBoxSetting settings = new MultiBoxSetting("Настройки", new BooleanOption[]{new BooleanOption("Только критами", true), new BooleanOption("Коррекция движения", true), new BooleanOption("Отжимать щит", true), new BooleanOption("Ломать щит", true), new BooleanOption("Синхронизация с TPS", false), new BooleanOption("Только с пробелом", false), new BooleanOption("Бить через шит", true), new BooleanOption("Бить через стены", true), new BooleanOption("Резольвер", true), new BooleanOption("Криты в воде", true)});
    private final BooleanOption silent = (new BooleanOption("Дистанция под Grim", true)).setVisible(() -> {
        return this.settings.get(1);
    });
    private final BooleanOption space = (new BooleanOption("Смарт Криты", true)).setVisible(() -> {
        return this.settings.get(0);
    });
    private final BooleanOption randomCriticals = (new BooleanOption("Рандом Удары", true)).setVisible(() -> {
        return this.settings.get(0);
    });
    int ticksUntilNextAttack;
    private boolean hasRotated;
    private long cpsLimit = 0L;
    private double prevCircleStep;
    private double circleStep;
    private static boolean targetHit;
    public Vector2f clientRot = null;

    public AuraFunction() {
        addSettings(targets, rotationMode, sortMode, space, randomCriticals, fovCircleOption, sprintMode, distance, rotateDistance, settings, silent);
    }
    public void onEvent(Event event) {
        if (event instanceof EventInteractEntity) {
            EventInteractEntity entity = (EventInteractEntity) event;
            if (target != null) {
                entity.setCancel(true);
            }
        }

        if (event instanceof EventInput) {
            EventInput eventInput = (EventInput) event;

            // Проверка настроек
            if (this.settings.get(1) && this.silent.get()) {
                float rotationYaw = 0.0F; // Значение по умолчанию

                // Проверяем активность autoPotion
                if (Managment.FUNCTION_MANAGER != null
                        && Managment.FUNCTION_MANAGER.autoPotionFunction != null
                        && Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
                    if (Minecraft.getInstance() != null && Minecraft.getInstance().player != null) {
                        rotationYaw = Minecraft.getInstance().player.rotationYaw;
                    } else {
                        System.err.println("Ошибка: Minecraft или player не инициализированы!");
                    }
                } else if (this.rotate != null) {
                    rotationYaw = this.rotate.x;
                } else {
                    System.err.println("Ошибка: rotate не инициализирован!");
                }

                // Исправляем движение
                MoveUtil.fixMovement(eventInput, rotationYaw);
            }
        }


        if (event instanceof EventUpdate) {
            EventUpdate updateEvent = (EventUpdate) event;
            if (target == null || !this.isValidTarget(target)) {
                target = this.findTarget();
            }

            if (target == null) {
                this.cpsLimit = System.currentTimeMillis();
                Minecraft var10003 = mc;
                Minecraft var10004 = mc;
                this.rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
                return;
            }

            this.attackAndRotateOnEntity(target);
        }

        if (event instanceof EventMotion) {
            EventMotion motionEvent = (EventMotion) event;
            this.handleMotionEvent(motionEvent);
        }

        if (event instanceof EventRender) {
            EventRender e = (EventRender) event;
            if (e.isRender3D() && target != null && this.settings.get(4)) {
                this.drawCircle(target, e);
            }
            this.renderFOVCircle(); // Вызываем рендер круга
        }
    }

    private void drawCircle(LivingEntity target, EventRender e) {
    }


    private void handleMotionEvent(EventMotion motionEvent) {
        if (target != null && !Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
            motionEvent.setYaw(this.rotate.x);
            motionEvent.setPitch(this.rotate.y);
            Minecraft var10000 = mc;
            mc.player.rotationYawHead = this.rotate.x;
            var10000 = mc;
            mc.player.renderYawOffset = calculateCorrectYawOffset(this.rotate.x);
            var10000 = mc;
            mc.player.rotationPitchHead = this.rotate.y;
        }
    }

    private void attackAndRotateOnEntity(LivingEntity target) {
        this.hasRotated = false;

        switch(this.rotationMode.getIndex()) {
            case 0:
                this.hasRotated = false;
                if (this.shouldAttack(target) && RayTraceUtil.getMouseOver(target, this.rotate.x, this.rotate.y, (double)this.distance.getValue().floatValue()) == target && !Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
                    this.attackTarget(target);
                }

                if (!this.hasRotated) {
                    this.setRotation(target, false);
                }
                break;
            case 1:
                if (this.shouldAttack(target) && !Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
                    this.attackTarget(target);
                    this.ticksUntilNextAttack = 4;
                }

                if (this.shouldAttack(target)) {
                    // Проверяем, находится ли цель в поле зрения
                    float targetYaw = (float) Math.toDegrees(Math.atan2(target.getPosZ() - mc.player.getPosZ(), target.getPosX() - mc.player.getPosX())) - 90.0F;

                    if (isInFOV(targetYaw, 360.0F)) { // Условие: цель должна быть в пределах 360°
                        this.attackTarget(target);

                    }
                }

                if (this.ticksUntilNextAttack > 1) {
                    this.setRotation(target, false);
                    --this.ticksUntilNextAttack;
                } else {
                    Minecraft var10001 = mc;
                    this.rotate.x = mc.player.rotationYaw;
                    var10001 = mc;
                    this.rotate.y = mc.player.rotationPitch;
                }
        }

    }

    public static float calculateCorrectYawOffset(float yaw) {
        Minecraft var10000 = mc;
        double var9 = mc.player.getPosX();
        Minecraft var10001 = mc;
        double xDiff = var9 - mc.player.prevPosX;
        var10000 = mc;
        var9 = mc.player.getPosZ();
        var10001 = mc;
        double zDiff = var9 - mc.player.prevPosZ;
        float distSquared = (float)(xDiff * xDiff + zDiff * zDiff);
        var10000 = mc;
        float renderYawOffset = mc.player.prevRenderYawOffset;
        float offset = renderYawOffset;
        if (distSquared > 0.0025000002F) {
            offset = (float)MathHelper.atan2(zDiff, xDiff) * 180.0F / 3.1415927F - 180.0F;
        }

        var10000 = mc;
        if (mc.player != null) {
            var10000 = mc;
            if (mc.player.swingProgress > 0.0F) {
                offset = yaw;
            }
        }

        float yawOffsetDiff = MathHelper.wrapDegrees(yaw - (renderYawOffset + MathHelper.wrapDegrees(offset - renderYawOffset) * 0.3F));
        yawOffsetDiff = MathHelper.clamp(yawOffsetDiff, -90.0F, 90.0F);
        renderYawOffset = yaw - yawOffsetDiff;
        if (yawOffsetDiff * yawOffsetDiff > 2500.0F) {
            renderYawOffset += yawOffsetDiff * 0.2F;
        }

        return renderYawOffset;
    }

    private void attackTarget(LivingEntity target) {
        if (mc.player.isHandActive() && randomCriticals.get()) return;

        if (randomCriticals.get() && mc.player.isBlocking()) {
            mc.playerController.onStoppedUsingItem(mc.player);
        }

      {
            if (mc.player.serverSprintState && mc.gameSettings.keyBindForward.isKeyDown()) {
                mc.player.setSprinting(false);
                mc.gameSettings.keyBindSprint.setPressed(false);
                mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.STOP_SPRINTING));


                {
                    mc.player.setSprinting(true);
                    mc.gameSettings.keyBindSprint.setPressed(true);
                    mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.START_SPRINTING));
                }
            }
            }







        long lastAttackTime = 0;
        int attackCycleStep = 0;
        int[] cpsIntervals = {500, 520, 494, 498};
        int[] cpsCycles = {3, 2, 2, 4};


        long currentTime = System.currentTimeMillis();

        if (currentTime >= lastAttackTime + cpsIntervals[attackCycleStep]) {

            lastAttackTime = currentTime;


            cpsLimit = System.currentTimeMillis() + cpsIntervals[attackCycleStep];

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


            if (--cpsCycles[attackCycleStep] <= 0) {

                attackCycleStep = (attackCycleStep + 1) % cpsIntervals.length; // Цикличность

                cpsCycles[attackCycleStep] = attackCycleStep == 0 ? 3 : (attackCycleStep == 1 ? 2 : (attackCycleStep == 2 ? 2 : 4));
            }

            if (AuraFunction.target instanceof PlayerEntity playerEntity && settings.get(3)) {
                breakShield(playerEntity);

            }}}

    private void breakShieldAndSwapSlot() {
        LivingEntity targetEntity = target;
        if (targetEntity instanceof PlayerEntity) {
            PlayerEntity player = (PlayerEntity)targetEntity;
            if (target.isActiveItemStackBlocking(2) && !player.isSpectator() && !player.isCreative() && (target.getHeldItemOffhand().getItem() == Items.SHIELD || target.getHeldItemMainhand().getItem() == Items.SHIELD)) {
                int slot = this.breakShield(player);
                if (slot > 8) {
                    mc.playerController.pickItem(slot);
                }
            }
        }

    }

    public int breakShield(LivingEntity target) {

        Minecraft var10000;
        Minecraft var10001;
        {
            var10000 = mc;

            var10001 = mc;
            mc.playerController.attackEntity(mc.player, target);
            var10000 = mc;
            mc.player.swingArm(Hand.MAIN_HAND);
            var10000 = mc;
            Minecraft var10003 = mc;
            mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));

        }  {

            {
                var10001 = mc;
                mc.playerController.attackEntity(mc.player, target);
                var10000 = mc;
                mc.player.swingArm(Hand.MAIN_HAND);

            }  {
                return -1;
            }
        }
    }

    private boolean shouldAttack(LivingEntity targetEntity) {
        // Проверяем, включена ли настройка "Бить через стены"
        boolean canAttackThroughWalls = this.settings.get(7); // Индекс 7 соответствует "Бить через стены"

        // Проверяем дистанцию
        float maxHorizontalDistance = 3.0F; // Максимальная горизонтальная дистанция
        double distance = this.getDistance(targetEntity);

        // Проверяем, может ли игрок видеть цель
        boolean canSeeTarget = mc.player.canEntityBeSeen(targetEntity);

        // Проверяем, находится ли цель в пределах FOV
        boolean isInFOV = this.isInFOV(this.getYawToTarget(targetEntity), 90.0F); // Здесь 90 - угол FOV

        // Условие атаки
        if (distance <= maxHorizontalDistance &&
                isInFOV && // Добавлено условие на FOV
                (canAttackThroughWalls || canSeeTarget)) {
            return this.canAttack() && targetEntity != null && this.cpsLimit <= System.currentTimeMillis();
        }
        return false;
    }

    private float getYawToTarget(LivingEntity target) {
        double diffX = target.getPosX() - mc.player.getPosX();
        double diffZ = target.getPosZ() - mc.player.getPosZ();
        return (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F;
    }



    private void setRotation(LivingEntity base, boolean attack) {
        this.hasRotated = true;

        // Get the vector from the player to the target
        Vector3d targetVec = AuraUtil.getVector(base);
        double diffX = targetVec.x;
        double diffY = targetVec.y;
        double diffZ = targetVec.z;

        // Calculate yaw and pitch (yaw controls left/right, pitch controls up/down)
        float targetYaw = (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F;
        float targetPitch = (float) (-Math.toDegrees(Math.atan2(diffY, Math.hypot(diffX, diffZ))));

        // Increase the FOV, for example 180 degrees for a full horizontal cone
        if (isInFOV(targetYaw, 230)) {  // Test with 180 degrees or 270
            if (attack) {
                // Start attacking if the target is within the larger FOV
                startAttack(base);
            }
        } else {
            return; // If outside FOV, do not attack
        }



        // Limit rotation speed to prevent snapping
        float deltaYaw = MathHelper.wrapDegrees(targetYaw - this.rotate.x);
        float deltaPitch = targetPitch - this.rotate.y;

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

        // Final yaw and pitch values, applying smoothing based on speed limits
        float finalYaw = this.rotate.x + (deltaYaw > 0.0F ? limitedYaw : -limitedYaw);
        float finalPitch = MathHelper.clamp(this.rotate.y + (deltaPitch > 0.0F ? limitedPitch : -limitedPitch), -90.0F, 90.0F);

        // Smooth the yaw and pitch transitions
        float gcd = GCDUtil.getGCDValue();
        finalYaw = (float) ((double) finalYaw - (double) (finalYaw - this.rotate.x) % (double) gcd);
        finalPitch = (float) ((double) finalPitch - (double) (finalPitch - this.rotate.y) % (double) gcd);

        this.rotate.x = finalYaw;
        this.rotate.y = finalPitch;
    }

    private void reset() {
        rotation = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
    }

    private boolean isInFOV(float targetYaw, float fov) {
        float playerYaw = this.rotate.x;
        float angleDiff = MathHelper.wrapDegrees(targetYaw - playerYaw);

        return Math.abs(angleDiff) <= fov / 2.0F;
    }



    private void startAttack(LivingEntity target) {
        System.out.println("Атака на цель: " + target.getName().getString());
    }




    private boolean canAttack() {
        boolean onSpace = space.get() && mc.player.isOnGround() && !mc.gameSettings.keyBindJump.isKeyDown();
        boolean reasonForAttack = mc.player.isPotionActive(Effects.LEVITATION) || mc.player.isPotionActive(Effects.BLINDNESS) || mc.player.isPotionActive(Effects.SLOW_FALLING) || mc.player.isOnLadder() || mc.player.isInWater() && mc.player.areEyesInFluid(FluidTags.WATER) || mc.player.isInLava() && mc.player.areEyesInFluid(FluidTags.LAVA) || mc.player.isPassenger() || mc.player.abilities.isFlying || mc.player.isElytraFlying() || mc.player.isSwimming();

        if (mc.player.getDistance(target) > distance.getValue().floatValue() || mc.player.getCooledAttackStrength(1.5f) < 0.93f - (randomCriticals.get() ? Math.random() * 0.05 : 0)) return false;
        if (!reasonForAttack && settings.get(0)) return onSpace || !mc.player.isOnGround() && mc.player.fallDistance > 0;

        return true;
    }

    private LivingEntity findTarget() {
        List<LivingEntity> targets = new ArrayList();
        Iterator var2 = mc.world.getAllEntities().iterator();

        while(var2.hasNext()) {
            Entity entity = (Entity)var2.next();
            if (entity instanceof LivingEntity && this.isValidTarget((LivingEntity)entity)) {
                targets.add((LivingEntity)entity);
            }
        }

        if (targets.isEmpty()) {
            return null;
        } else {
            if (targets.size() > 1) {
                String var4 = this.sortMode.get();
                byte var5 = -1;
                switch(var4.hashCode()) {
                    case -697210061:
                        if (var4.equals("По дистанции")) {
                            var5 = 1;
                        }
                        break;
                    case -178236820:
                        if (var4.equals("По всему")) {
                            var5 = 0;
                        }
                        break;
                    case 460219158:
                        if (var4.equals("По здоровью")) {
                            var5 = 2;
                        }
                }

                switch(var5) {
                    case 0:
                        targets.sort(Comparator.comparingDouble((target) -> {
                            if (target instanceof PlayerEntity) {
                                PlayerEntity player = (PlayerEntity)target;
                                return -this.getEntityArmor(player);
                            } else if (target instanceof LivingEntity) {
                                LivingEntity livingEntity = (LivingEntity)target;
                                return (double)(-livingEntity.getTotalArmorValue());
                            } else {
                                return 0.0D;
                            }
                        }).thenComparing((o, o1) -> {
                            double health = this.getEntityHealth((LivingEntity)o);
                            double health1 = this.getEntityHealth((LivingEntity)o1);
                            return Double.compare(health, health1);
                        }).thenComparing((object, object2) -> {
                            double d2 = this.getDistance((LivingEntity)object);
                            double d3 = this.getDistance((LivingEntity)object2);
                            return Double.compare(d2, d3);
                        }));
                        break;
                    case 1:
                        AuraFunction var6 = Managment.FUNCTION_MANAGER.auraFunction;
                        Objects.requireNonNull(var6);
                        targets.sort(Comparator.comparingDouble(var6::getDistance).thenComparingDouble(this::getEntityHealth));
                        break;
                    case 2:
                        Comparator var10001 = Comparator.comparingDouble(this::getEntityHealth);
                        Minecraft var10002 = mc;
                        ClientPlayerEntity var7 = mc.player;
                        Objects.requireNonNull(var7);
                        //targets.sort(getDistance(target));
                }
            } else {
                this.cpsLimit = System.currentTimeMillis();
            }

            return (LivingEntity)targets.get(0);
        }
    }

    private boolean isValidTarget(LivingEntity base) {
        if (base == null || base.getShouldBeDead() || !base.isAlive()) {
            return false;
        }

        if (base == mc.player) {
            return false;
        }

        // Проверка на друга
        if (base instanceof PlayerEntity) {
            String playerName = base.getName().getString();
            if (Managment.FRIEND_MANAGER != null && Managment.FRIEND_MANAGER.isFriend(playerName)) {
                return false;
            }

            PlayerEntity player = (PlayerEntity) base;

     
            boolean isInvisible = player.isInvisible();
            boolean isNaked = player.getTotalArmorValue() == 0;

            if (isInvisible && isNaked && !this.targets.get(5)) { // "Голые невидимки"
                return false;
            }

            if (isInvisible && !isNaked && !this.targets.get(6)) { // "Обычные невидимки"
                return false;
            }

            if (!isInvisible && isNaked && !this.targets.get(1)) { // "Голые"
                return false;
            }

            if (!this.targets.get(0)) { // Игроки
                return false;
            }
        }

        if (base instanceof MobEntity || base instanceof AnimalEntity) {
            return this.targets.get(3);
        }

        // Проверяем видимость и расстояние
        Vector3d vec3d = AuraUtil.getVector(base);
        Vector3d playerVec = mc.player.getLookVec();

        if (vec3d == null || playerVec == null) {
            return false;
        }

        double playerLength = playerVec.length();
        double targetLength = vec3d.length();

        if (playerLength == 0 || targetLength == 0) {
            return false;
        }

        double dotProduct = playerVec.dotProduct(vec3d);
        double angleCos = dotProduct / (playerLength * targetLength);

        if (angleCos < 0.866 || !mc.player.canEntityBeSeen(base)) {
            return false;
        }

        return this.getDistance(base) <= (double) (this.distance.getValue().floatValue()
                + (this.rotationMode.is("Matrix") ? this.rotateDistance.getValue().floatValue() : 0.0F));
    }



    private boolean isNakedPlayer(PlayerEntity player) {
   
        for (ItemStack armor : player.inventory.armorInventory) {
            if (!armor.isEmpty()) {
                return false;
            }
        }
        return true;
    }



    public static void onAttack(LivingEntity target) {
        if (target != null) {
            targetHit = true;
        }
    }


    public static boolean isTargetHit() {
        if (targetHit) {
            targetHit = false;
            return true;
        }
        return false;
    }


    private void renderFOVCircle() {
        if (!fovCircleOption.get()) {
            return;
        }

        int screenWidth = mc.getMainWindow().getScaledWidth();
        int screenHeight = mc.getMainWindow().getScaledHeight();


        int centerX = screenWidth / 2;
        int centerY = screenHeight / 2;
        int radius = 86;

        RenderSystem.disableTexture();
        RenderSystem.enableBlend();
        RenderSystem.defaultBlendFunc();

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);

        GL11.glLineWidth(1.0F);

        GL11.glBegin(GL11.GL_LINE_LOOP);
        for (int i = 0; i <= 360; i += 5) {
            double angle = Math.toRadians(i);
            double x = centerX + Math.cos(angle) * radius;
            double y = centerY + Math.sin(angle) * radius;
            GL11.glVertex2d(x, y);
        }
        GL11.glEnd();

   
        RenderSystem.enableTexture();
        RenderSystem.disableBlend();
    }




    private double getDistance(LivingEntity entity) {
        return AuraUtil.getVector(entity).length();
    }

    public double getEntityArmor(PlayerEntity target) {
        double totalArmor = 0.0D;
        Iterator var4 = target.inventory.armorInventory.iterator();

        while(var4.hasNext()) {
            ItemStack armorStack = (ItemStack)var4.next();
            if (armorStack != null && armorStack.getItem() instanceof ArmorItem) {
                totalArmor += this.getProtectionLvl(armorStack);
            }
        }

        return totalArmor;
    }

    public double getEntityHealth(Entity ent) {
        if (ent instanceof PlayerEntity) {
            PlayerEntity player = (PlayerEntity)ent;
            double armorValue = this.getEntityArmor(player) / 20.0D;
            return (double)(player.getHealth() + player.getAbsorptionAmount()) * armorValue;
        } else if (ent instanceof LivingEntity) {
            LivingEntity livingEntity = (LivingEntity)ent;
            return (double)(livingEntity.getHealth() + livingEntity.getAbsorptionAmount());
        } else {
            return 0.0D;
        }
    }

    private double getProtectionLvl(ItemStack stack) {
        ArmorItem armor = (ArmorItem)stack.getItem();
        double damageReduce = (double)armor.getDamageReduceAmount();
        if (stack.isEnchanted()) {
            damageReduce += (double)EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25D;
        }

        return damageReduce;
    }

    public void onDisable() {
        Minecraft var10003 = mc;
        Minecraft var10004 = mc;
        this.rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
        target = null;
        this.cpsLimit = System.currentTimeMillis();
        super.onDisable();
    }

    public static LivingEntity getTarget() {
        return target;
    }
}
 
Начинающий
Статус
Онлайн
Регистрация
26 Янв 2023
Сообщения
301
Реакции[?]
1
Поинты[?]
1K
Всем дарова сегодня у нас на сливе Киллка под фт Exp 2.0 делал с помощью чат гпт можете юзать нормальное воркает под фт. Также сделана нормальное ограничение фов и рендер круга)
KillAura:
@FunctionAnnotation(name = "Aura", type = Type.Combat)
public class AuraFunction extends Function {
    public static LivingEntity target = null;
    public Vector2f rotation = new Vector2f(0, 0);
    public Vector2f rotate = new Vector2f(0.0F, 0.0F);
    private final ModeSetting rotationMode = new ModeSetting("Обход античита", "Funtime", new String[]{"Funtime", "Funtime Snap"});
    private final ModeSetting sprintMode = new ModeSetting("Обход спринта", "Grim", new String[]{"Grim", "Intave"});
    private final ModeSetting sortMode = new ModeSetting("Сортировать", "По всему", new String[]{"По всему", "По здоровью", "По дистанции"});
    private final MultiBoxSetting targets = new MultiBoxSetting("Цели", new BooleanOption("Игроки", true), new BooleanOption("Голые", true), new BooleanOption("Мобы", false), new BooleanOption("Животные", false), new BooleanOption("Друзья", false), new BooleanOption("Голые невидимки", true), new BooleanOption("Невидимки", true));
    private final SliderSetting distance = new SliderSetting("Дистанция аттаки", 3, 2, 6, 1);
    private final SliderSetting rotateDistance = new SliderSetting("Дистанция ротации", 0.5f, 0, 3, 1).setVisible(() -> !rotationMode.is("Снапы"));
public final BooleanOption fovCircleOption = new BooleanOption("Fov круг", false);
    public final MultiBoxSetting settings = new MultiBoxSetting("Настройки", new BooleanOption[]{new BooleanOption("Только критами", true), new BooleanOption("Коррекция движения", true), new BooleanOption("Отжимать щит", true), new BooleanOption("Ломать щит", true), new BooleanOption("Синхронизация с TPS", false), new BooleanOption("Только с пробелом", false), new BooleanOption("Бить через шит", true), new BooleanOption("Бить через стены", true), new BooleanOption("Резольвер", true), new BooleanOption("Криты в воде", true)});
    private final BooleanOption silent = (new BooleanOption("Дистанция под Grim", true)).setVisible(() -> {
        return this.settings.get(1);
    });
    private final BooleanOption space = (new BooleanOption("Смарт Криты", true)).setVisible(() -> {
        return this.settings.get(0);
    });
    private final BooleanOption randomCriticals = (new BooleanOption("Рандом Удары", true)).setVisible(() -> {
        return this.settings.get(0);
    });
    int ticksUntilNextAttack;
    private boolean hasRotated;
    private long cpsLimit = 0L;
    private double prevCircleStep;
    private double circleStep;
    private static boolean targetHit;
    public Vector2f clientRot = null;

    public AuraFunction() {
        addSettings(targets, rotationMode, sortMode, space, randomCriticals, fovCircleOption, sprintMode, distance, rotateDistance, settings, silent);
    }
    public void onEvent(Event event) {
        if (event instanceof EventInteractEntity) {
            EventInteractEntity entity = (EventInteractEntity) event;
            if (target != null) {
                entity.setCancel(true);
            }
        }

        if (event instanceof EventInput) {
            EventInput eventInput = (EventInput) event;

            // Проверка настроек
            if (this.settings.get(1) && this.silent.get()) {
                float rotationYaw = 0.0F; // Значение по умолчанию

                // Проверяем активность autoPotion
                if (Managment.FUNCTION_MANAGER != null
                        && Managment.FUNCTION_MANAGER.autoPotionFunction != null
                        && Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
                    if (Minecraft.getInstance() != null && Minecraft.getInstance().player != null) {
                        rotationYaw = Minecraft.getInstance().player.rotationYaw;
                    } else {
                        System.err.println("Ошибка: Minecraft или player не инициализированы!");
                    }
                } else if (this.rotate != null) {
                    rotationYaw = this.rotate.x;
                } else {
                    System.err.println("Ошибка: rotate не инициализирован!");
                }

                // Исправляем движение
                MoveUtil.fixMovement(eventInput, rotationYaw);
            }
        }


        if (event instanceof EventUpdate) {
            EventUpdate updateEvent = (EventUpdate) event;
            if (target == null || !this.isValidTarget(target)) {
                target = this.findTarget();
            }

            if (target == null) {
                this.cpsLimit = System.currentTimeMillis();
                Minecraft var10003 = mc;
                Minecraft var10004 = mc;
                this.rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
                return;
            }

            this.attackAndRotateOnEntity(target);
        }

        if (event instanceof EventMotion) {
            EventMotion motionEvent = (EventMotion) event;
            this.handleMotionEvent(motionEvent);
        }

        if (event instanceof EventRender) {
            EventRender e = (EventRender) event;
            if (e.isRender3D() && target != null && this.settings.get(4)) {
                this.drawCircle(target, e);
            }
            this.renderFOVCircle(); // Вызываем рендер круга
        }
    }

    private void drawCircle(LivingEntity target, EventRender e) {
    }


    private void handleMotionEvent(EventMotion motionEvent) {
        if (target != null && !Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
            motionEvent.setYaw(this.rotate.x);
            motionEvent.setPitch(this.rotate.y);
            Minecraft var10000 = mc;
            mc.player.rotationYawHead = this.rotate.x;
            var10000 = mc;
            mc.player.renderYawOffset = calculateCorrectYawOffset(this.rotate.x);
            var10000 = mc;
            mc.player.rotationPitchHead = this.rotate.y;
        }
    }

    private void attackAndRotateOnEntity(LivingEntity target) {
        this.hasRotated = false;

        switch(this.rotationMode.getIndex()) {
            case 0:
                this.hasRotated = false;
                if (this.shouldAttack(target) && RayTraceUtil.getMouseOver(target, this.rotate.x, this.rotate.y, (double)this.distance.getValue().floatValue()) == target && !Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
                    this.attackTarget(target);
                }

                if (!this.hasRotated) {
                    this.setRotation(target, false);
                }
                break;
            case 1:
                if (this.shouldAttack(target) && !Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
                    this.attackTarget(target);
                    this.ticksUntilNextAttack = 4;
                }

                if (this.shouldAttack(target)) {
                    // Проверяем, находится ли цель в поле зрения
                    float targetYaw = (float) Math.toDegrees(Math.atan2(target.getPosZ() - mc.player.getPosZ(), target.getPosX() - mc.player.getPosX())) - 90.0F;

                    if (isInFOV(targetYaw, 360.0F)) { // Условие: цель должна быть в пределах 360°
                        this.attackTarget(target);

                    }
                }

                if (this.ticksUntilNextAttack > 1) {
                    this.setRotation(target, false);
                    --this.ticksUntilNextAttack;
                } else {
                    Minecraft var10001 = mc;
                    this.rotate.x = mc.player.rotationYaw;
                    var10001 = mc;
                    this.rotate.y = mc.player.rotationPitch;
                }
        }

    }

    public static float calculateCorrectYawOffset(float yaw) {
        Minecraft var10000 = mc;
        double var9 = mc.player.getPosX();
        Minecraft var10001 = mc;
        double xDiff = var9 - mc.player.prevPosX;
        var10000 = mc;
        var9 = mc.player.getPosZ();
        var10001 = mc;
        double zDiff = var9 - mc.player.prevPosZ;
        float distSquared = (float)(xDiff * xDiff + zDiff * zDiff);
        var10000 = mc;
        float renderYawOffset = mc.player.prevRenderYawOffset;
        float offset = renderYawOffset;
        if (distSquared > 0.0025000002F) {
            offset = (float)MathHelper.atan2(zDiff, xDiff) * 180.0F / 3.1415927F - 180.0F;
        }

        var10000 = mc;
        if (mc.player != null) {
            var10000 = mc;
            if (mc.player.swingProgress > 0.0F) {
                offset = yaw;
            }
        }

        float yawOffsetDiff = MathHelper.wrapDegrees(yaw - (renderYawOffset + MathHelper.wrapDegrees(offset - renderYawOffset) * 0.3F));
        yawOffsetDiff = MathHelper.clamp(yawOffsetDiff, -90.0F, 90.0F);
        renderYawOffset = yaw - yawOffsetDiff;
        if (yawOffsetDiff * yawOffsetDiff > 2500.0F) {
            renderYawOffset += yawOffsetDiff * 0.2F;
        }

        return renderYawOffset;
    }

    private void attackTarget(LivingEntity target) {
        if (mc.player.isHandActive() && randomCriticals.get()) return;

        if (randomCriticals.get() && mc.player.isBlocking()) {
            mc.playerController.onStoppedUsingItem(mc.player);
        }

      {
            if (mc.player.serverSprintState && mc.gameSettings.keyBindForward.isKeyDown()) {
                mc.player.setSprinting(false);
                mc.gameSettings.keyBindSprint.setPressed(false);
                mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.STOP_SPRINTING));


                {
                    mc.player.setSprinting(true);
                    mc.gameSettings.keyBindSprint.setPressed(true);
                    mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.START_SPRINTING));
                }
            }
            }







        long lastAttackTime = 0;
        int attackCycleStep = 0;
        int[] cpsIntervals = {500, 520, 494, 498};
        int[] cpsCycles = {3, 2, 2, 4};


        long currentTime = System.currentTimeMillis();

        if (currentTime >= lastAttackTime + cpsIntervals[attackCycleStep]) {

            lastAttackTime = currentTime;


            cpsLimit = System.currentTimeMillis() + cpsIntervals[attackCycleStep];

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


            if (--cpsCycles[attackCycleStep] <= 0) {

                attackCycleStep = (attackCycleStep + 1) % cpsIntervals.length; // Цикличность

                cpsCycles[attackCycleStep] = attackCycleStep == 0 ? 3 : (attackCycleStep == 1 ? 2 : (attackCycleStep == 2 ? 2 : 4));
            }

            if (AuraFunction.target instanceof PlayerEntity playerEntity && settings.get(3)) {
                breakShield(playerEntity);

            }}}

    private void breakShieldAndSwapSlot() {
        LivingEntity targetEntity = target;
        if (targetEntity instanceof PlayerEntity) {
            PlayerEntity player = (PlayerEntity)targetEntity;
            if (target.isActiveItemStackBlocking(2) && !player.isSpectator() && !player.isCreative() && (target.getHeldItemOffhand().getItem() == Items.SHIELD || target.getHeldItemMainhand().getItem() == Items.SHIELD)) {
                int slot = this.breakShield(player);
                if (slot > 8) {
                    mc.playerController.pickItem(slot);
                }
            }
        }

    }

    public int breakShield(LivingEntity target) {

        Minecraft var10000;
        Minecraft var10001;
        {
            var10000 = mc;

            var10001 = mc;
            mc.playerController.attackEntity(mc.player, target);
            var10000 = mc;
            mc.player.swingArm(Hand.MAIN_HAND);
            var10000 = mc;
            Minecraft var10003 = mc;
            mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));

        }  {

            {
                var10001 = mc;
                mc.playerController.attackEntity(mc.player, target);
                var10000 = mc;
                mc.player.swingArm(Hand.MAIN_HAND);

            }  {
                return -1;
            }
        }
    }

    private boolean shouldAttack(LivingEntity targetEntity) {
        // Проверяем, включена ли настройка "Бить через стены"
        boolean canAttackThroughWalls = this.settings.get(7); // Индекс 7 соответствует "Бить через стены"

        // Проверяем дистанцию
        float maxHorizontalDistance = 3.0F; // Максимальная горизонтальная дистанция
        double distance = this.getDistance(targetEntity);

        // Проверяем, может ли игрок видеть цель
        boolean canSeeTarget = mc.player.canEntityBeSeen(targetEntity);

        // Проверяем, находится ли цель в пределах FOV
        boolean isInFOV = this.isInFOV(this.getYawToTarget(targetEntity), 90.0F); // Здесь 90 - угол FOV

        // Условие атаки
        if (distance <= maxHorizontalDistance &&
                isInFOV && // Добавлено условие на FOV
                (canAttackThroughWalls || canSeeTarget)) {
            return this.canAttack() && targetEntity != null && this.cpsLimit <= System.currentTimeMillis();
        }
        return false;
    }

    private float getYawToTarget(LivingEntity target) {
        double diffX = target.getPosX() - mc.player.getPosX();
        double diffZ = target.getPosZ() - mc.player.getPosZ();
        return (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F;
    }



    private void setRotation(LivingEntity base, boolean attack) {
        this.hasRotated = true;

        // Get the vector from the player to the target
        Vector3d targetVec = AuraUtil.getVector(base);
        double diffX = targetVec.x;
        double diffY = targetVec.y;
        double diffZ = targetVec.z;

        // Calculate yaw and pitch (yaw controls left/right, pitch controls up/down)
        float targetYaw = (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F;
        float targetPitch = (float) (-Math.toDegrees(Math.atan2(diffY, Math.hypot(diffX, diffZ))));

        // Increase the FOV, for example 180 degrees for a full horizontal cone
        if (isInFOV(targetYaw, 230)) {  // Test with 180 degrees or 270
            if (attack) {
                // Start attacking if the target is within the larger FOV
                startAttack(base);
            }
        } else {
            return; // If outside FOV, do not attack
        }



        // Limit rotation speed to prevent snapping
        float deltaYaw = MathHelper.wrapDegrees(targetYaw - this.rotate.x);
        float deltaPitch = targetPitch - this.rotate.y;

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

        // Final yaw and pitch values, applying smoothing based on speed limits
        float finalYaw = this.rotate.x + (deltaYaw > 0.0F ? limitedYaw : -limitedYaw);
        float finalPitch = MathHelper.clamp(this.rotate.y + (deltaPitch > 0.0F ? limitedPitch : -limitedPitch), -90.0F, 90.0F);

        // Smooth the yaw and pitch transitions
        float gcd = GCDUtil.getGCDValue();
        finalYaw = (float) ((double) finalYaw - (double) (finalYaw - this.rotate.x) % (double) gcd);
        finalPitch = (float) ((double) finalPitch - (double) (finalPitch - this.rotate.y) % (double) gcd);

        this.rotate.x = finalYaw;
        this.rotate.y = finalPitch;
    }

    private void reset() {
        rotation = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
    }

    private boolean isInFOV(float targetYaw, float fov) {
        float playerYaw = this.rotate.x;
        float angleDiff = MathHelper.wrapDegrees(targetYaw - playerYaw);

        return Math.abs(angleDiff) <= fov / 2.0F;
    }



    private void startAttack(LivingEntity target) {
        System.out.println("Атака на цель: " + target.getName().getString());
    }




    private boolean canAttack() {
        boolean onSpace = space.get() && mc.player.isOnGround() && !mc.gameSettings.keyBindJump.isKeyDown();
        boolean reasonForAttack = mc.player.isPotionActive(Effects.LEVITATION) || mc.player.isPotionActive(Effects.BLINDNESS) || mc.player.isPotionActive(Effects.SLOW_FALLING) || mc.player.isOnLadder() || mc.player.isInWater() && mc.player.areEyesInFluid(FluidTags.WATER) || mc.player.isInLava() && mc.player.areEyesInFluid(FluidTags.LAVA) || mc.player.isPassenger() || mc.player.abilities.isFlying || mc.player.isElytraFlying() || mc.player.isSwimming();

        if (mc.player.getDistance(target) > distance.getValue().floatValue() || mc.player.getCooledAttackStrength(1.5f) < 0.93f - (randomCriticals.get() ? Math.random() * 0.05 : 0)) return false;
        if (!reasonForAttack && settings.get(0)) return onSpace || !mc.player.isOnGround() && mc.player.fallDistance > 0;

        return true;
    }

    private LivingEntity findTarget() {
        List<LivingEntity> targets = new ArrayList();
        Iterator var2 = mc.world.getAllEntities().iterator();

        while(var2.hasNext()) {
            Entity entity = (Entity)var2.next();
            if (entity instanceof LivingEntity && this.isValidTarget((LivingEntity)entity)) {
                targets.add((LivingEntity)entity);
            }
        }

        if (targets.isEmpty()) {
            return null;
        } else {
            if (targets.size() > 1) {
                String var4 = this.sortMode.get();
                byte var5 = -1;
                switch(var4.hashCode()) {
                    case -697210061:
                        if (var4.equals("По дистанции")) {
                            var5 = 1;
                        }
                        break;
                    case -178236820:
                        if (var4.equals("По всему")) {
                            var5 = 0;
                        }
                        break;
                    case 460219158:
                        if (var4.equals("По здоровью")) {
                            var5 = 2;
                        }
                }

                switch(var5) {
                    case 0:
                        targets.sort(Comparator.comparingDouble((target) -> {
                            if (target instanceof PlayerEntity) {
                                PlayerEntity player = (PlayerEntity)target;
                                return -this.getEntityArmor(player);
                            } else if (target instanceof LivingEntity) {
                                LivingEntity livingEntity = (LivingEntity)target;
                                return (double)(-livingEntity.getTotalArmorValue());
                            } else {
                                return 0.0D;
                            }
                        }).thenComparing((o, o1) -> {
                            double health = this.getEntityHealth((LivingEntity)o);
                            double health1 = this.getEntityHealth((LivingEntity)o1);
                            return Double.compare(health, health1);
                        }).thenComparing((object, object2) -> {
                            double d2 = this.getDistance((LivingEntity)object);
                            double d3 = this.getDistance((LivingEntity)object2);
                            return Double.compare(d2, d3);
                        }));
                        break;
                    case 1:
                        AuraFunction var6 = Managment.FUNCTION_MANAGER.auraFunction;
                        Objects.requireNonNull(var6);
                        targets.sort(Comparator.comparingDouble(var6::getDistance).thenComparingDouble(this::getEntityHealth));
                        break;
                    case 2:
                        Comparator var10001 = Comparator.comparingDouble(this::getEntityHealth);
                        Minecraft var10002 = mc;
                        ClientPlayerEntity var7 = mc.player;
                        Objects.requireNonNull(var7);
                        //targets.sort(getDistance(target));
                }
            } else {
                this.cpsLimit = System.currentTimeMillis();
            }

            return (LivingEntity)targets.get(0);
        }
    }

    private boolean isValidTarget(LivingEntity base) {
        if (base == null || base.getShouldBeDead() || !base.isAlive()) {
            return false;
        }

        if (base == mc.player) {
            return false;
        }

        // Проверка на друга
        if (base instanceof PlayerEntity) {
            String playerName = base.getName().getString();
            if (Managment.FRIEND_MANAGER != null && Managment.FRIEND_MANAGER.isFriend(playerName)) {
                return false;
            }

            PlayerEntity player = (PlayerEntity) base;

    
            boolean isInvisible = player.isInvisible();
            boolean isNaked = player.getTotalArmorValue() == 0;

            if (isInvisible && isNaked && !this.targets.get(5)) { // "Голые невидимки"
                return false;
            }

            if (isInvisible && !isNaked && !this.targets.get(6)) { // "Обычные невидимки"
                return false;
            }

            if (!isInvisible && isNaked && !this.targets.get(1)) { // "Голые"
                return false;
            }

            if (!this.targets.get(0)) { // Игроки
                return false;
            }
        }

        if (base instanceof MobEntity || base instanceof AnimalEntity) {
            return this.targets.get(3);
        }

        // Проверяем видимость и расстояние
        Vector3d vec3d = AuraUtil.getVector(base);
        Vector3d playerVec = mc.player.getLookVec();

        if (vec3d == null || playerVec == null) {
            return false;
        }

        double playerLength = playerVec.length();
        double targetLength = vec3d.length();

        if (playerLength == 0 || targetLength == 0) {
            return false;
        }

        double dotProduct = playerVec.dotProduct(vec3d);
        double angleCos = dotProduct / (playerLength * targetLength);

        if (angleCos < 0.866 || !mc.player.canEntityBeSeen(base)) {
            return false;
        }

        return this.getDistance(base) <= (double) (this.distance.getValue().floatValue()
                + (this.rotationMode.is("Matrix") ? this.rotateDistance.getValue().floatValue() : 0.0F));
    }



    private boolean isNakedPlayer(PlayerEntity player) {
  
        for (ItemStack armor : player.inventory.armorInventory) {
            if (!armor.isEmpty()) {
                return false;
            }
        }
        return true;
    }



    public static void onAttack(LivingEntity target) {
        if (target != null) {
            targetHit = true;
        }
    }


    public static boolean isTargetHit() {
        if (targetHit) {
            targetHit = false;
            return true;
        }
        return false;
    }


    private void renderFOVCircle() {
        if (!fovCircleOption.get()) {
            return;
        }

        int screenWidth = mc.getMainWindow().getScaledWidth();
        int screenHeight = mc.getMainWindow().getScaledHeight();


        int centerX = screenWidth / 2;
        int centerY = screenHeight / 2;
        int radius = 86;

        RenderSystem.disableTexture();
        RenderSystem.enableBlend();
        RenderSystem.defaultBlendFunc();

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);

        GL11.glLineWidth(1.0F);

        GL11.glBegin(GL11.GL_LINE_LOOP);
        for (int i = 0; i <= 360; i += 5) {
            double angle = Math.toRadians(i);
            double x = centerX + Math.cos(angle) * radius;
            double y = centerY + Math.sin(angle) * radius;
            GL11.glVertex2d(x, y);
        }
        GL11.glEnd();

  
        RenderSystem.enableTexture();
        RenderSystem.disableBlend();
    }




    private double getDistance(LivingEntity entity) {
        return AuraUtil.getVector(entity).length();
    }

    public double getEntityArmor(PlayerEntity target) {
        double totalArmor = 0.0D;
        Iterator var4 = target.inventory.armorInventory.iterator();

        while(var4.hasNext()) {
            ItemStack armorStack = (ItemStack)var4.next();
            if (armorStack != null && armorStack.getItem() instanceof ArmorItem) {
                totalArmor += this.getProtectionLvl(armorStack);
            }
        }

        return totalArmor;
    }

    public double getEntityHealth(Entity ent) {
        if (ent instanceof PlayerEntity) {
            PlayerEntity player = (PlayerEntity)ent;
            double armorValue = this.getEntityArmor(player) / 20.0D;
            return (double)(player.getHealth() + player.getAbsorptionAmount()) * armorValue;
        } else if (ent instanceof LivingEntity) {
            LivingEntity livingEntity = (LivingEntity)ent;
            return (double)(livingEntity.getHealth() + livingEntity.getAbsorptionAmount());
        } else {
            return 0.0D;
        }
    }

    private double getProtectionLvl(ItemStack stack) {
        ArmorItem armor = (ArmorItem)stack.getItem();
        double damageReduce = (double)armor.getDamageReduceAmount();
        if (stack.isEnchanted()) {
            damageReduce += (double)EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25D;
        }

        return damageReduce;
    }

    public void onDisable() {
        Minecraft var10003 = mc;
        Minecraft var10004 = mc;
        this.rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
        target = null;
        this.cpsLimit = System.currentTimeMillis();
        super.onDisable();
    }

    public static LivingEntity getTarget() {
        return target;
    }
}
Var$$$
 
Начинающий
Статус
Оффлайн
Регистрация
26 Окт 2024
Сообщения
84
Реакции[?]
0
Поинты[?]
0
Всем дарова сегодня у нас на сливе Киллка под фт Exp 2.0 делал с помощью чат гпт можете юзать нормальное воркает под фт. Также сделана нормальное ограничение фов и рендер круга)
KillAura:
@FunctionAnnotation(name = "Aura", type = Type.Combat)
public class AuraFunction extends Function {
    public static LivingEntity target = null;
    public Vector2f rotation = new Vector2f(0, 0);
    public Vector2f rotate = new Vector2f(0.0F, 0.0F);
    private final ModeSetting rotationMode = new ModeSetting("Обход античита", "Funtime", new String[]{"Funtime", "Funtime Snap"});
    private final ModeSetting sprintMode = new ModeSetting("Обход спринта", "Grim", new String[]{"Grim", "Intave"});
    private final ModeSetting sortMode = new ModeSetting("Сортировать", "По всему", new String[]{"По всему", "По здоровью", "По дистанции"});
    private final MultiBoxSetting targets = new MultiBoxSetting("Цели", new BooleanOption("Игроки", true), new BooleanOption("Голые", true), new BooleanOption("Мобы", false), new BooleanOption("Животные", false), new BooleanOption("Друзья", false), new BooleanOption("Голые невидимки", true), new BooleanOption("Невидимки", true));
    private final SliderSetting distance = new SliderSetting("Дистанция аттаки", 3, 2, 6, 1);
    private final SliderSetting rotateDistance = new SliderSetting("Дистанция ротации", 0.5f, 0, 3, 1).setVisible(() -> !rotationMode.is("Снапы"));
public final BooleanOption fovCircleOption = new BooleanOption("Fov круг", false);
    public final MultiBoxSetting settings = new MultiBoxSetting("Настройки", new BooleanOption[]{new BooleanOption("Только критами", true), new BooleanOption("Коррекция движения", true), new BooleanOption("Отжимать щит", true), new BooleanOption("Ломать щит", true), new BooleanOption("Синхронизация с TPS", false), new BooleanOption("Только с пробелом", false), new BooleanOption("Бить через шит", true), new BooleanOption("Бить через стены", true), new BooleanOption("Резольвер", true), new BooleanOption("Криты в воде", true)});
    private final BooleanOption silent = (new BooleanOption("Дистанция под Grim", true)).setVisible(() -> {
        return this.settings.get(1);
    });
    private final BooleanOption space = (new BooleanOption("Смарт Криты", true)).setVisible(() -> {
        return this.settings.get(0);
    });
    private final BooleanOption randomCriticals = (new BooleanOption("Рандом Удары", true)).setVisible(() -> {
        return this.settings.get(0);
    });
    int ticksUntilNextAttack;
    private boolean hasRotated;
    private long cpsLimit = 0L;
    private double prevCircleStep;
    private double circleStep;
    private static boolean targetHit;
    public Vector2f clientRot = null;

    public AuraFunction() {
        addSettings(targets, rotationMode, sortMode, space, randomCriticals, fovCircleOption, sprintMode, distance, rotateDistance, settings, silent);
    }
    public void onEvent(Event event) {
        if (event instanceof EventInteractEntity) {
            EventInteractEntity entity = (EventInteractEntity) event;
            if (target != null) {
                entity.setCancel(true);
            }
        }

        if (event instanceof EventInput) {
            EventInput eventInput = (EventInput) event;

            // Проверка настроек
            if (this.settings.get(1) && this.silent.get()) {
                float rotationYaw = 0.0F; // Значение по умолчанию

                // Проверяем активность autoPotion
                if (Managment.FUNCTION_MANAGER != null
                        && Managment.FUNCTION_MANAGER.autoPotionFunction != null
                        && Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
                    if (Minecraft.getInstance() != null && Minecraft.getInstance().player != null) {
                        rotationYaw = Minecraft.getInstance().player.rotationYaw;
                    } else {
                        System.err.println("Ошибка: Minecraft или player не инициализированы!");
                    }
                } else if (this.rotate != null) {
                    rotationYaw = this.rotate.x;
                } else {
                    System.err.println("Ошибка: rotate не инициализирован!");
                }

                // Исправляем движение
                MoveUtil.fixMovement(eventInput, rotationYaw);
            }
        }


        if (event instanceof EventUpdate) {
            EventUpdate updateEvent = (EventUpdate) event;
            if (target == null || !this.isValidTarget(target)) {
                target = this.findTarget();
            }

            if (target == null) {
                this.cpsLimit = System.currentTimeMillis();
                Minecraft var10003 = mc;
                Minecraft var10004 = mc;
                this.rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
                return;
            }

            this.attackAndRotateOnEntity(target);
        }

        if (event instanceof EventMotion) {
            EventMotion motionEvent = (EventMotion) event;
            this.handleMotionEvent(motionEvent);
        }

        if (event instanceof EventRender) {
            EventRender e = (EventRender) event;
            if (e.isRender3D() && target != null && this.settings.get(4)) {
                this.drawCircle(target, e);
            }
            this.renderFOVCircle(); // Вызываем рендер круга
        }
    }

    private void drawCircle(LivingEntity target, EventRender e) {
    }


    private void handleMotionEvent(EventMotion motionEvent) {
        if (target != null && !Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
            motionEvent.setYaw(this.rotate.x);
            motionEvent.setPitch(this.rotate.y);
            Minecraft var10000 = mc;
            mc.player.rotationYawHead = this.rotate.x;
            var10000 = mc;
            mc.player.renderYawOffset = calculateCorrectYawOffset(this.rotate.x);
            var10000 = mc;
            mc.player.rotationPitchHead = this.rotate.y;
        }
    }

    private void attackAndRotateOnEntity(LivingEntity target) {
        this.hasRotated = false;

        switch(this.rotationMode.getIndex()) {
            case 0:
                this.hasRotated = false;
                if (this.shouldAttack(target) && RayTraceUtil.getMouseOver(target, this.rotate.x, this.rotate.y, (double)this.distance.getValue().floatValue()) == target && !Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
                    this.attackTarget(target);
                }

                if (!this.hasRotated) {
                    this.setRotation(target, false);
                }
                break;
            case 1:
                if (this.shouldAttack(target) && !Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
                    this.attackTarget(target);
                    this.ticksUntilNextAttack = 4;
                }

                if (this.shouldAttack(target)) {
                    // Проверяем, находится ли цель в поле зрения
                    float targetYaw = (float) Math.toDegrees(Math.atan2(target.getPosZ() - mc.player.getPosZ(), target.getPosX() - mc.player.getPosX())) - 90.0F;

                    if (isInFOV(targetYaw, 360.0F)) { // Условие: цель должна быть в пределах 360°
                        this.attackTarget(target);

                    }
                }

                if (this.ticksUntilNextAttack > 1) {
                    this.setRotation(target, false);
                    --this.ticksUntilNextAttack;
                } else {
                    Minecraft var10001 = mc;
                    this.rotate.x = mc.player.rotationYaw;
                    var10001 = mc;
                    this.rotate.y = mc.player.rotationPitch;
                }
        }

    }

    public static float calculateCorrectYawOffset(float yaw) {
        Minecraft var10000 = mc;
        double var9 = mc.player.getPosX();
        Minecraft var10001 = mc;
        double xDiff = var9 - mc.player.prevPosX;
        var10000 = mc;
        var9 = mc.player.getPosZ();
        var10001 = mc;
        double zDiff = var9 - mc.player.prevPosZ;
        float distSquared = (float)(xDiff * xDiff + zDiff * zDiff);
        var10000 = mc;
        float renderYawOffset = mc.player.prevRenderYawOffset;
        float offset = renderYawOffset;
        if (distSquared > 0.0025000002F) {
            offset = (float)MathHelper.atan2(zDiff, xDiff) * 180.0F / 3.1415927F - 180.0F;
        }

        var10000 = mc;
        if (mc.player != null) {
            var10000 = mc;
            if (mc.player.swingProgress > 0.0F) {
                offset = yaw;
            }
        }

        float yawOffsetDiff = MathHelper.wrapDegrees(yaw - (renderYawOffset + MathHelper.wrapDegrees(offset - renderYawOffset) * 0.3F));
        yawOffsetDiff = MathHelper.clamp(yawOffsetDiff, -90.0F, 90.0F);
        renderYawOffset = yaw - yawOffsetDiff;
        if (yawOffsetDiff * yawOffsetDiff > 2500.0F) {
            renderYawOffset += yawOffsetDiff * 0.2F;
        }

        return renderYawOffset;
    }

    private void attackTarget(LivingEntity target) {
        if (mc.player.isHandActive() && randomCriticals.get()) return;

        if (randomCriticals.get() && mc.player.isBlocking()) {
            mc.playerController.onStoppedUsingItem(mc.player);
        }

      {
            if (mc.player.serverSprintState && mc.gameSettings.keyBindForward.isKeyDown()) {
                mc.player.setSprinting(false);
                mc.gameSettings.keyBindSprint.setPressed(false);
                mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.STOP_SPRINTING));


                {
                    mc.player.setSprinting(true);
                    mc.gameSettings.keyBindSprint.setPressed(true);
                    mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.START_SPRINTING));
                }
            }
            }







        long lastAttackTime = 0;
        int attackCycleStep = 0;
        int[] cpsIntervals = {500, 520, 494, 498};
        int[] cpsCycles = {3, 2, 2, 4};


        long currentTime = System.currentTimeMillis();

        if (currentTime >= lastAttackTime + cpsIntervals[attackCycleStep]) {

            lastAttackTime = currentTime;


            cpsLimit = System.currentTimeMillis() + cpsIntervals[attackCycleStep];

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


            if (--cpsCycles[attackCycleStep] <= 0) {

                attackCycleStep = (attackCycleStep + 1) % cpsIntervals.length; // Цикличность

                cpsCycles[attackCycleStep] = attackCycleStep == 0 ? 3 : (attackCycleStep == 1 ? 2 : (attackCycleStep == 2 ? 2 : 4));
            }

            if (AuraFunction.target instanceof PlayerEntity playerEntity && settings.get(3)) {
                breakShield(playerEntity);

            }}}

    private void breakShieldAndSwapSlot() {
        LivingEntity targetEntity = target;
        if (targetEntity instanceof PlayerEntity) {
            PlayerEntity player = (PlayerEntity)targetEntity;
            if (target.isActiveItemStackBlocking(2) && !player.isSpectator() && !player.isCreative() && (target.getHeldItemOffhand().getItem() == Items.SHIELD || target.getHeldItemMainhand().getItem() == Items.SHIELD)) {
                int slot = this.breakShield(player);
                if (slot > 8) {
                    mc.playerController.pickItem(slot);
                }
            }
        }

    }

    public int breakShield(LivingEntity target) {

        Minecraft var10000;
        Minecraft var10001;
        {
            var10000 = mc;

            var10001 = mc;
            mc.playerController.attackEntity(mc.player, target);
            var10000 = mc;
            mc.player.swingArm(Hand.MAIN_HAND);
            var10000 = mc;
            Minecraft var10003 = mc;
            mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));

        }  {

            {
                var10001 = mc;
                mc.playerController.attackEntity(mc.player, target);
                var10000 = mc;
                mc.player.swingArm(Hand.MAIN_HAND);

            }  {
                return -1;
            }
        }
    }

    private boolean shouldAttack(LivingEntity targetEntity) {
        // Проверяем, включена ли настройка "Бить через стены"
        boolean canAttackThroughWalls = this.settings.get(7); // Индекс 7 соответствует "Бить через стены"

        // Проверяем дистанцию
        float maxHorizontalDistance = 3.0F; // Максимальная горизонтальная дистанция
        double distance = this.getDistance(targetEntity);

        // Проверяем, может ли игрок видеть цель
        boolean canSeeTarget = mc.player.canEntityBeSeen(targetEntity);

        // Проверяем, находится ли цель в пределах FOV
        boolean isInFOV = this.isInFOV(this.getYawToTarget(targetEntity), 90.0F); // Здесь 90 - угол FOV

        // Условие атаки
        if (distance <= maxHorizontalDistance &&
                isInFOV && // Добавлено условие на FOV
                (canAttackThroughWalls || canSeeTarget)) {
            return this.canAttack() && targetEntity != null && this.cpsLimit <= System.currentTimeMillis();
        }
        return false;
    }

    private float getYawToTarget(LivingEntity target) {
        double diffX = target.getPosX() - mc.player.getPosX();
        double diffZ = target.getPosZ() - mc.player.getPosZ();
        return (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F;
    }



    private void setRotation(LivingEntity base, boolean attack) {
        this.hasRotated = true;

        // Get the vector from the player to the target
        Vector3d targetVec = AuraUtil.getVector(base);
        double diffX = targetVec.x;
        double diffY = targetVec.y;
        double diffZ = targetVec.z;

        // Calculate yaw and pitch (yaw controls left/right, pitch controls up/down)
        float targetYaw = (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F;
        float targetPitch = (float) (-Math.toDegrees(Math.atan2(diffY, Math.hypot(diffX, diffZ))));

        // Increase the FOV, for example 180 degrees for a full horizontal cone
        if (isInFOV(targetYaw, 230)) {  // Test with 180 degrees or 270
            if (attack) {
                // Start attacking if the target is within the larger FOV
                startAttack(base);
            }
        } else {
            return; // If outside FOV, do not attack
        }



        // Limit rotation speed to prevent snapping
        float deltaYaw = MathHelper.wrapDegrees(targetYaw - this.rotate.x);
        float deltaPitch = targetPitch - this.rotate.y;

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

        // Final yaw and pitch values, applying smoothing based on speed limits
        float finalYaw = this.rotate.x + (deltaYaw > 0.0F ? limitedYaw : -limitedYaw);
        float finalPitch = MathHelper.clamp(this.rotate.y + (deltaPitch > 0.0F ? limitedPitch : -limitedPitch), -90.0F, 90.0F);

        // Smooth the yaw and pitch transitions
        float gcd = GCDUtil.getGCDValue();
        finalYaw = (float) ((double) finalYaw - (double) (finalYaw - this.rotate.x) % (double) gcd);
        finalPitch = (float) ((double) finalPitch - (double) (finalPitch - this.rotate.y) % (double) gcd);

        this.rotate.x = finalYaw;
        this.rotate.y = finalPitch;
    }

    private void reset() {
        rotation = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
    }

    private boolean isInFOV(float targetYaw, float fov) {
        float playerYaw = this.rotate.x;
        float angleDiff = MathHelper.wrapDegrees(targetYaw - playerYaw);

        return Math.abs(angleDiff) <= fov / 2.0F;
    }



    private void startAttack(LivingEntity target) {
        System.out.println("Атака на цель: " + target.getName().getString());
    }




    private boolean canAttack() {
        boolean onSpace = space.get() && mc.player.isOnGround() && !mc.gameSettings.keyBindJump.isKeyDown();
        boolean reasonForAttack = mc.player.isPotionActive(Effects.LEVITATION) || mc.player.isPotionActive(Effects.BLINDNESS) || mc.player.isPotionActive(Effects.SLOW_FALLING) || mc.player.isOnLadder() || mc.player.isInWater() && mc.player.areEyesInFluid(FluidTags.WATER) || mc.player.isInLava() && mc.player.areEyesInFluid(FluidTags.LAVA) || mc.player.isPassenger() || mc.player.abilities.isFlying || mc.player.isElytraFlying() || mc.player.isSwimming();

        if (mc.player.getDistance(target) > distance.getValue().floatValue() || mc.player.getCooledAttackStrength(1.5f) < 0.93f - (randomCriticals.get() ? Math.random() * 0.05 : 0)) return false;
        if (!reasonForAttack && settings.get(0)) return onSpace || !mc.player.isOnGround() && mc.player.fallDistance > 0;

        return true;
    }

    private LivingEntity findTarget() {
        List<LivingEntity> targets = new ArrayList();
        Iterator var2 = mc.world.getAllEntities().iterator();

        while(var2.hasNext()) {
            Entity entity = (Entity)var2.next();
            if (entity instanceof LivingEntity && this.isValidTarget((LivingEntity)entity)) {
                targets.add((LivingEntity)entity);
            }
        }

        if (targets.isEmpty()) {
            return null;
        } else {
            if (targets.size() > 1) {
                String var4 = this.sortMode.get();
                byte var5 = -1;
                switch(var4.hashCode()) {
                    case -697210061:
                        if (var4.equals("По дистанции")) {
                            var5 = 1;
                        }
                        break;
                    case -178236820:
                        if (var4.equals("По всему")) {
                            var5 = 0;
                        }
                        break;
                    case 460219158:
                        if (var4.equals("По здоровью")) {
                            var5 = 2;
                        }
                }

                switch(var5) {
                    case 0:
                        targets.sort(Comparator.comparingDouble((target) -> {
                            if (target instanceof PlayerEntity) {
                                PlayerEntity player = (PlayerEntity)target;
                                return -this.getEntityArmor(player);
                            } else if (target instanceof LivingEntity) {
                                LivingEntity livingEntity = (LivingEntity)target;
                                return (double)(-livingEntity.getTotalArmorValue());
                            } else {
                                return 0.0D;
                            }
                        }).thenComparing((o, o1) -> {
                            double health = this.getEntityHealth((LivingEntity)o);
                            double health1 = this.getEntityHealth((LivingEntity)o1);
                            return Double.compare(health, health1);
                        }).thenComparing((object, object2) -> {
                            double d2 = this.getDistance((LivingEntity)object);
                            double d3 = this.getDistance((LivingEntity)object2);
                            return Double.compare(d2, d3);
                        }));
                        break;
                    case 1:
                        AuraFunction var6 = Managment.FUNCTION_MANAGER.auraFunction;
                        Objects.requireNonNull(var6);
                        targets.sort(Comparator.comparingDouble(var6::getDistance).thenComparingDouble(this::getEntityHealth));
                        break;
                    case 2:
                        Comparator var10001 = Comparator.comparingDouble(this::getEntityHealth);
                        Minecraft var10002 = mc;
                        ClientPlayerEntity var7 = mc.player;
                        Objects.requireNonNull(var7);
                        //targets.sort(getDistance(target));
                }
            } else {
                this.cpsLimit = System.currentTimeMillis();
            }

            return (LivingEntity)targets.get(0);
        }
    }

    private boolean isValidTarget(LivingEntity base) {
        if (base == null || base.getShouldBeDead() || !base.isAlive()) {
            return false;
        }

        if (base == mc.player) {
            return false;
        }

        // Проверка на друга
        if (base instanceof PlayerEntity) {
            String playerName = base.getName().getString();
            if (Managment.FRIEND_MANAGER != null && Managment.FRIEND_MANAGER.isFriend(playerName)) {
                return false;
            }

            PlayerEntity player = (PlayerEntity) base;

    
            boolean isInvisible = player.isInvisible();
            boolean isNaked = player.getTotalArmorValue() == 0;

            if (isInvisible && isNaked && !this.targets.get(5)) { // "Голые невидимки"
                return false;
            }

            if (isInvisible && !isNaked && !this.targets.get(6)) { // "Обычные невидимки"
                return false;
            }

            if (!isInvisible && isNaked && !this.targets.get(1)) { // "Голые"
                return false;
            }

            if (!this.targets.get(0)) { // Игроки
                return false;
            }
        }

        if (base instanceof MobEntity || base instanceof AnimalEntity) {
            return this.targets.get(3);
        }

        // Проверяем видимость и расстояние
        Vector3d vec3d = AuraUtil.getVector(base);
        Vector3d playerVec = mc.player.getLookVec();

        if (vec3d == null || playerVec == null) {
            return false;
        }

        double playerLength = playerVec.length();
        double targetLength = vec3d.length();

        if (playerLength == 0 || targetLength == 0) {
            return false;
        }

        double dotProduct = playerVec.dotProduct(vec3d);
        double angleCos = dotProduct / (playerLength * targetLength);

        if (angleCos < 0.866 || !mc.player.canEntityBeSeen(base)) {
            return false;
        }

        return this.getDistance(base) <= (double) (this.distance.getValue().floatValue()
                + (this.rotationMode.is("Matrix") ? this.rotateDistance.getValue().floatValue() : 0.0F));
    }



    private boolean isNakedPlayer(PlayerEntity player) {
  
        for (ItemStack armor : player.inventory.armorInventory) {
            if (!armor.isEmpty()) {
                return false;
            }
        }
        return true;
    }



    public static void onAttack(LivingEntity target) {
        if (target != null) {
            targetHit = true;
        }
    }


    public static boolean isTargetHit() {
        if (targetHit) {
            targetHit = false;
            return true;
        }
        return false;
    }


    private void renderFOVCircle() {
        if (!fovCircleOption.get()) {
            return;
        }

        int screenWidth = mc.getMainWindow().getScaledWidth();
        int screenHeight = mc.getMainWindow().getScaledHeight();


        int centerX = screenWidth / 2;
        int centerY = screenHeight / 2;
        int radius = 86;

        RenderSystem.disableTexture();
        RenderSystem.enableBlend();
        RenderSystem.defaultBlendFunc();

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);

        GL11.glLineWidth(1.0F);

        GL11.glBegin(GL11.GL_LINE_LOOP);
        for (int i = 0; i <= 360; i += 5) {
            double angle = Math.toRadians(i);
            double x = centerX + Math.cos(angle) * radius;
            double y = centerY + Math.sin(angle) * radius;
            GL11.glVertex2d(x, y);
        }
        GL11.glEnd();

  
        RenderSystem.enableTexture();
        RenderSystem.disableBlend();
    }




    private double getDistance(LivingEntity entity) {
        return AuraUtil.getVector(entity).length();
    }

    public double getEntityArmor(PlayerEntity target) {
        double totalArmor = 0.0D;
        Iterator var4 = target.inventory.armorInventory.iterator();

        while(var4.hasNext()) {
            ItemStack armorStack = (ItemStack)var4.next();
            if (armorStack != null && armorStack.getItem() instanceof ArmorItem) {
                totalArmor += this.getProtectionLvl(armorStack);
            }
        }

        return totalArmor;
    }

    public double getEntityHealth(Entity ent) {
        if (ent instanceof PlayerEntity) {
            PlayerEntity player = (PlayerEntity)ent;
            double armorValue = this.getEntityArmor(player) / 20.0D;
            return (double)(player.getHealth() + player.getAbsorptionAmount()) * armorValue;
        } else if (ent instanceof LivingEntity) {
            LivingEntity livingEntity = (LivingEntity)ent;
            return (double)(livingEntity.getHealth() + livingEntity.getAbsorptionAmount());
        } else {
            return 0.0D;
        }
    }

    private double getProtectionLvl(ItemStack stack) {
        ArmorItem armor = (ArmorItem)stack.getItem();
        double damageReduce = (double)armor.getDamageReduceAmount();
        if (stack.isEnchanted()) {
            damageReduce += (double)EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25D;
        }

        return damageReduce;
    }

    public void onDisable() {
        Minecraft var10003 = mc;
        Minecraft var10004 = mc;
        this.rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
        target = null;
        this.cpsLimit = System.currentTimeMillis();
        super.onDisable();
    }

    public static LivingEntity getTarget() {
        return target;
    }
}
спасибо ты лучший
 
Начинающий
Статус
Оффлайн
Регистрация
8 Авг 2024
Сообщения
429
Реакции[?]
3
Поинты[?]
4K
Всем дарова сегодня у нас на сливе Киллка под фт Exp 2.0 делал с помощью чат гпт можете юзать нормальное воркает под фт. Также сделана нормальное ограничение фов и рендер круга)
KillAura:
@FunctionAnnotation(name = "Aura", type = Type.Combat)
public class AuraFunction extends Function {
    public static LivingEntity target = null;
    public Vector2f rotation = new Vector2f(0, 0);
    public Vector2f rotate = new Vector2f(0.0F, 0.0F);
    private final ModeSetting rotationMode = new ModeSetting("Обход античита", "Funtime", new String[]{"Funtime", "Funtime Snap"});
    private final ModeSetting sprintMode = new ModeSetting("Обход спринта", "Grim", new String[]{"Grim", "Intave"});
    private final ModeSetting sortMode = new ModeSetting("Сортировать", "По всему", new String[]{"По всему", "По здоровью", "По дистанции"});
    private final MultiBoxSetting targets = new MultiBoxSetting("Цели", new BooleanOption("Игроки", true), new BooleanOption("Голые", true), new BooleanOption("Мобы", false), new BooleanOption("Животные", false), new BooleanOption("Друзья", false), new BooleanOption("Голые невидимки", true), new BooleanOption("Невидимки", true));
    private final SliderSetting distance = new SliderSetting("Дистанция аттаки", 3, 2, 6, 1);
    private final SliderSetting rotateDistance = new SliderSetting("Дистанция ротации", 0.5f, 0, 3, 1).setVisible(() -> !rotationMode.is("Снапы"));
public final BooleanOption fovCircleOption = new BooleanOption("Fov круг", false);
    public final MultiBoxSetting settings = new MultiBoxSetting("Настройки", new BooleanOption[]{new BooleanOption("Только критами", true), new BooleanOption("Коррекция движения", true), new BooleanOption("Отжимать щит", true), new BooleanOption("Ломать щит", true), new BooleanOption("Синхронизация с TPS", false), new BooleanOption("Только с пробелом", false), new BooleanOption("Бить через шит", true), new BooleanOption("Бить через стены", true), new BooleanOption("Резольвер", true), new BooleanOption("Криты в воде", true)});
    private final BooleanOption silent = (new BooleanOption("Дистанция под Grim", true)).setVisible(() -> {
        return this.settings.get(1);
    });
    private final BooleanOption space = (new BooleanOption("Смарт Криты", true)).setVisible(() -> {
        return this.settings.get(0);
    });
    private final BooleanOption randomCriticals = (new BooleanOption("Рандом Удары", true)).setVisible(() -> {
        return this.settings.get(0);
    });
    int ticksUntilNextAttack;
    private boolean hasRotated;
    private long cpsLimit = 0L;
    private double prevCircleStep;
    private double circleStep;
    private static boolean targetHit;
    public Vector2f clientRot = null;

    public AuraFunction() {
        addSettings(targets, rotationMode, sortMode, space, randomCriticals, fovCircleOption, sprintMode, distance, rotateDistance, settings, silent);
    }
    public void onEvent(Event event) {
        if (event instanceof EventInteractEntity) {
            EventInteractEntity entity = (EventInteractEntity) event;
            if (target != null) {
                entity.setCancel(true);
            }
        }

        if (event instanceof EventInput) {
            EventInput eventInput = (EventInput) event;

            // Проверка настроек
            if (this.settings.get(1) && this.silent.get()) {
                float rotationYaw = 0.0F; // Значение по умолчанию

                // Проверяем активность autoPotion
                if (Managment.FUNCTION_MANAGER != null
                        && Managment.FUNCTION_MANAGER.autoPotionFunction != null
                        && Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
                    if (Minecraft.getInstance() != null && Minecraft.getInstance().player != null) {
                        rotationYaw = Minecraft.getInstance().player.rotationYaw;
                    } else {
                        System.err.println("Ошибка: Minecraft или player не инициализированы!");
                    }
                } else if (this.rotate != null) {
                    rotationYaw = this.rotate.x;
                } else {
                    System.err.println("Ошибка: rotate не инициализирован!");
                }

                // Исправляем движение
                MoveUtil.fixMovement(eventInput, rotationYaw);
            }
        }


        if (event instanceof EventUpdate) {
            EventUpdate updateEvent = (EventUpdate) event;
            if (target == null || !this.isValidTarget(target)) {
                target = this.findTarget();
            }

            if (target == null) {
                this.cpsLimit = System.currentTimeMillis();
                Minecraft var10003 = mc;
                Minecraft var10004 = mc;
                this.rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
                return;
            }

            this.attackAndRotateOnEntity(target);
        }

        if (event instanceof EventMotion) {
            EventMotion motionEvent = (EventMotion) event;
            this.handleMotionEvent(motionEvent);
        }

        if (event instanceof EventRender) {
            EventRender e = (EventRender) event;
            if (e.isRender3D() && target != null && this.settings.get(4)) {
                this.drawCircle(target, e);
            }
            this.renderFOVCircle(); // Вызываем рендер круга
        }
    }

    private void drawCircle(LivingEntity target, EventRender e) {
    }


    private void handleMotionEvent(EventMotion motionEvent) {
        if (target != null && !Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
            motionEvent.setYaw(this.rotate.x);
            motionEvent.setPitch(this.rotate.y);
            Minecraft var10000 = mc;
            mc.player.rotationYawHead = this.rotate.x;
            var10000 = mc;
            mc.player.renderYawOffset = calculateCorrectYawOffset(this.rotate.x);
            var10000 = mc;
            mc.player.rotationPitchHead = this.rotate.y;
        }
    }

    private void attackAndRotateOnEntity(LivingEntity target) {
        this.hasRotated = false;

        switch(this.rotationMode.getIndex()) {
            case 0:
                this.hasRotated = false;
                if (this.shouldAttack(target) && RayTraceUtil.getMouseOver(target, this.rotate.x, this.rotate.y, (double)this.distance.getValue().floatValue()) == target && !Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
                    this.attackTarget(target);
                }

                if (!this.hasRotated) {
                    this.setRotation(target, false);
                }
                break;
            case 1:
                if (this.shouldAttack(target) && !Managment.FUNCTION_MANAGER.autoPotionFunction.isActivePotion) {
                    this.attackTarget(target);
                    this.ticksUntilNextAttack = 4;
                }

                if (this.shouldAttack(target)) {
                    // Проверяем, находится ли цель в поле зрения
                    float targetYaw = (float) Math.toDegrees(Math.atan2(target.getPosZ() - mc.player.getPosZ(), target.getPosX() - mc.player.getPosX())) - 90.0F;

                    if (isInFOV(targetYaw, 360.0F)) { // Условие: цель должна быть в пределах 360°
                        this.attackTarget(target);

                    }
                }

                if (this.ticksUntilNextAttack > 1) {
                    this.setRotation(target, false);
                    --this.ticksUntilNextAttack;
                } else {
                    Minecraft var10001 = mc;
                    this.rotate.x = mc.player.rotationYaw;
                    var10001 = mc;
                    this.rotate.y = mc.player.rotationPitch;
                }
        }

    }

    public static float calculateCorrectYawOffset(float yaw) {
        Minecraft var10000 = mc;
        double var9 = mc.player.getPosX();
        Minecraft var10001 = mc;
        double xDiff = var9 - mc.player.prevPosX;
        var10000 = mc;
        var9 = mc.player.getPosZ();
        var10001 = mc;
        double zDiff = var9 - mc.player.prevPosZ;
        float distSquared = (float)(xDiff * xDiff + zDiff * zDiff);
        var10000 = mc;
        float renderYawOffset = mc.player.prevRenderYawOffset;
        float offset = renderYawOffset;
        if (distSquared > 0.0025000002F) {
            offset = (float)MathHelper.atan2(zDiff, xDiff) * 180.0F / 3.1415927F - 180.0F;
        }

        var10000 = mc;
        if (mc.player != null) {
            var10000 = mc;
            if (mc.player.swingProgress > 0.0F) {
                offset = yaw;
            }
        }

        float yawOffsetDiff = MathHelper.wrapDegrees(yaw - (renderYawOffset + MathHelper.wrapDegrees(offset - renderYawOffset) * 0.3F));
        yawOffsetDiff = MathHelper.clamp(yawOffsetDiff, -90.0F, 90.0F);
        renderYawOffset = yaw - yawOffsetDiff;
        if (yawOffsetDiff * yawOffsetDiff > 2500.0F) {
            renderYawOffset += yawOffsetDiff * 0.2F;
        }

        return renderYawOffset;
    }

    private void attackTarget(LivingEntity target) {
        if (mc.player.isHandActive() && randomCriticals.get()) return;

        if (randomCriticals.get() && mc.player.isBlocking()) {
            mc.playerController.onStoppedUsingItem(mc.player);
        }

      {
            if (mc.player.serverSprintState && mc.gameSettings.keyBindForward.isKeyDown()) {
                mc.player.setSprinting(false);
                mc.gameSettings.keyBindSprint.setPressed(false);
                mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.STOP_SPRINTING));


                {
                    mc.player.setSprinting(true);
                    mc.gameSettings.keyBindSprint.setPressed(true);
                    mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.START_SPRINTING));
                }
            }
            }







        long lastAttackTime = 0;
        int attackCycleStep = 0;
        int[] cpsIntervals = {500, 520, 494, 498};
        int[] cpsCycles = {3, 2, 2, 4};


        long currentTime = System.currentTimeMillis();

        if (currentTime >= lastAttackTime + cpsIntervals[attackCycleStep]) {

            lastAttackTime = currentTime;


            cpsLimit = System.currentTimeMillis() + cpsIntervals[attackCycleStep];

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


            if (--cpsCycles[attackCycleStep] <= 0) {

                attackCycleStep = (attackCycleStep + 1) % cpsIntervals.length; // Цикличность

                cpsCycles[attackCycleStep] = attackCycleStep == 0 ? 3 : (attackCycleStep == 1 ? 2 : (attackCycleStep == 2 ? 2 : 4));
            }

            if (AuraFunction.target instanceof PlayerEntity playerEntity && settings.get(3)) {
                breakShield(playerEntity);

            }}}

    private void breakShieldAndSwapSlot() {
        LivingEntity targetEntity = target;
        if (targetEntity instanceof PlayerEntity) {
            PlayerEntity player = (PlayerEntity)targetEntity;
            if (target.isActiveItemStackBlocking(2) && !player.isSpectator() && !player.isCreative() && (target.getHeldItemOffhand().getItem() == Items.SHIELD || target.getHeldItemMainhand().getItem() == Items.SHIELD)) {
                int slot = this.breakShield(player);
                if (slot > 8) {
                    mc.playerController.pickItem(slot);
                }
            }
        }

    }

    public int breakShield(LivingEntity target) {

        Minecraft var10000;
        Minecraft var10001;
        {
            var10000 = mc;

            var10001 = mc;
            mc.playerController.attackEntity(mc.player, target);
            var10000 = mc;
            mc.player.swingArm(Hand.MAIN_HAND);
            var10000 = mc;
            Minecraft var10003 = mc;
            mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));

        }  {

            {
                var10001 = mc;
                mc.playerController.attackEntity(mc.player, target);
                var10000 = mc;
                mc.player.swingArm(Hand.MAIN_HAND);

            }  {
                return -1;
            }
        }
    }

    private boolean shouldAttack(LivingEntity targetEntity) {
        // Проверяем, включена ли настройка "Бить через стены"
        boolean canAttackThroughWalls = this.settings.get(7); // Индекс 7 соответствует "Бить через стены"

        // Проверяем дистанцию
        float maxHorizontalDistance = 3.0F; // Максимальная горизонтальная дистанция
        double distance = this.getDistance(targetEntity);

        // Проверяем, может ли игрок видеть цель
        boolean canSeeTarget = mc.player.canEntityBeSeen(targetEntity);

        // Проверяем, находится ли цель в пределах FOV
        boolean isInFOV = this.isInFOV(this.getYawToTarget(targetEntity), 90.0F); // Здесь 90 - угол FOV

        // Условие атаки
        if (distance <= maxHorizontalDistance &&
                isInFOV && // Добавлено условие на FOV
                (canAttackThroughWalls || canSeeTarget)) {
            return this.canAttack() && targetEntity != null && this.cpsLimit <= System.currentTimeMillis();
        }
        return false;
    }

    private float getYawToTarget(LivingEntity target) {
        double diffX = target.getPosX() - mc.player.getPosX();
        double diffZ = target.getPosZ() - mc.player.getPosZ();
        return (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F;
    }



    private void setRotation(LivingEntity base, boolean attack) {
        this.hasRotated = true;

        // Get the vector from the player to the target
        Vector3d targetVec = AuraUtil.getVector(base);
        double diffX = targetVec.x;
        double diffY = targetVec.y;
        double diffZ = targetVec.z;

        // Calculate yaw and pitch (yaw controls left/right, pitch controls up/down)
        float targetYaw = (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F;
        float targetPitch = (float) (-Math.toDegrees(Math.atan2(diffY, Math.hypot(diffX, diffZ))));

        // Increase the FOV, for example 180 degrees for a full horizontal cone
        if (isInFOV(targetYaw, 230)) {  // Test with 180 degrees or 270
            if (attack) {
                // Start attacking if the target is within the larger FOV
                startAttack(base);
            }
        } else {
            return; // If outside FOV, do not attack
        }



        // Limit rotation speed to prevent snapping
        float deltaYaw = MathHelper.wrapDegrees(targetYaw - this.rotate.x);
        float deltaPitch = targetPitch - this.rotate.y;

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

        // Final yaw and pitch values, applying smoothing based on speed limits
        float finalYaw = this.rotate.x + (deltaYaw > 0.0F ? limitedYaw : -limitedYaw);
        float finalPitch = MathHelper.clamp(this.rotate.y + (deltaPitch > 0.0F ? limitedPitch : -limitedPitch), -90.0F, 90.0F);

        // Smooth the yaw and pitch transitions
        float gcd = GCDUtil.getGCDValue();
        finalYaw = (float) ((double) finalYaw - (double) (finalYaw - this.rotate.x) % (double) gcd);
        finalPitch = (float) ((double) finalPitch - (double) (finalPitch - this.rotate.y) % (double) gcd);

        this.rotate.x = finalYaw;
        this.rotate.y = finalPitch;
    }

    private void reset() {
        rotation = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
    }

    private boolean isInFOV(float targetYaw, float fov) {
        float playerYaw = this.rotate.x;
        float angleDiff = MathHelper.wrapDegrees(targetYaw - playerYaw);

        return Math.abs(angleDiff) <= fov / 2.0F;
    }



    private void startAttack(LivingEntity target) {
        System.out.println("Атака на цель: " + target.getName().getString());
    }




    private boolean canAttack() {
        boolean onSpace = space.get() && mc.player.isOnGround() && !mc.gameSettings.keyBindJump.isKeyDown();
        boolean reasonForAttack = mc.player.isPotionActive(Effects.LEVITATION) || mc.player.isPotionActive(Effects.BLINDNESS) || mc.player.isPotionActive(Effects.SLOW_FALLING) || mc.player.isOnLadder() || mc.player.isInWater() && mc.player.areEyesInFluid(FluidTags.WATER) || mc.player.isInLava() && mc.player.areEyesInFluid(FluidTags.LAVA) || mc.player.isPassenger() || mc.player.abilities.isFlying || mc.player.isElytraFlying() || mc.player.isSwimming();

        if (mc.player.getDistance(target) > distance.getValue().floatValue() || mc.player.getCooledAttackStrength(1.5f) < 0.93f - (randomCriticals.get() ? Math.random() * 0.05 : 0)) return false;
        if (!reasonForAttack && settings.get(0)) return onSpace || !mc.player.isOnGround() && mc.player.fallDistance > 0;

        return true;
    }

    private LivingEntity findTarget() {
        List<LivingEntity> targets = new ArrayList();
        Iterator var2 = mc.world.getAllEntities().iterator();

        while(var2.hasNext()) {
            Entity entity = (Entity)var2.next();
            if (entity instanceof LivingEntity && this.isValidTarget((LivingEntity)entity)) {
                targets.add((LivingEntity)entity);
            }
        }

        if (targets.isEmpty()) {
            return null;
        } else {
            if (targets.size() > 1) {
                String var4 = this.sortMode.get();
                byte var5 = -1;
                switch(var4.hashCode()) {
                    case -697210061:
                        if (var4.equals("По дистанции")) {
                            var5 = 1;
                        }
                        break;
                    case -178236820:
                        if (var4.equals("По всему")) {
                            var5 = 0;
                        }
                        break;
                    case 460219158:
                        if (var4.equals("По здоровью")) {
                            var5 = 2;
                        }
                }

                switch(var5) {
                    case 0:
                        targets.sort(Comparator.comparingDouble((target) -> {
                            if (target instanceof PlayerEntity) {
                                PlayerEntity player = (PlayerEntity)target;
                                return -this.getEntityArmor(player);
                            } else if (target instanceof LivingEntity) {
                                LivingEntity livingEntity = (LivingEntity)target;
                                return (double)(-livingEntity.getTotalArmorValue());
                            } else {
                                return 0.0D;
                            }
                        }).thenComparing((o, o1) -> {
                            double health = this.getEntityHealth((LivingEntity)o);
                            double health1 = this.getEntityHealth((LivingEntity)o1);
                            return Double.compare(health, health1);
                        }).thenComparing((object, object2) -> {
                            double d2 = this.getDistance((LivingEntity)object);
                            double d3 = this.getDistance((LivingEntity)object2);
                            return Double.compare(d2, d3);
                        }));
                        break;
                    case 1:
                        AuraFunction var6 = Managment.FUNCTION_MANAGER.auraFunction;
                        Objects.requireNonNull(var6);
                        targets.sort(Comparator.comparingDouble(var6::getDistance).thenComparingDouble(this::getEntityHealth));
                        break;
                    case 2:
                        Comparator var10001 = Comparator.comparingDouble(this::getEntityHealth);
                        Minecraft var10002 = mc;
                        ClientPlayerEntity var7 = mc.player;
                        Objects.requireNonNull(var7);
                        //targets.sort(getDistance(target));
                }
            } else {
                this.cpsLimit = System.currentTimeMillis();
            }

            return (LivingEntity)targets.get(0);
        }
    }

    private boolean isValidTarget(LivingEntity base) {
        if (base == null || base.getShouldBeDead() || !base.isAlive()) {
            return false;
        }

        if (base == mc.player) {
            return false;
        }

        // Проверка на друга
        if (base instanceof PlayerEntity) {
            String playerName = base.getName().getString();
            if (Managment.FRIEND_MANAGER != null && Managment.FRIEND_MANAGER.isFriend(playerName)) {
                return false;
            }

            PlayerEntity player = (PlayerEntity) base;

    
            boolean isInvisible = player.isInvisible();
            boolean isNaked = player.getTotalArmorValue() == 0;

            if (isInvisible && isNaked && !this.targets.get(5)) { // "Голые невидимки"
                return false;
            }

            if (isInvisible && !isNaked && !this.targets.get(6)) { // "Обычные невидимки"
                return false;
            }

            if (!isInvisible && isNaked && !this.targets.get(1)) { // "Голые"
                return false;
            }

            if (!this.targets.get(0)) { // Игроки
                return false;
            }
        }

        if (base instanceof MobEntity || base instanceof AnimalEntity) {
            return this.targets.get(3);
        }

        // Проверяем видимость и расстояние
        Vector3d vec3d = AuraUtil.getVector(base);
        Vector3d playerVec = mc.player.getLookVec();

        if (vec3d == null || playerVec == null) {
            return false;
        }

        double playerLength = playerVec.length();
        double targetLength = vec3d.length();

        if (playerLength == 0 || targetLength == 0) {
            return false;
        }

        double dotProduct = playerVec.dotProduct(vec3d);
        double angleCos = dotProduct / (playerLength * targetLength);

        if (angleCos < 0.866 || !mc.player.canEntityBeSeen(base)) {
            return false;
        }

        return this.getDistance(base) <= (double) (this.distance.getValue().floatValue()
                + (this.rotationMode.is("Matrix") ? this.rotateDistance.getValue().floatValue() : 0.0F));
    }



    private boolean isNakedPlayer(PlayerEntity player) {
  
        for (ItemStack armor : player.inventory.armorInventory) {
            if (!armor.isEmpty()) {
                return false;
            }
        }
        return true;
    }



    public static void onAttack(LivingEntity target) {
        if (target != null) {
            targetHit = true;
        }
    }


    public static boolean isTargetHit() {
        if (targetHit) {
            targetHit = false;
            return true;
        }
        return false;
    }


    private void renderFOVCircle() {
        if (!fovCircleOption.get()) {
            return;
        }

        int screenWidth = mc.getMainWindow().getScaledWidth();
        int screenHeight = mc.getMainWindow().getScaledHeight();


        int centerX = screenWidth / 2;
        int centerY = screenHeight / 2;
        int radius = 86;

        RenderSystem.disableTexture();
        RenderSystem.enableBlend();
        RenderSystem.defaultBlendFunc();

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);

        GL11.glLineWidth(1.0F);

        GL11.glBegin(GL11.GL_LINE_LOOP);
        for (int i = 0; i <= 360; i += 5) {
            double angle = Math.toRadians(i);
            double x = centerX + Math.cos(angle) * radius;
            double y = centerY + Math.sin(angle) * radius;
            GL11.glVertex2d(x, y);
        }
        GL11.glEnd();

  
        RenderSystem.enableTexture();
        RenderSystem.disableBlend();
    }




    private double getDistance(LivingEntity entity) {
        return AuraUtil.getVector(entity).length();
    }

    public double getEntityArmor(PlayerEntity target) {
        double totalArmor = 0.0D;
        Iterator var4 = target.inventory.armorInventory.iterator();

        while(var4.hasNext()) {
            ItemStack armorStack = (ItemStack)var4.next();
            if (armorStack != null && armorStack.getItem() instanceof ArmorItem) {
                totalArmor += this.getProtectionLvl(armorStack);
            }
        }

        return totalArmor;
    }

    public double getEntityHealth(Entity ent) {
        if (ent instanceof PlayerEntity) {
            PlayerEntity player = (PlayerEntity)ent;
            double armorValue = this.getEntityArmor(player) / 20.0D;
            return (double)(player.getHealth() + player.getAbsorptionAmount()) * armorValue;
        } else if (ent instanceof LivingEntity) {
            LivingEntity livingEntity = (LivingEntity)ent;
            return (double)(livingEntity.getHealth() + livingEntity.getAbsorptionAmount());
        } else {
            return 0.0D;
        }
    }

    private double getProtectionLvl(ItemStack stack) {
        ArmorItem armor = (ArmorItem)stack.getItem();
        double damageReduce = (double)armor.getDamageReduceAmount();
        if (stack.isEnchanted()) {
            damageReduce += (double)EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25D;
        }

        return damageReduce;
    }

    public void onDisable() {
        Minecraft var10003 = mc;
        Minecraft var10004 = mc;
        this.rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
        target = null;
        this.cpsLimit = System.currentTimeMillis();
        super.onDisable();
    }

    public static LivingEntity getTarget() {
        return target;
    }
}
Кому ещё 2.0 нужен?
 
Сверху Снизу