Обход античита KillAura FT/SP | Exp 2.0

  • Автор темы Автор темы sanya063
  • Дата начала Дата начала
как же тут много овер ии кода, тут много методов можно было бы в 4 строки сократить используя методы самого майнкрафта.
 
Короче ловите топ килку под фт и спуки на базу exp 2.0
Эта килка будет в Hudas Client Premium
SS -
Code -

KillAura:
Expand Collapse Copy
@ModuleInfo(name = "Aura", type = Category.Combat)
public class Aura extends Module {

    [USER=270918]@Getter[/USER]
    public static LivingEntity target = null;

    public Vector2f rotate = new Vector2f(0, 0);
    private final ModeSetting rotationMode = new ModeSetting("Режим ротации", "Funtime/SpookyTime-360", "Funtime/SpookyTime-360", "FuntimeSnap-360", "HVH");
    private final ModeSetting sortMode = new ModeSetting("Сортировать", "По всему", "По всему", "По здоровью", "По дистанции");
    private final MultiBoxSetting targets = new MultiBoxSetting("Цели", new BooleanOption("Игроки", true), new BooleanOption("Друзья", false), new BooleanOption("Голые", true), new BooleanOption("Мобы", false));
    private final SliderSetting distance = new SliderSetting("Дистанция аттаки", 3.0f, 2.0f, 6.0f, 0.05f);
    private final SliderSetting rotateDistance = new SliderSetting("Дистанция ротации", 0.5f, 0.0f, 3.0f, 0.05f).setVisible(() -> rotationMode.is("Funtime/SpookyTime-360"));
    public final MultiBoxSetting settings = new MultiBoxSetting("Настройки", new BooleanOption("Только критами", true), new BooleanOption("Коррекция движения", true), new BooleanOption("Отжимать щит", true), new BooleanOption("Ломать щит", true));
    private final BooleanOption onlySpaceCritical = new BooleanOption("Только с пробелом", true).setVisible(() -> settings.get(0));
    private final BooleanOption silent = new BooleanOption("Сайлент коррекция", true).setVisible(() -> settings.get(1));
    int ticksUntilNextAttack;
    private boolean hasRotated;
    private long cpsLimit = 0;

    public Aura() {
        this.addSettings(rotationMode, targets, sortMode, distance, rotateDistance, settings, onlySpaceCritical, silent);
    }

    [USER=1367676]@override[/USER]
    public boolean onEvent(final 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 (settings.get(1) && silent.get()) {
                MoveUtil.fixMovement(eventInput, Manager.FEATURE_MANAGER.autoPotion.isActivePotion ? Minecraft.getInstance().player.rotationYaw : rotate.x);
            }
        }

        if (event instanceof EventUpdate) {
            EventUpdate updateEvent = ((EventUpdate) event);
            if (!(target != null && isValidTarget(target))) {
                target = findTarget();
            }
            if (target == null) {
                cpsLimit = System.currentTimeMillis();
                rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
                return false;
            }

            attackAndRotateOnEntity(target);
        }

        if (event instanceof EventMotion) {
            EventMotion motionEvent = ((EventMotion) event);
            handleMotionEvent(motionEvent);
        }
        return false;
    }

    private void handleMotionEvent(EventMotion motionEvent) {
        if (target != null && !Manager.FEATURE_MANAGER.autoPotion.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;
        }
    }

    public static float calculateCorrectYawOffset(float yaw) {
        // Инициализация переменных
        double xDiff = mc.player.getPosX() - mc.player.prevPosX;
        double zDiff = mc.player.getPosZ() - mc.player.prevPosZ;
        float distSquared = (float) (xDiff * xDiff + zDiff * zDiff);
        float renderYawOffset = mc.player.prevRenderYawOffset;
        float offset = renderYawOffset;
        float yawOffsetDiff;

        // Вычисление смещения, если расстояние больше порогового значения
        if (distSquared > 0.0025000002f) {
            offset = (float) MathHelper.atan2(zDiff, xDiff) * 180.0f / (float) Math.PI - 90.0f;
        }

        // Установка смещения равным углу поворота, если игрок машет рукой
        if (mc.player != null && mc.player.swingProgress > 0.0f) {
            offset = yaw;
        }

        // Ограничение разницы смещений
        yawOffsetDiff = MathHelper.wrapDegrees(yaw - (renderYawOffset + MathHelper.wrapDegrees(offset - renderYawOffset) * 0.3f));
        yawOffsetDiff = MathHelper.clamp(yawOffsetDiff, -75.0f, 75.0f);

        // Вычисление итогового смещения
        renderYawOffset = yaw - yawOffsetDiff;
        if (yawOffsetDiff * yawOffsetDiff > 2500.0f) {
            renderYawOffset += yawOffsetDiff * 0.2f;
        }

        return renderYawOffset;
    }

    private void attackAndRotateOnEntity(LivingEntity target) {
        hasRotated = false;
        switch (rotationMode.getIndex()) {
            case 0: {
                if (shouldAttack(target) && !Manager.FEATURE_MANAGER.autoPotion.isActivePotion) {
                    attackTarget(target);
                }
                setRotation(target, false);
                break;
            }
            case 1: {
                if (shouldAttack(target) && !Manager.FEATURE_MANAGER.autoPotion.isActivePotion) {
                    attackTarget(target);
                    ticksUntilNextAttack = 10;
                }
                if (ticksUntilNextAttack > 5) {
                    setRotation(target, false);
                    ticksUntilNextAttack--;
                } else {
                    rotate.x = mc.player.rotationYaw;
                    rotate.y = mc.player.rotationPitch;
                }
                break;
            }
            case 2: {
                if (shouldAttack(target) && !Manager.FEATURE_MANAGER.autoPotion.isActivePotion) {
                    attackTarget(target);
                }
                setRotation(target, false);
                break;
            }
        }
    }

    private void attackTarget(final LivingEntity targetEntity) {
        if (settings.get(2) && mc.player.isBlocking()) {
            mc.playerController.onStoppedUsingItem(mc.player);
        }

        boolean sprint = false;
        if (CEntityActionPacket.lastUpdatedSprint && !mc.player.isInWater()) {
            mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.STOP_SPRINTING));
            sprint = true;
        }
        cpsLimit = System.currentTimeMillis() + 550;

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


        if (settings.get(3)) {
            breakShieldAndSwapSlot();
        }

        if (sprint) {
            mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.START_SPRINTING));
        }
    }

    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 = breakShield(player);
                if (slot > 8) {
                    mc.playerController.pickItem(slot);
                }
            }
        }
    }

    public int breakShield(LivingEntity target) {
        int hotBarSlot = InventoryUtil.getAxe(true);
        if (hotBarSlot != -1) {
            mc.player.connection.sendPacket(new CHeldItemChangePacket(hotBarSlot));
            mc.playerController.attackEntity(mc.player, target);
            mc.player.swingArm(Hand.MAIN_HAND);
            mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
            return hotBarSlot;
        }
        int inventorySLot = InventoryUtil.getAxe(false);
        if (inventorySLot != -1) {
            mc.playerController.pickItem(inventorySLot);
            mc.playerController.attackEntity(mc.player, target);
            mc.player.swingArm(Hand.MAIN_HAND);
            return inventorySLot;
        }

        return -1;
    }

    private boolean shouldAttack(LivingEntity targetEntity) {
        return canAttack() && targetEntity != null && (cpsLimit <= System.currentTimeMillis());
    }

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

        Vector3d vec3d = AuraUtil.getVector(base);

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

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

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

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

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

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

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

    public boolean canAttack() {
        final boolean onSpace = onlySpaceCritical.get()
                && mc.player.isOnGround()
                && !mc.gameSettings.keyBindJump.isKeyDown();

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

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

        if (!reasonForAttack && settings.get(0)) {
            return onSpace || !mc.player.isOnGround() && mc.player.fallDistance > MathUtil.randomizeFloat(0.0f, 0.3f);
        }
        return true;
    }

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

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

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

        if (targets.size() > 1) {
            switch (sortMode.get()) {
                case "По всему": {
                    targets.sort(Comparator.comparingDouble(target -> {
                        if (target instanceof PlayerEntity) {
                            PlayerEntity player = (PlayerEntity) target;
                            return -this.getEntityArmor(player);
                        }
                        if (target instanceof LivingEntity) {
                            LivingEntity livingEntity = (LivingEntity) target;
                            return -livingEntity.getTotalArmorValue();
                        }
                        return 0.0;
                    }).thenComparing((o, o1) -> {
                        double health = getEntityHealth((LivingEntity) o);
                        double health1 = getEntityHealth((LivingEntity) o1);
                        return Double.compare(health, health1);
                    }).thenComparing((object, object2) -> {
                        double d2 = getDistance((LivingEntity) object);
                        double d3 = getDistance((LivingEntity) object2);
                        return Double.compare(d2, d3);
                    }));
                    break;
                }
                case "По дистанции": {
                    targets.sort(Comparator.comparingDouble(Manager.FEATURE_MANAGER.aura::getDistance).thenComparingDouble(this::getEntityHealth));
                    break;
                }
                case "По здоровью": {
                    targets.sort(Comparator.comparingDouble(this::getEntityHealth).thenComparingDouble(mc.player::getDistance));
                    break;
                }
            }
        } else {
            cpsLimit = System.currentTimeMillis();
        }
        return targets.get(0);
    }

    private boolean isValidTarget(final LivingEntity base) {
        if (base.getShouldBeDead() || !base.isAlive() || base == mc.player)
            return false;

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

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

        if (base instanceof ArmorStandEntity || Manager.FEATURE_MANAGER.antiBot.isState() && Manager.FEATURE_MANAGER.antiBot.bots.contains(base))
            return false;

        return getDistance(base) <= distance.getValue().floatValue() + (rotationMode.is("Funtime/SpookyTime-360") ? rotateDistance.getValue().floatValue() : 0.0f);
    }

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

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

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

        return totalArmor;
    }

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

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

    [USER=1367676]@override[/USER]
    public void onDisable() {
        this.rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
        target = null;
        cpsLimit = System.currentTimeMillis();
        super.onDisable();
    }
}

By NaTuRaL
кхм кхм судя по коду это писал пьяный батя который команды чату гпт подавал
 
Короче ловите топ килку под фт и спуки на базу exp 2.0
Эта килка будет в Hudas Client Premium
SS -
Code -

KillAura:
Expand Collapse Copy
@ModuleInfo(name = "Aura", type = Category.Combat)
public class Aura extends Module {

    [USER=270918]@Getter[/USER]
    public static LivingEntity target = null;

    public Vector2f rotate = new Vector2f(0, 0);
    private final ModeSetting rotationMode = new ModeSetting("Режим ротации", "Funtime/SpookyTime-360", "Funtime/SpookyTime-360", "FuntimeSnap-360", "HVH");
    private final ModeSetting sortMode = new ModeSetting("Сортировать", "По всему", "По всему", "По здоровью", "По дистанции");
    private final MultiBoxSetting targets = new MultiBoxSetting("Цели", new BooleanOption("Игроки", true), new BooleanOption("Друзья", false), new BooleanOption("Голые", true), new BooleanOption("Мобы", false));
    private final SliderSetting distance = new SliderSetting("Дистанция аттаки", 3.0f, 2.0f, 6.0f, 0.05f);
    private final SliderSetting rotateDistance = new SliderSetting("Дистанция ротации", 0.5f, 0.0f, 3.0f, 0.05f).setVisible(() -> rotationMode.is("Funtime/SpookyTime-360"));
    public final MultiBoxSetting settings = new MultiBoxSetting("Настройки", new BooleanOption("Только критами", true), new BooleanOption("Коррекция движения", true), new BooleanOption("Отжимать щит", true), new BooleanOption("Ломать щит", true));
    private final BooleanOption onlySpaceCritical = new BooleanOption("Только с пробелом", true).setVisible(() -> settings.get(0));
    private final BooleanOption silent = new BooleanOption("Сайлент коррекция", true).setVisible(() -> settings.get(1));
    int ticksUntilNextAttack;
    private boolean hasRotated;
    private long cpsLimit = 0;

    public Aura() {
        this.addSettings(rotationMode, targets, sortMode, distance, rotateDistance, settings, onlySpaceCritical, silent);
    }

    [USER=1367676]@override[/USER]
    public boolean onEvent(final 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 (settings.get(1) && silent.get()) {
                MoveUtil.fixMovement(eventInput, Manager.FEATURE_MANAGER.autoPotion.isActivePotion ? Minecraft.getInstance().player.rotationYaw : rotate.x);
            }
        }

        if (event instanceof EventUpdate) {
            EventUpdate updateEvent = ((EventUpdate) event);
            if (!(target != null && isValidTarget(target))) {
                target = findTarget();
            }
            if (target == null) {
                cpsLimit = System.currentTimeMillis();
                rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
                return false;
            }

            attackAndRotateOnEntity(target);
        }

        if (event instanceof EventMotion) {
            EventMotion motionEvent = ((EventMotion) event);
            handleMotionEvent(motionEvent);
        }
        return false;
    }

    private void handleMotionEvent(EventMotion motionEvent) {
        if (target != null && !Manager.FEATURE_MANAGER.autoPotion.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;
        }
    }

    public static float calculateCorrectYawOffset(float yaw) {
        // Инициализация переменных
        double xDiff = mc.player.getPosX() - mc.player.prevPosX;
        double zDiff = mc.player.getPosZ() - mc.player.prevPosZ;
        float distSquared = (float) (xDiff * xDiff + zDiff * zDiff);
        float renderYawOffset = mc.player.prevRenderYawOffset;
        float offset = renderYawOffset;
        float yawOffsetDiff;

        // Вычисление смещения, если расстояние больше порогового значения
        if (distSquared > 0.0025000002f) {
            offset = (float) MathHelper.atan2(zDiff, xDiff) * 180.0f / (float) Math.PI - 90.0f;
        }

        // Установка смещения равным углу поворота, если игрок машет рукой
        if (mc.player != null && mc.player.swingProgress > 0.0f) {
            offset = yaw;
        }

        // Ограничение разницы смещений
        yawOffsetDiff = MathHelper.wrapDegrees(yaw - (renderYawOffset + MathHelper.wrapDegrees(offset - renderYawOffset) * 0.3f));
        yawOffsetDiff = MathHelper.clamp(yawOffsetDiff, -75.0f, 75.0f);

        // Вычисление итогового смещения
        renderYawOffset = yaw - yawOffsetDiff;
        if (yawOffsetDiff * yawOffsetDiff > 2500.0f) {
            renderYawOffset += yawOffsetDiff * 0.2f;
        }

        return renderYawOffset;
    }

    private void attackAndRotateOnEntity(LivingEntity target) {
        hasRotated = false;
        switch (rotationMode.getIndex()) {
            case 0: {
                if (shouldAttack(target) && !Manager.FEATURE_MANAGER.autoPotion.isActivePotion) {
                    attackTarget(target);
                }
                setRotation(target, false);
                break;
            }
            case 1: {
                if (shouldAttack(target) && !Manager.FEATURE_MANAGER.autoPotion.isActivePotion) {
                    attackTarget(target);
                    ticksUntilNextAttack = 10;
                }
                if (ticksUntilNextAttack > 5) {
                    setRotation(target, false);
                    ticksUntilNextAttack--;
                } else {
                    rotate.x = mc.player.rotationYaw;
                    rotate.y = mc.player.rotationPitch;
                }
                break;
            }
            case 2: {
                if (shouldAttack(target) && !Manager.FEATURE_MANAGER.autoPotion.isActivePotion) {
                    attackTarget(target);
                }
                setRotation(target, false);
                break;
            }
        }
    }

    private void attackTarget(final LivingEntity targetEntity) {
        if (settings.get(2) && mc.player.isBlocking()) {
            mc.playerController.onStoppedUsingItem(mc.player);
        }

        boolean sprint = false;
        if (CEntityActionPacket.lastUpdatedSprint && !mc.player.isInWater()) {
            mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.STOP_SPRINTING));
            sprint = true;
        }
        cpsLimit = System.currentTimeMillis() + 550;

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


        if (settings.get(3)) {
            breakShieldAndSwapSlot();
        }

        if (sprint) {
            mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.START_SPRINTING));
        }
    }

    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 = breakShield(player);
                if (slot > 8) {
                    mc.playerController.pickItem(slot);
                }
            }
        }
    }

    public int breakShield(LivingEntity target) {
        int hotBarSlot = InventoryUtil.getAxe(true);
        if (hotBarSlot != -1) {
            mc.player.connection.sendPacket(new CHeldItemChangePacket(hotBarSlot));
            mc.playerController.attackEntity(mc.player, target);
            mc.player.swingArm(Hand.MAIN_HAND);
            mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
            return hotBarSlot;
        }
        int inventorySLot = InventoryUtil.getAxe(false);
        if (inventorySLot != -1) {
            mc.playerController.pickItem(inventorySLot);
            mc.playerController.attackEntity(mc.player, target);
            mc.player.swingArm(Hand.MAIN_HAND);
            return inventorySLot;
        }

        return -1;
    }

    private boolean shouldAttack(LivingEntity targetEntity) {
        return canAttack() && targetEntity != null && (cpsLimit <= System.currentTimeMillis());
    }

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

        Vector3d vec3d = AuraUtil.getVector(base);

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

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

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

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

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

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

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

    public boolean canAttack() {
        final boolean onSpace = onlySpaceCritical.get()
                && mc.player.isOnGround()
                && !mc.gameSettings.keyBindJump.isKeyDown();

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

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

        if (!reasonForAttack && settings.get(0)) {
            return onSpace || !mc.player.isOnGround() && mc.player.fallDistance > MathUtil.randomizeFloat(0.0f, 0.3f);
        }
        return true;
    }

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

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

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

        if (targets.size() > 1) {
            switch (sortMode.get()) {
                case "По всему": {
                    targets.sort(Comparator.comparingDouble(target -> {
                        if (target instanceof PlayerEntity) {
                            PlayerEntity player = (PlayerEntity) target;
                            return -this.getEntityArmor(player);
                        }
                        if (target instanceof LivingEntity) {
                            LivingEntity livingEntity = (LivingEntity) target;
                            return -livingEntity.getTotalArmorValue();
                        }
                        return 0.0;
                    }).thenComparing((o, o1) -> {
                        double health = getEntityHealth((LivingEntity) o);
                        double health1 = getEntityHealth((LivingEntity) o1);
                        return Double.compare(health, health1);
                    }).thenComparing((object, object2) -> {
                        double d2 = getDistance((LivingEntity) object);
                        double d3 = getDistance((LivingEntity) object2);
                        return Double.compare(d2, d3);
                    }));
                    break;
                }
                case "По дистанции": {
                    targets.sort(Comparator.comparingDouble(Manager.FEATURE_MANAGER.aura::getDistance).thenComparingDouble(this::getEntityHealth));
                    break;
                }
                case "По здоровью": {
                    targets.sort(Comparator.comparingDouble(this::getEntityHealth).thenComparingDouble(mc.player::getDistance));
                    break;
                }
            }
        } else {
            cpsLimit = System.currentTimeMillis();
        }
        return targets.get(0);
    }

    private boolean isValidTarget(final LivingEntity base) {
        if (base.getShouldBeDead() || !base.isAlive() || base == mc.player)
            return false;

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

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

        if (base instanceof ArmorStandEntity || Manager.FEATURE_MANAGER.antiBot.isState() && Manager.FEATURE_MANAGER.antiBot.bots.contains(base))
            return false;

        return getDistance(base) <= distance.getValue().floatValue() + (rotationMode.is("Funtime/SpookyTime-360") ? rotateDistance.getValue().floatValue() : 0.0f);
    }

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

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

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

        return totalArmor;
    }

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

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

    [USER=1367676]@override[/USER]
    public void onDisable() {
        this.rotate = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
        target = null;
        cpsLimit = System.currentTimeMillis();
        super.onDisable();
    }
}

By NaTuRaL

By NaTuRaL AI
 
Назад
Сверху Снизу