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

Часть функционала NewCode Aura

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
13 Дек 2025
Сообщения
75
Реакции
0
Выберите загрузчик игры
  1. Прочие моды
code:
Expand Collapse Copy
package wprotect;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.Objects;
import wprotect.RaycastContext.FluidHandling;
import wprotect.RaycastContext.ShapeType;

@ModuleInfo(
    name = "Aura",
    category = ModuleCategory.COMBAT
)
public class Aura extends Module {
    
    // элитро ротейшин
    public NumberSetting elytraRotation = new NumberSetting("Элитра ротация", "Elytra Rotation", 12.5F, 0.0F, 32.0F, 0.5F, () -> this.modeSetting.isCurrentMode("Grim"));
    
    // цель
    public static LivingEntity currentTarget = null;
    
    // кого таргетить будем
    public MultiBooleanSetting targetSelection = new MultiBooleanSetting("Таргеты", "Target Selection",
        new BooleanSetting[]{
            new BooleanSetting("Игроки", "Players", true),
            new BooleanSetting("Друзья", "Friends", false),
            new BooleanSetting("Голые игроки", "Naked Players", true),
            new BooleanSetting("Монстры", "Monsters", false)
        });
    
    // ротка
    public NumberSetting rotationSetting = new NumberSetting("Ротация", "Rotation", 0.0F, 0.0F, 32.0F, 1.0F, () -> this.modeSetting.isCurrentMode("Grim"));
    
    // сетинги
    public MultiBooleanSetting settings = new MultiBooleanSetting("Настройки", "Settings",
        new BooleanSetting[]{
            new BooleanSetting("Только криты", "Crit Only", true),
            new BooleanSetting("Коррекция движения", "Movement Correction", true),
            new BooleanSetting("Отжимать щит", "Unpress Shield", true),
            new BooleanSetting("Ломать щит", "Break Shield", true),
            new BooleanSetting("Только с пробелом", "Only with space", false),
            new BooleanSetting("Бить через стены", "Hit Through Walls", true),
            new BooleanSetting("Бить и есть", "With eat", false),
            new BooleanSetting("Выключить интерполяцию", "Disable Interpolation", false),
            new BooleanSetting("Коррекция Yaw", "Yaw Correction", false),
            new BooleanSetting("Тестовая Grim ротация", "Test Grim rotation", false)
        });
    
    public double previousSpeed;
    public Timer rotationTimer = new Timer();
    public Timer attackTimer = new Timer();
    public static NumberSetting elytraDistance = new NumberSetting("Расстояние (Элитры)", "Distance (Elytra)", 3.0F, 2.5F, 5.5F, 0.1F);
    public boolean isSpookyAttack;
    public long attackCooldown = 0L;
    public double currentSpeed;
    public boolean spookyFlag;
    
    public ModeSetting sortingMode = new ModeSetting("Сортировка", "Sorting", "All",
        new String[]{"All", "By Health", "By Distance", "Advanced"});
    
    public ModeSetting modeSetting = new ModeSetting("Режим", "Mode", "Grim",
        new String[]{"Grim", "SpookyTime"});
    
    public ModeSetting correctionMode = new ModeSetting("Режим коррекции", "Correction Mode", "FreeLook",
        new String[]{"FreeLook", "Focused"});
    
    public Rotation currentRotation = new Rotation(0.0F, 0.0F);
    public static NumberSetting attackDistance = new NumberSetting("Расстояние", "Distance", 3.0F, 2.5F, 5.5F, 0.1F);

    public static LivingEntity getCurrentTarget() {
        return currentTarget;
    }

    public Rotation calculateRotation(LivingEntity entity, boolean elytraTarget, ElytraVector elytraVector) {
        if (this.rotationTimer.hasPassed(200L)) {
            double deltaX = entity.lastRenderX - entity.prevRenderX;
            double deltaY = entity.lastRenderY - entity.prevRenderY;
            double deltaZ = entity.lastRenderZ - entity.prevRenderZ;
            double horizontalDistance = Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ);
            this.previousSpeed = this.currentSpeed;
            this.currentSpeed = horizontalDistance * 20.0;
            this.rotationTimer.reset();
        }

        float elytraSpeed = elytraVector.target.getSpeed();
        Vec3d interpolatedPosition = entity.getBoundingBox().getCenter().add(elytraSpeed);
        Vec3d cameraPosition = MinecraftClient.getInstance().gameRenderer.getCamera().getPos();
        
        boolean isFastTarget = this.currentSpeed >= 20.0 && (this.currentSpeed != this.previousSpeed || this.currentSpeed == 0.0);
        
        Vec3d targetPosition = entity.getPos().add(0.0, entity.getHeight() / 2.0, 0.0);
        
        if (elytraTarget) {
            if (MinecraftClient.getInstance().player.isFallFlying() && entity.isFallFlying() && isFastTarget) {
                targetPosition = entity.getPos().subtract(interpolatedPosition);
            }
        }

        if (MinecraftClient.getInstance().player.isFallFlying()) {
            Vec3d relativePos = targetPosition.subtract(MinecraftClient.getInstance().player.getPos());
            float yaw = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(relativePos.z, relativePos.x)) - 90.0);
            float pitch = (float) MathHelper.wrapDegrees(Math.toDegrees(-Math.atan2(relativePos.y, Math.hypot(relativePos.x, relativePos.z))));
            return new Rotation(yaw, pitch);
        } else {
            Vec3d direction = targetPosition.subtract(cameraPosition).normalize();
            float yaw = (float) Math.toDegrees(Math.atan2(-direction.x, direction.z));
            float pitch = (float) Math.toDegrees(Math.asin(direction.y));
            return new Rotation(yaw, -pitch);
        }
    }

    public Aura() {
        this.registerSettings(new Setting[]{
            this.modeSetting,
            this.targetSelection,
            attackDistance,
            elytraDistance,
            this.rotationSetting,
            this.elytraRotation,
            this.correctionMode,
            this.sortingMode,
            this.settings
        });
    }

    public double calculateArmorProtection(PlayerEntity player) {
        double totalProtection = 0.0;

        for (ItemStack armorPiece : player.getInventory().armor) {
            if (armorPiece != null && armorPiece.getItem() instanceof ArmorItem) {
                totalProtection += this.getArmorProtection(armorPiece);
            }
        }

        return totalProtection;
    }

    public void onEnable() {
        NewCodeClient.getInstance().getModuleManager().killerAura.setEnabled(true);
        if (MinecraftClient.getInstance().player != null) {
            this.currentRotation = new Rotation(MinecraftClient.getInstance().player.yaw, MinecraftClient.getInstance().player.pitch);
            currentTarget = null;
        }
        this.attackCooldown = System.currentTimeMillis();
        super.onEnable();
    }

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

        for (Entity entity : MinecraftClient.getInstance().world.getEntities()) {
            if (entity instanceof LivingEntity && this.isValidTarget((LivingEntity) entity)) {
                targets.add((LivingEntity) entity);
            }
        }

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

        if (targets.size() > 1) {
            switch (this.sortingMode.getValue()) {
                case "All":
                    targets.sort(Comparator.comparingDouble((target) -> {
                        if (target instanceof PlayerEntity player) {
                            return -this.calculateArmorProtection(player);
                        } else if (target instanceof LivingEntity living) {
                            return -living.getHealth();
                        }
                        return 0.0;
                    }).thenComparing((t1, t2) -> {
                        double d1 = this.getEffectiveHealth((LivingEntity) t1);
                        double d2 = this.getEffectiveHealth((LivingEntity) t2);
                        return Double.compare(d1, d2);
                    }).thenComparing((t1, t2) -> {
                        double d1 = this.getDistanceToTarget((LivingEntity) t1);
                        double d2 = this.getDistanceToTarget((LivingEntity) t2);
                        return Double.compare(d1, d2);
                    }));
                    break;
                case "Advanced":
                    targets.sort(Comparator.comparingDouble((target) -> {
                        if (target instanceof PlayerEntity player) {
                            return player.getEquippedStack(EquipmentSlot.CHEST).getItem() == Items.ELYTRA ? Double.MIN_VALUE : -this.calculateArmorProtection(player);
                        } else if (target instanceof LivingEntity living) {
                            return -living.getHealth();
                        }
                        return 0.0;
                    }).thenComparing((t1, t2) -> {
                        double d1 = this.getEffectiveHealth((LivingEntity) t1);
                        double d2 = this.getEffectiveHealth((LivingEntity) t2);
                        return Double.compare(d1, d2);
                    }).thenComparing((t1, t2) -> {
                        double d1 = this.getDistanceToTarget((LivingEntity) t1);
                        double d2 = this.getDistanceToTarget((LivingEntity) t2);
                        return Double.compare(d1, d2);
                    }));
                    break;
                case "By Distance":
                    Aura aura = NewCodeClient.getInstance().getModuleManager().aura;
                    Objects.requireNonNull(aura);
                    targets.sort(Comparator.comparingDouble(aura::getDistanceToTarget).thenComparingDouble(this::getEffectiveHealth));
                    break;
                case "By Health":
                    Comparator<LivingEntity> healthComparator = Comparator.comparingDouble(this::getEffectiveHealth);
                    ClientPlayerEntity player = MinecraftClient.getInstance().player;
                    Objects.requireNonNull(player);
                    targets.sort(healthComparator.thenComparingDouble(player::distanceTo));
            }
        } else {
            this.attackCooldown = System.currentTimeMillis();
        }

        return targets.get(0);
    }

    public boolean canAttack() {
        boolean hasShield = this.settings.isEnabled(4) && MinecraftClient.getInstance().player.isBlocking() && !MinecraftClient.getInstance().crosshairTarget.isEntity();
        boolean isBlocking = NewCodeClient.getInstance().getModuleManager().criticals.isEnabled() && !Criticals.canCrit()
            && !MinecraftClient.getInstance().player.isUsingItem()
            && !MinecraftClient.getInstance().player.isSleeping()
            && (!MinecraftClient.getInstance().player.isFallFlying() || !MinecraftClient.getInstance().player.isTouchingWater())
            && !MinecraftClient.getInstance().player.isRiding()
            && !MinecraftClient.getInstance().player.abilities.flying
            && !MinecraftClient.getInstance().player.isFallFlying()
            && !MinecraftClient.getInstance().player.isUsingRiptide()
            && !MinecraftClient.getInstance().player.isClimbing();
        
        double distance = this.getDistanceToTarget(currentTarget);
        boolean inRange = distance < (MinecraftClient.getInstance().player.isFallFlying() ? elytraDistance.getValue() : attackDistance.getValue());
        boolean cooldownReady = MinecraftClient.getInstance().player.getAttackCooldownProgress(1.5F) >= 0.93F && this.attackCooldown <= System.currentTimeMillis();
        
        if (inRange && cooldownReady) {
            if (!isBlocking && this.settings.isEnabled(0)) {
                return hasShield || MinecraftClient.getInstance().player.isBlocking() || MinecraftClient.getInstance().player.attackCooldownProgress <= 0.0F;
            }
            return true;
        }
        return false;
    }

    public void attackTarget(LivingEntity target) {
        ModuleManager moduleManager = NewCodeClient.getInstance().getModuleManager();
        Vec3d attackVec;
        
        if (moduleManager.elytraFly.isEnabled()) {
            Rotation rotation = this.calculateRotation(target, true, moduleManager.elytraFly);
            float yawRad = (float) Math.toRadians(rotation.yaw);
            float pitchRad = (float) Math.toRadians(rotation.pitch);
            double x = -MathHelper.sin(yawRad) * MathHelper.cos(pitchRad);
            double y = -MathHelper.sin(pitchRad);
            double z = MathHelper.cos(yawRad) * MathHelper.cos(pitchRad);
            attackVec = new Vec3d(x, y, z);
        } else {
            Vec3d targetPos = target.getPos();
            targetPos = targetPos.add(0.0,
                MinecraftClient.getInstance().player.isFallFlying() && (target.isFallFlying() || target.isGliding()) && moduleManager.elytraFly.isEnabled()
                    ? MathHelper.clamp(target.getY() - target.getHeight(), 0.0, target.getHeight() / 2.0)
                    : target.getHeight() - 0.2,
                0.0);
            attackVec = targetPos.subtract(MinecraftClient.getInstance().player.getPos());
            
            if (MinecraftClient.getInstance().player.isFallFlying() && (target.isFallFlying() || target.isGliding()) && moduleManager.elytraFly.isEnabled()) {
                double expansion = moduleManager.elytraFly.target.getSpeed() / 20.0;
                Vec3d targetBox = target.getBoundingBox().expand(expansion, expansion, expansion);
                Vec3d playerBox = MinecraftClient.getInstance().player.getBoundingBox().expand(0.1, 0.1, 0.1);
                attackVec = attackVec.add(targetBox).add(playerBox);
            }
        }

        float targetYaw = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(attackVec.z, attackVec.x)) - 90.0);
        float targetPitch = (float) -Math.toDegrees(Math.atan2(attackVec.y, Math.hypot(attackVec.x, attackVec.z)));
        
        float yawDiff = MathHelper.wrapDegrees(targetYaw - this.currentRotation.yaw);
        float pitchDiff = MathHelper.wrapDegrees(targetPitch - this.currentRotation.pitch);
        
        float maxRotation = 150.0F;
        float yawStep = Math.min(Math.max(Math.abs(yawDiff), 0.0F), maxRotation);
        float pitchStep = Math.max(Math.abs(pitchDiff), 0.0F);
        
        float gcd = RotationUtils.getGCD();
        
        if (!this.settings.isEnabled(7)) {
            attackVec.add(target.lastRenderX - target.prevX, target.lastRenderY - target.prevY, target.lastRenderZ - target.prevZ);
        }

        switch (this.modeSetting.getIndex()) {
            case 0: // Grim mode
                if (!NewCodeClient.getInstance().getModuleManager().testModule.isActive) {
                    if (MinecraftClient.getInstance().player.isFallFlying() && (target.isFallFlying() || target.isGliding()) && NewCodeClient.getInstance().getModuleManager().elytraFly.isEnabled()) {
                        float elytraYawStep = Math.min(Math.max(Math.abs(yawDiff), 1.0F), maxRotation * 1.2F);
                        float elytraPitchStep = Math.max(Math.abs(pitchDiff), 1.0F);
                        float elytraRotationOffset = RotationUtils.getGCD((float) (Math.cos(System.currentTimeMillis() / 50.0) * NewCodeClient.getInstance().getModuleManager().elytraFly.targetSetting.getValue()));
                        
                        float newYaw = this.currentRotation.yaw + (yawDiff > 0.0F ? elytraYawStep : -elytraYawStep) + elytraRotationOffset;
                        float newPitch = MathHelper.clamp(this.currentRotation.pitch + (pitchDiff > 0.0F ? elytraPitchStep : -elytraPitchStep), -89.0F, 89.0F) + elytraRotationOffset;
                        
                        float gcdHalf = RotationUtils.getGCD() * 0.5F;
                        newYaw -= (newYaw - this.currentRotation.yaw) % gcdHalf;
                        newPitch -= (newPitch - this.currentRotation.pitch) % gcdHalf;
                        
                        this.currentRotation = new Rotation(newYaw, newPitch);
                    } else {
                        float randomYawOffset = (float) (Math.random() * 1.15);
                        float randomPitchOffset = (float) (Math.random() * 1.15);
                        
                        float newYaw = this.currentRotation.yaw + (yawDiff > 0.0F ? yawStep : -yawStep);
                        float newPitch = MathHelper.clamp(this.currentRotation.pitch + (pitchDiff > 0.0F ? pitchStep : -pitchStep), -89.0F, 89.0F);
                        
                        if (!MinecraftClient.getInstance().player.isFallFlying() && this.settings.isEnabled(9)) {
                            newYaw += randomYawOffset;
                            newPitch += randomPitchOffset;
                        }
                        
                        newYaw -= (newYaw - this.currentRotation.yaw) % gcd;
                        newPitch -= (newPitch - this.currentRotation.pitch) % gcd;
                        
                        this.currentRotation = new Rotation(newYaw, newPitch);
                    }
                }
                break;
                
            case 1: // SpookyTime mode
                float attackProgress = MinecraftClient.getInstance().player.lastAttackedTicks;
                boolean lowProgress = attackProgress > 0.0F && attackProgress < 0.7F;
                boolean highProgress = attackProgress >= 0.7F && attackProgress < 1.0F;
                
                if ((lowProgress || highProgress) && !this.spookyFlag) {
                    this.spookyFlag = true;
                } else if (!lowProgress && !highProgress && this.spookyFlag) {
                    this.isSpookyAttack = true;
                    this.attackTimer.reset();
                    this.spookyFlag = false;
                }
                
                if (this.isSpookyAttack && this.attackTimer.hasPassed(0)) {
                    this.isSpookyAttack = false;
                }
                
                float smoothing, maxYaw, maxPitch, randomFactor;
                if (highProgress) {
                    smoothing = 0.4F;
                    maxYaw = 175.0F;
                    maxPitch = 8.0F;
                    randomFactor = 0.01F;
                } else if (lowProgress) {
                    smoothing = 0.5F;
                    maxYaw = 70.0F;
                    maxPitch = 65.0F;
                    randomFactor = 0.09F;
                } else {
                    smoothing = 0.8F;
                    maxYaw = 45.0F;
                    maxPitch = 40.0F;
                    randomFactor = 0.15F;
                }
                
                yawStep = MathHelper.clamp(Math.abs(yawDiff), 0.3F, maxYaw);
                pitchStep = MathHelper.clamp(Math.abs(pitchDiff), 0.25F, maxPitch);
                
                if (Math.abs(yawDiff) < 5.0F && !highProgress) {
                    yawStep *= 0.8F + 0.05F * (float) Math.sin(0.0);
                }
                
                if (highProgress || lowProgress) {
                    float progressMultiplier = 2.0F - (float) Math.pow(attackProgress, 2.0);
                    yawStep *= progressMultiplier;
                    pitchStep *= progressMultiplier;
                }
                
                float finalYaw, finalPitch;
                if (highProgress) {
                    finalYaw = this.currentRotation.yaw;
                    finalPitch = MathHelper.clamp(this.currentRotation.pitch + (int) yawDiff, -60.0F, 60.0F);
                } else {
                    finalYaw = this.currentRotation.yaw + (yawDiff > 0.0F ? yawStep : -yawStep) * (1.0F - randomFactor * (float) Math.abs(Math.sin(0.0)));
                    finalPitch = MathHelper.clamp(this.currentRotation.pitch + (pitchDiff > 0.0F ? pitchStep : -pitchStep) - 12.0F, -85.0F, 85.0F + pitchStep);
                }
                
                if (!highProgress && !lowProgress && !this.isSpookyAttack) {
                    finalYaw += (Math.random() - 0.5) * 0.2;
                    finalPitch += (Math.random() - 0.5) * 0.1;
                }
                
                gcd = RotationUtils.getGCD() * (highProgress || lowProgress ? 0.7F : 1.0F);
                finalYaw -= (finalYaw - this.currentRotation.yaw) % gcd;
                finalPitch -= (finalPitch - this.currentRotation.pitch) % gcd;
                
                this.currentRotation = new Rotation(
                    finalYaw * smoothing + this.currentRotation.yaw * (1.0F - smoothing),
                    finalPitch * smoothing + this.currentRotation.pitch * (1.0F - smoothing)
                );
                break;
        }
    }

    public double getEffectiveHealth(Entity entity) {
        if (entity instanceof PlayerEntity player) {
            double armorReduction = this.calculateArmorProtection(player) / 20.0;
            return (player.getHealth() + player.getAbsorptionAmount()) * armorReduction;
        } else if (entity instanceof LivingEntity living) {
            return living.getHealth() + living.getAbsorptionAmount();
        }
        return 0.0;
    }

    public double getDistanceToTarget(LivingEntity target) {
        return RotationUtils.getDistanceToEntity(target).getLength();
    }

    public double getArmorProtection(ItemStack armor) {
        ArmorItem armorItem = (ArmorItem) armor.getItem();
        double protection = armorItem.getProtection();
        if (armor.hasEnchantments()) {
            protection += EnchantmentHelper.getLevel(Enchantments.PROTECTION, armor) * 0.25;
        }
        return protection;
    }

    public boolean hasLineOfSight(LivingEntity target) {
        Vec3d targetPos = target.getPos().add(0.0, (double) target.getStandingEyeHeight(), 0.0);
        Vec3d playerPos = MinecraftClient.getInstance().player.getPos().add(0.0, (double) MinecraftClient.getInstance().player.getStandingEyeHeight(), 0.0);
        BlockHitResult raycast = MinecraftClient.getInstance().world.raycast(new RaycastContext(
            playerPos, targetPos,
            RaycastContext.ShapeType.COLLIDER,
            RaycastContext.FluidHandling.NONE,
            MinecraftClient.getInstance().player
        ));
        return raycast.getType() == RaycastResult.Type.MISS;
    }

    public void performAttack(LivingEntity target) {
        if (this.settings.isEnabled(2)) {
            if (MinecraftClient.getInstance().player.isUsingItem()) {
                MinecraftClient.getInstance().interactionManager.stopUsingItem(MinecraftClient.getInstance().player);
            }
        }

        this.attackCooldown = System.currentTimeMillis() + 555L;
        Criticals.isCritting = true;
        
        if (NewCodeClient.getInstance().getModuleManager().criticals.isEnabled() && Criticals.canCrit()) {
            NewCodeClient.getInstance().getModuleManager().criticals.doCrit();
        }

        MinecraftClient.getInstance().interactionManager.attackEntity(MinecraftClient.getInstance().player, target);
        MinecraftClient.getInstance().player.swingHand(Hand.MAIN_HAND);
        Criticals.isCritting = false;
        
        if (this.settings.isEnabled(3)) {
            ShieldBreaker.breakShield();
        }
    }

    public boolean isValidTarget(LivingEntity entity) {
        if (entity == null || entity == MinecraftClient.getInstance().player || !entity.isAlive() || entity.isRemoved()) {
            return false;
        }
        
        if (entity instanceof PlayerEntity player) {
            String name = player.getGameProfile().getName();
            boolean isFriend = FriendManager.isFriend(name);
            boolean isTeammate = NewCodeClient.getInstance().getModuleManager().teams.getTarget() != null
                && name.equals(NewCodeClient.getInstance().getModuleManager().teams.getTarget().getGameProfile().getName());
            boolean isNaked = player.getArmor() == 0;
            
            if ((isFriend && !this.targetSelection.isEnabled(1))
                || isTeammate
                || (isNaked && (!this.targetSelection.isEnabled(0) || !this.targetSelection.isEnabled(2)))) {
                return false;
            }
        }

        if (AntiBot.isBot(entity)) {
            return false;
        }
        
        if (entity instanceof PassiveEntity && !this.targetSelection.isEnabled(3)) {
            return false;
        }
        
        if (entity instanceof PlayerEntity && !this.targetSelection.isEnabled(0)) {
            return false;
        }
        
        if (!(entity instanceof HostileEntity) && (!(entity instanceof PlayerEntity) || !((PlayerEntity) entity).isCreative())) {
            if (!this.settings.isEnabled(5) && !this.hasLineOfSight(entity)) {
                return false;
            }
            
            float elytraOffset = MinecraftClient.getInstance().player.isFallFlying() ? this.elytraRotation.getValue() : 0.0F;
            float rotationOffset = this.modeSetting.isCurrentMode("Grim") ? this.rotationSetting.getValue() + elytraOffset : 0.0F;
            double maxDistance = MinecraftClient.getInstance().player.isFallFlying()
                ? elytraDistance.getValue()
                : attackDistance.getValue() + rotationOffset;
            
            return this.getDistanceToTarget(entity) <= maxDistance;
        }
        return false;
    }

    public boolean onPacket(Packet<?> packet) {
        ModuleManager moduleManager = NewCodeClient.getInstance().getModuleManager();
        
        if (packet instanceof PlayerMoveC2SPacket movePacket) {
            if (movePacket.isOnGround() && currentTarget != MinecraftClient.getInstance().player && currentTarget != null) {
                if (MinecraftClient.getInstance().player.isFallFlying()
                    && moduleManager.elytraFly.isActive
                    && moduleManager.elytraFly.isEnabled()) {
                    
                    ElytraFly.sendElytraStart();
                    ElytraFly.sendElytraTick();
                    
                    Vec3d velocity = currentTarget.getVelocity();
                    float speed = moduleManager.elytraFly.target.getSpeed();
                    Vec3d offset = velocity.multiply(speed);
                    
                    if (currentTarget.isFallFlying()) {
                        Vec3d direction = MinecraftClient.getInstance().getNetworkHandler().getConnection().getChannel().remoteAddress();
                        // Отправка пакета движения с учетом элитры
                    }
                    
                    ElytraFly.sendElytraEnd();
                    ElytraFly.sendElytraStop();
                }
            }
        }

        if (packet instanceof EntitySpawnPacket spawnPacket) {
            if (spawnPacket.isAlive()) {
                PacketEntityType entityType = spawnPacket.getEntityType();
                if (entityType instanceof PlayerEntityPacket) {
                    PlayerEntityPacket playerPacket = (PlayerEntityPacket) entityType;
                    if (MinecraftClient.getInstance().world != null && MinecraftClient.getInstance().player != null) {
                        Entity entity = playerPacket.getEntity(MinecraftClient.getInstance().world);
                        if (entity instanceof PlayerEntity player) {
                            if (player != currentTarget) {
                                currentTarget = player;
                            }
                        }
                    }
                }
            }
        }

        if (packet instanceof KeepAlivePacket keepAlive) {
            if (currentTarget != null) {
                keepAlive.setResponse(true);
            }
        }

        if (packet instanceof PlayerInputPacket inputPacket) {
            if (this.settings.isEnabled(1) && this.correctionMode.isCurrentMode("FreeLook") && moduleManager.teams.getTarget() == null) {
                float yaw;
                if (moduleManager.testModule.isActive) {
                    yaw = MinecraftClient.getInstance().player.yaw;
                } else {
                    yaw = this.currentRotation.yaw;
                }
                MovementUtils.setYaw(inputPacket, yaw);
            }
        }

        if ((packet instanceof PlayerInteractEntityPacket && !this.modeSetting.isCurrentMode("FunTime")
            || packet instanceof ClientCommandPacket && this.modeSetting.isCurrentMode("FunTime"))
            && currentTarget != null) {
            this.attackTarget(currentTarget);
        }

        if (packet instanceof ClientCommandPacket) {
            if (currentTarget != null) {
                if (!MinecraftClient.getInstance().player.isBlocking()) {
                    moduleManager.killerAura.setEnabled(true);
                }
            }

            if (currentTarget == null || !this.isValidTarget(currentTarget)) {
                currentTarget = this.findTarget();
            }

            if (currentTarget == null) {
                this.attackCooldown = System.currentTimeMillis();
                this.currentRotation = new Rotation(MinecraftClient.getInstance().player.yaw, MinecraftClient.getInstance().player.pitch);
                return false;
            }

            if (currentTarget != null && this.canAttack()) {
                if (!MinecraftClient.getInstance().player.isSneaking()) {
                    if (MinecraftClient.getInstance().player.isSprinting()) {
                        MinecraftClient.getInstance().player.networkHandler.sendPacket(
                            new ClientCommandPacket(MinecraftClient.getInstance().player, ClientCommandPacket.Mode.STOP_SPRINTING)
                        );
                        MinecraftClient.getInstance().player.setSprinting(false);
                    }
                    MinecraftClient.getInstance().player.input.movementForward = 0.0F;
                    MinecraftClient.getInstance().player.input.movementSideways = 0.0F;
                    MinecraftClient.getInstance().options.sprintKey.setPressed(false);
                    MinecraftClient.getInstance().player.setSneaking(false);
                    moduleManager.killerAura.setEnabled(false);
                }
                this.performAttack(currentTarget);
            }
        }

        if (packet instanceof PlayerLookPositionPacket lookPacket) {
            if (currentTarget != null && !moduleManager.testModule.isActive) {
                lookPacket.setPitch(this.currentRotation.pitch);
                lookPacket.setYaw(this.currentRotation.yaw);
                MinecraftClient.getInstance().player.headYaw = this.currentRotation.yaw;
                MinecraftClient.getInstance().player.prevYaw = !this.modeSetting.isCurrentMode("SpookyTime") && !this.settings.isEnabled(8)
                    ? this.currentRotation.yaw
                    : MathUtils.lerpAngle(this.currentRotation.yaw, this.currentRotation.yaw);
                MinecraftClient.getInstance().player.renderPitch = this.currentRotation.pitch;
            }
        }

        if (packet instanceof PlayerPositionPacket positionPacket) {
            positionPacket.setPitch(this.currentRotation.pitch);
            positionPacket.setYaw(this.currentRotation.yaw);
        }

        return false;
    }
}
может быть не правильным хз ну вроде норм
ауру одобрили а лики нет че за фигня(
 
Последнее редактирование:
code:
Expand Collapse Copy
package wprotect;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.Objects;
import wprotect.RaycastContext.FluidHandling;
import wprotect.RaycastContext.ShapeType;

@ModuleInfo(
    name = "Aura",
    category = ModuleCategory.COMBAT
)
public class Aura extends Module {
   
    // элитро ротейшин
    public NumberSetting elytraRotation = new NumberSetting("Элитра ротация", "Elytra Rotation", 12.5F, 0.0F, 32.0F, 0.5F, () -> this.modeSetting.isCurrentMode("Grim"));
   
    // цель
    public static LivingEntity currentTarget = null;
   
    // кого таргетить будем
    public MultiBooleanSetting targetSelection = new MultiBooleanSetting("Таргеты", "Target Selection",
        new BooleanSetting[]{
            new BooleanSetting("Игроки", "Players", true),
            new BooleanSetting("Друзья", "Friends", false),
            new BooleanSetting("Голые игроки", "Naked Players", true),
            new BooleanSetting("Монстры", "Monsters", false)
        });
   
    // ротка
    public NumberSetting rotationSetting = new NumberSetting("Ротация", "Rotation", 0.0F, 0.0F, 32.0F, 1.0F, () -> this.modeSetting.isCurrentMode("Grim"));
   
    // сетинги
    public MultiBooleanSetting settings = new MultiBooleanSetting("Настройки", "Settings",
        new BooleanSetting[]{
            new BooleanSetting("Только криты", "Crit Only", true),
            new BooleanSetting("Коррекция движения", "Movement Correction", true),
            new BooleanSetting("Отжимать щит", "Unpress Shield", true),
            new BooleanSetting("Ломать щит", "Break Shield", true),
            new BooleanSetting("Только с пробелом", "Only with space", false),
            new BooleanSetting("Бить через стены", "Hit Through Walls", true),
            new BooleanSetting("Бить и есть", "With eat", false),
            new BooleanSetting("Выключить интерполяцию", "Disable Interpolation", false),
            new BooleanSetting("Коррекция Yaw", "Yaw Correction", false),
            new BooleanSetting("Тестовая Grim ротация", "Test Grim rotation", false)
        });
   
    public double previousSpeed;
    public Timer rotationTimer = new Timer();
    public Timer attackTimer = new Timer();
    public static NumberSetting elytraDistance = new NumberSetting("Расстояние (Элитры)", "Distance (Elytra)", 3.0F, 2.5F, 5.5F, 0.1F);
    public boolean isSpookyAttack;
    public long attackCooldown = 0L;
    public double currentSpeed;
    public boolean spookyFlag;
   
    public ModeSetting sortingMode = new ModeSetting("Сортировка", "Sorting", "All",
        new String[]{"All", "By Health", "By Distance", "Advanced"});
   
    public ModeSetting modeSetting = new ModeSetting("Режим", "Mode", "Grim",
        new String[]{"Grim", "SpookyTime"});
   
    public ModeSetting correctionMode = new ModeSetting("Режим коррекции", "Correction Mode", "FreeLook",
        new String[]{"FreeLook", "Focused"});
   
    public Rotation currentRotation = new Rotation(0.0F, 0.0F);
    public static NumberSetting attackDistance = new NumberSetting("Расстояние", "Distance", 3.0F, 2.5F, 5.5F, 0.1F);

    public static LivingEntity getCurrentTarget() {
        return currentTarget;
    }

    public Rotation calculateRotation(LivingEntity entity, boolean elytraTarget, ElytraVector elytraVector) {
        if (this.rotationTimer.hasPassed(200L)) {
            double deltaX = entity.lastRenderX - entity.prevRenderX;
            double deltaY = entity.lastRenderY - entity.prevRenderY;
            double deltaZ = entity.lastRenderZ - entity.prevRenderZ;
            double horizontalDistance = Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ);
            this.previousSpeed = this.currentSpeed;
            this.currentSpeed = horizontalDistance * 20.0;
            this.rotationTimer.reset();
        }

        float elytraSpeed = elytraVector.target.getSpeed();
        Vec3d interpolatedPosition = entity.getBoundingBox().getCenter().add(elytraSpeed);
        Vec3d cameraPosition = MinecraftClient.getInstance().gameRenderer.getCamera().getPos();
       
        boolean isFastTarget = this.currentSpeed >= 20.0 && (this.currentSpeed != this.previousSpeed || this.currentSpeed == 0.0);
       
        Vec3d targetPosition = entity.getPos().add(0.0, entity.getHeight() / 2.0, 0.0);
       
        if (elytraTarget) {
            if (MinecraftClient.getInstance().player.isFallFlying() && entity.isFallFlying() && isFastTarget) {
                targetPosition = entity.getPos().subtract(interpolatedPosition);
            }
        }

        if (MinecraftClient.getInstance().player.isFallFlying()) {
            Vec3d relativePos = targetPosition.subtract(MinecraftClient.getInstance().player.getPos());
            float yaw = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(relativePos.z, relativePos.x)) - 90.0);
            float pitch = (float) MathHelper.wrapDegrees(Math.toDegrees(-Math.atan2(relativePos.y, Math.hypot(relativePos.x, relativePos.z))));
            return new Rotation(yaw, pitch);
        } else {
            Vec3d direction = targetPosition.subtract(cameraPosition).normalize();
            float yaw = (float) Math.toDegrees(Math.atan2(-direction.x, direction.z));
            float pitch = (float) Math.toDegrees(Math.asin(direction.y));
            return new Rotation(yaw, -pitch);
        }
    }

    public Aura() {
        this.registerSettings(new Setting[]{
            this.modeSetting,
            this.targetSelection,
            attackDistance,
            elytraDistance,
            this.rotationSetting,
            this.elytraRotation,
            this.correctionMode,
            this.sortingMode,
            this.settings
        });
    }

    public double calculateArmorProtection(PlayerEntity player) {
        double totalProtection = 0.0;

        for (ItemStack armorPiece : player.getInventory().armor) {
            if (armorPiece != null && armorPiece.getItem() instanceof ArmorItem) {
                totalProtection += this.getArmorProtection(armorPiece);
            }
        }

        return totalProtection;
    }

    public void onEnable() {
        NewCodeClient.getInstance().getModuleManager().killerAura.setEnabled(true);
        if (MinecraftClient.getInstance().player != null) {
            this.currentRotation = new Rotation(MinecraftClient.getInstance().player.yaw, MinecraftClient.getInstance().player.pitch);
            currentTarget = null;
        }
        this.attackCooldown = System.currentTimeMillis();
        super.onEnable();
    }

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

        for (Entity entity : MinecraftClient.getInstance().world.getEntities()) {
            if (entity instanceof LivingEntity && this.isValidTarget((LivingEntity) entity)) {
                targets.add((LivingEntity) entity);
            }
        }

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

        if (targets.size() > 1) {
            switch (this.sortingMode.getValue()) {
                case "All":
                    targets.sort(Comparator.comparingDouble((target) -> {
                        if (target instanceof PlayerEntity player) {
                            return -this.calculateArmorProtection(player);
                        } else if (target instanceof LivingEntity living) {
                            return -living.getHealth();
                        }
                        return 0.0;
                    }).thenComparing((t1, t2) -> {
                        double d1 = this.getEffectiveHealth((LivingEntity) t1);
                        double d2 = this.getEffectiveHealth((LivingEntity) t2);
                        return Double.compare(d1, d2);
                    }).thenComparing((t1, t2) -> {
                        double d1 = this.getDistanceToTarget((LivingEntity) t1);
                        double d2 = this.getDistanceToTarget((LivingEntity) t2);
                        return Double.compare(d1, d2);
                    }));
                    break;
                case "Advanced":
                    targets.sort(Comparator.comparingDouble((target) -> {
                        if (target instanceof PlayerEntity player) {
                            return player.getEquippedStack(EquipmentSlot.CHEST).getItem() == Items.ELYTRA ? Double.MIN_VALUE : -this.calculateArmorProtection(player);
                        } else if (target instanceof LivingEntity living) {
                            return -living.getHealth();
                        }
                        return 0.0;
                    }).thenComparing((t1, t2) -> {
                        double d1 = this.getEffectiveHealth((LivingEntity) t1);
                        double d2 = this.getEffectiveHealth((LivingEntity) t2);
                        return Double.compare(d1, d2);
                    }).thenComparing((t1, t2) -> {
                        double d1 = this.getDistanceToTarget((LivingEntity) t1);
                        double d2 = this.getDistanceToTarget((LivingEntity) t2);
                        return Double.compare(d1, d2);
                    }));
                    break;
                case "By Distance":
                    Aura aura = NewCodeClient.getInstance().getModuleManager().aura;
                    Objects.requireNonNull(aura);
                    targets.sort(Comparator.comparingDouble(aura::getDistanceToTarget).thenComparingDouble(this::getEffectiveHealth));
                    break;
                case "By Health":
                    Comparator<LivingEntity> healthComparator = Comparator.comparingDouble(this::getEffectiveHealth);
                    ClientPlayerEntity player = MinecraftClient.getInstance().player;
                    Objects.requireNonNull(player);
                    targets.sort(healthComparator.thenComparingDouble(player::distanceTo));
            }
        } else {
            this.attackCooldown = System.currentTimeMillis();
        }

        return targets.get(0);
    }

    public boolean canAttack() {
        boolean hasShield = this.settings.isEnabled(4) && MinecraftClient.getInstance().player.isBlocking() && !MinecraftClient.getInstance().crosshairTarget.isEntity();
        boolean isBlocking = NewCodeClient.getInstance().getModuleManager().criticals.isEnabled() && !Criticals.canCrit()
            && !MinecraftClient.getInstance().player.isUsingItem()
            && !MinecraftClient.getInstance().player.isSleeping()
            && (!MinecraftClient.getInstance().player.isFallFlying() || !MinecraftClient.getInstance().player.isTouchingWater())
            && !MinecraftClient.getInstance().player.isRiding()
            && !MinecraftClient.getInstance().player.abilities.flying
            && !MinecraftClient.getInstance().player.isFallFlying()
            && !MinecraftClient.getInstance().player.isUsingRiptide()
            && !MinecraftClient.getInstance().player.isClimbing();
       
        double distance = this.getDistanceToTarget(currentTarget);
        boolean inRange = distance < (MinecraftClient.getInstance().player.isFallFlying() ? elytraDistance.getValue() : attackDistance.getValue());
        boolean cooldownReady = MinecraftClient.getInstance().player.getAttackCooldownProgress(1.5F) >= 0.93F && this.attackCooldown <= System.currentTimeMillis();
       
        if (inRange && cooldownReady) {
            if (!isBlocking && this.settings.isEnabled(0)) {
                return hasShield || MinecraftClient.getInstance().player.isBlocking() || MinecraftClient.getInstance().player.attackCooldownProgress <= 0.0F;
            }
            return true;
        }
        return false;
    }

    public void attackTarget(LivingEntity target) {
        ModuleManager moduleManager = NewCodeClient.getInstance().getModuleManager();
        Vec3d attackVec;
       
        if (moduleManager.elytraFly.isEnabled()) {
            Rotation rotation = this.calculateRotation(target, true, moduleManager.elytraFly);
            float yawRad = (float) Math.toRadians(rotation.yaw);
            float pitchRad = (float) Math.toRadians(rotation.pitch);
            double x = -MathHelper.sin(yawRad) * MathHelper.cos(pitchRad);
            double y = -MathHelper.sin(pitchRad);
            double z = MathHelper.cos(yawRad) * MathHelper.cos(pitchRad);
            attackVec = new Vec3d(x, y, z);
        } else {
            Vec3d targetPos = target.getPos();
            targetPos = targetPos.add(0.0,
                MinecraftClient.getInstance().player.isFallFlying() && (target.isFallFlying() || target.isGliding()) && moduleManager.elytraFly.isEnabled()
                    ? MathHelper.clamp(target.getY() - target.getHeight(), 0.0, target.getHeight() / 2.0)
                    : target.getHeight() - 0.2,
                0.0);
            attackVec = targetPos.subtract(MinecraftClient.getInstance().player.getPos());
           
            if (MinecraftClient.getInstance().player.isFallFlying() && (target.isFallFlying() || target.isGliding()) && moduleManager.elytraFly.isEnabled()) {
                double expansion = moduleManager.elytraFly.target.getSpeed() / 20.0;
                Vec3d targetBox = target.getBoundingBox().expand(expansion, expansion, expansion);
                Vec3d playerBox = MinecraftClient.getInstance().player.getBoundingBox().expand(0.1, 0.1, 0.1);
                attackVec = attackVec.add(targetBox).add(playerBox);
            }
        }

        float targetYaw = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(attackVec.z, attackVec.x)) - 90.0);
        float targetPitch = (float) -Math.toDegrees(Math.atan2(attackVec.y, Math.hypot(attackVec.x, attackVec.z)));
       
        float yawDiff = MathHelper.wrapDegrees(targetYaw - this.currentRotation.yaw);
        float pitchDiff = MathHelper.wrapDegrees(targetPitch - this.currentRotation.pitch);
       
        float maxRotation = 150.0F;
        float yawStep = Math.min(Math.max(Math.abs(yawDiff), 0.0F), maxRotation);
        float pitchStep = Math.max(Math.abs(pitchDiff), 0.0F);
       
        float gcd = RotationUtils.getGCD();
       
        if (!this.settings.isEnabled(7)) {
            attackVec.add(target.lastRenderX - target.prevX, target.lastRenderY - target.prevY, target.lastRenderZ - target.prevZ);
        }

        switch (this.modeSetting.getIndex()) {
            case 0: // Grim mode
                if (!NewCodeClient.getInstance().getModuleManager().testModule.isActive) {
                    if (MinecraftClient.getInstance().player.isFallFlying() && (target.isFallFlying() || target.isGliding()) && NewCodeClient.getInstance().getModuleManager().elytraFly.isEnabled()) {
                        float elytraYawStep = Math.min(Math.max(Math.abs(yawDiff), 1.0F), maxRotation * 1.2F);
                        float elytraPitchStep = Math.max(Math.abs(pitchDiff), 1.0F);
                        float elytraRotationOffset = RotationUtils.getGCD((float) (Math.cos(System.currentTimeMillis() / 50.0) * NewCodeClient.getInstance().getModuleManager().elytraFly.targetSetting.getValue()));
                       
                        float newYaw = this.currentRotation.yaw + (yawDiff > 0.0F ? elytraYawStep : -elytraYawStep) + elytraRotationOffset;
                        float newPitch = MathHelper.clamp(this.currentRotation.pitch + (pitchDiff > 0.0F ? elytraPitchStep : -elytraPitchStep), -89.0F, 89.0F) + elytraRotationOffset;
                       
                        float gcdHalf = RotationUtils.getGCD() * 0.5F;
                        newYaw -= (newYaw - this.currentRotation.yaw) % gcdHalf;
                        newPitch -= (newPitch - this.currentRotation.pitch) % gcdHalf;
                       
                        this.currentRotation = new Rotation(newYaw, newPitch);
                    } else {
                        float randomYawOffset = (float) (Math.random() * 1.15);
                        float randomPitchOffset = (float) (Math.random() * 1.15);
                       
                        float newYaw = this.currentRotation.yaw + (yawDiff > 0.0F ? yawStep : -yawStep);
                        float newPitch = MathHelper.clamp(this.currentRotation.pitch + (pitchDiff > 0.0F ? pitchStep : -pitchStep), -89.0F, 89.0F);
                       
                        if (!MinecraftClient.getInstance().player.isFallFlying() && this.settings.isEnabled(9)) {
                            newYaw += randomYawOffset;
                            newPitch += randomPitchOffset;
                        }
                       
                        newYaw -= (newYaw - this.currentRotation.yaw) % gcd;
                        newPitch -= (newPitch - this.currentRotation.pitch) % gcd;
                       
                        this.currentRotation = new Rotation(newYaw, newPitch);
                    }
                }
                break;
               
            case 1: // SpookyTime mode
                float attackProgress = MinecraftClient.getInstance().player.lastAttackedTicks;
                boolean lowProgress = attackProgress > 0.0F && attackProgress < 0.7F;
                boolean highProgress = attackProgress >= 0.7F && attackProgress < 1.0F;
               
                if ((lowProgress || highProgress) && !this.spookyFlag) {
                    this.spookyFlag = true;
                } else if (!lowProgress && !highProgress && this.spookyFlag) {
                    this.isSpookyAttack = true;
                    this.attackTimer.reset();
                    this.spookyFlag = false;
                }
               
                if (this.isSpookyAttack && this.attackTimer.hasPassed(0)) {
                    this.isSpookyAttack = false;
                }
               
                float smoothing, maxYaw, maxPitch, randomFactor;
                if (highProgress) {
                    smoothing = 0.4F;
                    maxYaw = 175.0F;
                    maxPitch = 8.0F;
                    randomFactor = 0.01F;
                } else if (lowProgress) {
                    smoothing = 0.5F;
                    maxYaw = 70.0F;
                    maxPitch = 65.0F;
                    randomFactor = 0.09F;
                } else {
                    smoothing = 0.8F;
                    maxYaw = 45.0F;
                    maxPitch = 40.0F;
                    randomFactor = 0.15F;
                }
               
                yawStep = MathHelper.clamp(Math.abs(yawDiff), 0.3F, maxYaw);
                pitchStep = MathHelper.clamp(Math.abs(pitchDiff), 0.25F, maxPitch);
               
                if (Math.abs(yawDiff) < 5.0F && !highProgress) {
                    yawStep *= 0.8F + 0.05F * (float) Math.sin(0.0);
                }
               
                if (highProgress || lowProgress) {
                    float progressMultiplier = 2.0F - (float) Math.pow(attackProgress, 2.0);
                    yawStep *= progressMultiplier;
                    pitchStep *= progressMultiplier;
                }
               
                float finalYaw, finalPitch;
                if (highProgress) {
                    finalYaw = this.currentRotation.yaw;
                    finalPitch = MathHelper.clamp(this.currentRotation.pitch + (int) yawDiff, -60.0F, 60.0F);
                } else {
                    finalYaw = this.currentRotation.yaw + (yawDiff > 0.0F ? yawStep : -yawStep) * (1.0F - randomFactor * (float) Math.abs(Math.sin(0.0)));
                    finalPitch = MathHelper.clamp(this.currentRotation.pitch + (pitchDiff > 0.0F ? pitchStep : -pitchStep) - 12.0F, -85.0F, 85.0F + pitchStep);
                }
               
                if (!highProgress && !lowProgress && !this.isSpookyAttack) {
                    finalYaw += (Math.random() - 0.5) * 0.2;
                    finalPitch += (Math.random() - 0.5) * 0.1;
                }
               
                gcd = RotationUtils.getGCD() * (highProgress || lowProgress ? 0.7F : 1.0F);
                finalYaw -= (finalYaw - this.currentRotation.yaw) % gcd;
                finalPitch -= (finalPitch - this.currentRotation.pitch) % gcd;
               
                this.currentRotation = new Rotation(
                    finalYaw * smoothing + this.currentRotation.yaw * (1.0F - smoothing),
                    finalPitch * smoothing + this.currentRotation.pitch * (1.0F - smoothing)
                );
                break;
        }
    }

    public double getEffectiveHealth(Entity entity) {
        if (entity instanceof PlayerEntity player) {
            double armorReduction = this.calculateArmorProtection(player) / 20.0;
            return (player.getHealth() + player.getAbsorptionAmount()) * armorReduction;
        } else if (entity instanceof LivingEntity living) {
            return living.getHealth() + living.getAbsorptionAmount();
        }
        return 0.0;
    }

    public double getDistanceToTarget(LivingEntity target) {
        return RotationUtils.getDistanceToEntity(target).getLength();
    }

    public double getArmorProtection(ItemStack armor) {
        ArmorItem armorItem = (ArmorItem) armor.getItem();
        double protection = armorItem.getProtection();
        if (armor.hasEnchantments()) {
            protection += EnchantmentHelper.getLevel(Enchantments.PROTECTION, armor) * 0.25;
        }
        return protection;
    }

    public boolean hasLineOfSight(LivingEntity target) {
        Vec3d targetPos = target.getPos().add(0.0, (double) target.getStandingEyeHeight(), 0.0);
        Vec3d playerPos = MinecraftClient.getInstance().player.getPos().add(0.0, (double) MinecraftClient.getInstance().player.getStandingEyeHeight(), 0.0);
        BlockHitResult raycast = MinecraftClient.getInstance().world.raycast(new RaycastContext(
            playerPos, targetPos,
            RaycastContext.ShapeType.COLLIDER,
            RaycastContext.FluidHandling.NONE,
            MinecraftClient.getInstance().player
        ));
        return raycast.getType() == RaycastResult.Type.MISS;
    }

    public void performAttack(LivingEntity target) {
        if (this.settings.isEnabled(2)) {
            if (MinecraftClient.getInstance().player.isUsingItem()) {
                MinecraftClient.getInstance().interactionManager.stopUsingItem(MinecraftClient.getInstance().player);
            }
        }

        this.attackCooldown = System.currentTimeMillis() + 555L;
        Criticals.isCritting = true;
       
        if (NewCodeClient.getInstance().getModuleManager().criticals.isEnabled() && Criticals.canCrit()) {
            NewCodeClient.getInstance().getModuleManager().criticals.doCrit();
        }

        MinecraftClient.getInstance().interactionManager.attackEntity(MinecraftClient.getInstance().player, target);
        MinecraftClient.getInstance().player.swingHand(Hand.MAIN_HAND);
        Criticals.isCritting = false;
       
        if (this.settings.isEnabled(3)) {
            ShieldBreaker.breakShield();
        }
    }

    public boolean isValidTarget(LivingEntity entity) {
        if (entity == null || entity == MinecraftClient.getInstance().player || !entity.isAlive() || entity.isRemoved()) {
            return false;
        }
       
        if (entity instanceof PlayerEntity player) {
            String name = player.getGameProfile().getName();
            boolean isFriend = FriendManager.isFriend(name);
            boolean isTeammate = NewCodeClient.getInstance().getModuleManager().teams.getTarget() != null
                && name.equals(NewCodeClient.getInstance().getModuleManager().teams.getTarget().getGameProfile().getName());
            boolean isNaked = player.getArmor() == 0;
           
            if ((isFriend && !this.targetSelection.isEnabled(1))
                || isTeammate
                || (isNaked && (!this.targetSelection.isEnabled(0) || !this.targetSelection.isEnabled(2)))) {
                return false;
            }
        }

        if (AntiBot.isBot(entity)) {
            return false;
        }
       
        if (entity instanceof PassiveEntity && !this.targetSelection.isEnabled(3)) {
            return false;
        }
       
        if (entity instanceof PlayerEntity && !this.targetSelection.isEnabled(0)) {
            return false;
        }
       
        if (!(entity instanceof HostileEntity) && (!(entity instanceof PlayerEntity) || !((PlayerEntity) entity).isCreative())) {
            if (!this.settings.isEnabled(5) && !this.hasLineOfSight(entity)) {
                return false;
            }
           
            float elytraOffset = MinecraftClient.getInstance().player.isFallFlying() ? this.elytraRotation.getValue() : 0.0F;
            float rotationOffset = this.modeSetting.isCurrentMode("Grim") ? this.rotationSetting.getValue() + elytraOffset : 0.0F;
            double maxDistance = MinecraftClient.getInstance().player.isFallFlying()
                ? elytraDistance.getValue()
                : attackDistance.getValue() + rotationOffset;
           
            return this.getDistanceToTarget(entity) <= maxDistance;
        }
        return false;
    }

    public boolean onPacket(Packet<?> packet) {
        ModuleManager moduleManager = NewCodeClient.getInstance().getModuleManager();
       
        if (packet instanceof PlayerMoveC2SPacket movePacket) {
            if (movePacket.isOnGround() && currentTarget != MinecraftClient.getInstance().player && currentTarget != null) {
                if (MinecraftClient.getInstance().player.isFallFlying()
                    && moduleManager.elytraFly.isActive
                    && moduleManager.elytraFly.isEnabled()) {
                   
                    ElytraFly.sendElytraStart();
                    ElytraFly.sendElytraTick();
                   
                    Vec3d velocity = currentTarget.getVelocity();
                    float speed = moduleManager.elytraFly.target.getSpeed();
                    Vec3d offset = velocity.multiply(speed);
                   
                    if (currentTarget.isFallFlying()) {
                        Vec3d direction = MinecraftClient.getInstance().getNetworkHandler().getConnection().getChannel().remoteAddress();
                        // Отправка пакета движения с учетом элитры
                    }
                   
                    ElytraFly.sendElytraEnd();
                    ElytraFly.sendElytraStop();
                }
            }
        }

        if (packet instanceof EntitySpawnPacket spawnPacket) {
            if (spawnPacket.isAlive()) {
                PacketEntityType entityType = spawnPacket.getEntityType();
                if (entityType instanceof PlayerEntityPacket) {
                    PlayerEntityPacket playerPacket = (PlayerEntityPacket) entityType;
                    if (MinecraftClient.getInstance().world != null && MinecraftClient.getInstance().player != null) {
                        Entity entity = playerPacket.getEntity(MinecraftClient.getInstance().world);
                        if (entity instanceof PlayerEntity player) {
                            if (player != currentTarget) {
                                currentTarget = player;
                            }
                        }
                    }
                }
            }
        }

        if (packet instanceof KeepAlivePacket keepAlive) {
            if (currentTarget != null) {
                keepAlive.setResponse(true);
            }
        }

        if (packet instanceof PlayerInputPacket inputPacket) {
            if (this.settings.isEnabled(1) && this.correctionMode.isCurrentMode("FreeLook") && moduleManager.teams.getTarget() == null) {
                float yaw;
                if (moduleManager.testModule.isActive) {
                    yaw = MinecraftClient.getInstance().player.yaw;
                } else {
                    yaw = this.currentRotation.yaw;
                }
                MovementUtils.setYaw(inputPacket, yaw);
            }
        }

        if ((packet instanceof PlayerInteractEntityPacket && !this.modeSetting.isCurrentMode("FunTime")
            || packet instanceof ClientCommandPacket && this.modeSetting.isCurrentMode("FunTime"))
            && currentTarget != null) {
            this.attackTarget(currentTarget);
        }

        if (packet instanceof ClientCommandPacket) {
            if (currentTarget != null) {
                if (!MinecraftClient.getInstance().player.isBlocking()) {
                    moduleManager.killerAura.setEnabled(true);
                }
            }

            if (currentTarget == null || !this.isValidTarget(currentTarget)) {
                currentTarget = this.findTarget();
            }

            if (currentTarget == null) {
                this.attackCooldown = System.currentTimeMillis();
                this.currentRotation = new Rotation(MinecraftClient.getInstance().player.yaw, MinecraftClient.getInstance().player.pitch);
                return false;
            }

            if (currentTarget != null && this.canAttack()) {
                if (!MinecraftClient.getInstance().player.isSneaking()) {
                    if (MinecraftClient.getInstance().player.isSprinting()) {
                        MinecraftClient.getInstance().player.networkHandler.sendPacket(
                            new ClientCommandPacket(MinecraftClient.getInstance().player, ClientCommandPacket.Mode.STOP_SPRINTING)
                        );
                        MinecraftClient.getInstance().player.setSprinting(false);
                    }
                    MinecraftClient.getInstance().player.input.movementForward = 0.0F;
                    MinecraftClient.getInstance().player.input.movementSideways = 0.0F;
                    MinecraftClient.getInstance().options.sprintKey.setPressed(false);
                    MinecraftClient.getInstance().player.setSneaking(false);
                    moduleManager.killerAura.setEnabled(false);
                }
                this.performAttack(currentTarget);
            }
        }

        if (packet instanceof PlayerLookPositionPacket lookPacket) {
            if (currentTarget != null && !moduleManager.testModule.isActive) {
                lookPacket.setPitch(this.currentRotation.pitch);
                lookPacket.setYaw(this.currentRotation.yaw);
                MinecraftClient.getInstance().player.headYaw = this.currentRotation.yaw;
                MinecraftClient.getInstance().player.prevYaw = !this.modeSetting.isCurrentMode("SpookyTime") && !this.settings.isEnabled(8)
                    ? this.currentRotation.yaw
                    : MathUtils.lerpAngle(this.currentRotation.yaw, this.currentRotation.yaw);
                MinecraftClient.getInstance().player.renderPitch = this.currentRotation.pitch;
            }
        }

        if (packet instanceof PlayerPositionPacket positionPacket) {
            positionPacket.setPitch(this.currentRotation.pitch);
            positionPacket.setYaw(this.currentRotation.yaw);
        }

        return false;
    }
}
может быть не правильным хз ну вроде норм
ауру одобрили а лики нет че за фигня(
зачем?..
 
code:
Expand Collapse Copy
package wprotect;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.Objects;
import wprotect.RaycastContext.FluidHandling;
import wprotect.RaycastContext.ShapeType;

@ModuleInfo(
    name = "Aura",
    category = ModuleCategory.COMBAT
)
public class Aura extends Module {
   
    // элитро ротейшин
    public NumberSetting elytraRotation = new NumberSetting("Элитра ротация", "Elytra Rotation", 12.5F, 0.0F, 32.0F, 0.5F, () -> this.modeSetting.isCurrentMode("Grim"));
   
    // цель
    public static LivingEntity currentTarget = null;
   
    // кого таргетить будем
    public MultiBooleanSetting targetSelection = new MultiBooleanSetting("Таргеты", "Target Selection",
        new BooleanSetting[]{
            new BooleanSetting("Игроки", "Players", true),
            new BooleanSetting("Друзья", "Friends", false),
            new BooleanSetting("Голые игроки", "Naked Players", true),
            new BooleanSetting("Монстры", "Monsters", false)
        });
   
    // ротка
    public NumberSetting rotationSetting = new NumberSetting("Ротация", "Rotation", 0.0F, 0.0F, 32.0F, 1.0F, () -> this.modeSetting.isCurrentMode("Grim"));
   
    // сетинги
    public MultiBooleanSetting settings = new MultiBooleanSetting("Настройки", "Settings",
        new BooleanSetting[]{
            new BooleanSetting("Только криты", "Crit Only", true),
            new BooleanSetting("Коррекция движения", "Movement Correction", true),
            new BooleanSetting("Отжимать щит", "Unpress Shield", true),
            new BooleanSetting("Ломать щит", "Break Shield", true),
            new BooleanSetting("Только с пробелом", "Only with space", false),
            new BooleanSetting("Бить через стены", "Hit Through Walls", true),
            new BooleanSetting("Бить и есть", "With eat", false),
            new BooleanSetting("Выключить интерполяцию", "Disable Interpolation", false),
            new BooleanSetting("Коррекция Yaw", "Yaw Correction", false),
            new BooleanSetting("Тестовая Grim ротация", "Test Grim rotation", false)
        });
   
    public double previousSpeed;
    public Timer rotationTimer = new Timer();
    public Timer attackTimer = new Timer();
    public static NumberSetting elytraDistance = new NumberSetting("Расстояние (Элитры)", "Distance (Elytra)", 3.0F, 2.5F, 5.5F, 0.1F);
    public boolean isSpookyAttack;
    public long attackCooldown = 0L;
    public double currentSpeed;
    public boolean spookyFlag;
   
    public ModeSetting sortingMode = new ModeSetting("Сортировка", "Sorting", "All",
        new String[]{"All", "By Health", "By Distance", "Advanced"});
   
    public ModeSetting modeSetting = new ModeSetting("Режим", "Mode", "Grim",
        new String[]{"Grim", "SpookyTime"});
   
    public ModeSetting correctionMode = new ModeSetting("Режим коррекции", "Correction Mode", "FreeLook",
        new String[]{"FreeLook", "Focused"});
   
    public Rotation currentRotation = new Rotation(0.0F, 0.0F);
    public static NumberSetting attackDistance = new NumberSetting("Расстояние", "Distance", 3.0F, 2.5F, 5.5F, 0.1F);

    public static LivingEntity getCurrentTarget() {
        return currentTarget;
    }

    public Rotation calculateRotation(LivingEntity entity, boolean elytraTarget, ElytraVector elytraVector) {
        if (this.rotationTimer.hasPassed(200L)) {
            double deltaX = entity.lastRenderX - entity.prevRenderX;
            double deltaY = entity.lastRenderY - entity.prevRenderY;
            double deltaZ = entity.lastRenderZ - entity.prevRenderZ;
            double horizontalDistance = Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ);
            this.previousSpeed = this.currentSpeed;
            this.currentSpeed = horizontalDistance * 20.0;
            this.rotationTimer.reset();
        }

        float elytraSpeed = elytraVector.target.getSpeed();
        Vec3d interpolatedPosition = entity.getBoundingBox().getCenter().add(elytraSpeed);
        Vec3d cameraPosition = MinecraftClient.getInstance().gameRenderer.getCamera().getPos();
       
        boolean isFastTarget = this.currentSpeed >= 20.0 && (this.currentSpeed != this.previousSpeed || this.currentSpeed == 0.0);
       
        Vec3d targetPosition = entity.getPos().add(0.0, entity.getHeight() / 2.0, 0.0);
       
        if (elytraTarget) {
            if (MinecraftClient.getInstance().player.isFallFlying() && entity.isFallFlying() && isFastTarget) {
                targetPosition = entity.getPos().subtract(interpolatedPosition);
            }
        }

        if (MinecraftClient.getInstance().player.isFallFlying()) {
            Vec3d relativePos = targetPosition.subtract(MinecraftClient.getInstance().player.getPos());
            float yaw = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(relativePos.z, relativePos.x)) - 90.0);
            float pitch = (float) MathHelper.wrapDegrees(Math.toDegrees(-Math.atan2(relativePos.y, Math.hypot(relativePos.x, relativePos.z))));
            return new Rotation(yaw, pitch);
        } else {
            Vec3d direction = targetPosition.subtract(cameraPosition).normalize();
            float yaw = (float) Math.toDegrees(Math.atan2(-direction.x, direction.z));
            float pitch = (float) Math.toDegrees(Math.asin(direction.y));
            return new Rotation(yaw, -pitch);
        }
    }

    public Aura() {
        this.registerSettings(new Setting[]{
            this.modeSetting,
            this.targetSelection,
            attackDistance,
            elytraDistance,
            this.rotationSetting,
            this.elytraRotation,
            this.correctionMode,
            this.sortingMode,
            this.settings
        });
    }

    public double calculateArmorProtection(PlayerEntity player) {
        double totalProtection = 0.0;

        for (ItemStack armorPiece : player.getInventory().armor) {
            if (armorPiece != null && armorPiece.getItem() instanceof ArmorItem) {
                totalProtection += this.getArmorProtection(armorPiece);
            }
        }

        return totalProtection;
    }

    public void onEnable() {
        NewCodeClient.getInstance().getModuleManager().killerAura.setEnabled(true);
        if (MinecraftClient.getInstance().player != null) {
            this.currentRotation = new Rotation(MinecraftClient.getInstance().player.yaw, MinecraftClient.getInstance().player.pitch);
            currentTarget = null;
        }
        this.attackCooldown = System.currentTimeMillis();
        super.onEnable();
    }

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

        for (Entity entity : MinecraftClient.getInstance().world.getEntities()) {
            if (entity instanceof LivingEntity && this.isValidTarget((LivingEntity) entity)) {
                targets.add((LivingEntity) entity);
            }
        }

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

        if (targets.size() > 1) {
            switch (this.sortingMode.getValue()) {
                case "All":
                    targets.sort(Comparator.comparingDouble((target) -> {
                        if (target instanceof PlayerEntity player) {
                            return -this.calculateArmorProtection(player);
                        } else if (target instanceof LivingEntity living) {
                            return -living.getHealth();
                        }
                        return 0.0;
                    }).thenComparing((t1, t2) -> {
                        double d1 = this.getEffectiveHealth((LivingEntity) t1);
                        double d2 = this.getEffectiveHealth((LivingEntity) t2);
                        return Double.compare(d1, d2);
                    }).thenComparing((t1, t2) -> {
                        double d1 = this.getDistanceToTarget((LivingEntity) t1);
                        double d2 = this.getDistanceToTarget((LivingEntity) t2);
                        return Double.compare(d1, d2);
                    }));
                    break;
                case "Advanced":
                    targets.sort(Comparator.comparingDouble((target) -> {
                        if (target instanceof PlayerEntity player) {
                            return player.getEquippedStack(EquipmentSlot.CHEST).getItem() == Items.ELYTRA ? Double.MIN_VALUE : -this.calculateArmorProtection(player);
                        } else if (target instanceof LivingEntity living) {
                            return -living.getHealth();
                        }
                        return 0.0;
                    }).thenComparing((t1, t2) -> {
                        double d1 = this.getEffectiveHealth((LivingEntity) t1);
                        double d2 = this.getEffectiveHealth((LivingEntity) t2);
                        return Double.compare(d1, d2);
                    }).thenComparing((t1, t2) -> {
                        double d1 = this.getDistanceToTarget((LivingEntity) t1);
                        double d2 = this.getDistanceToTarget((LivingEntity) t2);
                        return Double.compare(d1, d2);
                    }));
                    break;
                case "By Distance":
                    Aura aura = NewCodeClient.getInstance().getModuleManager().aura;
                    Objects.requireNonNull(aura);
                    targets.sort(Comparator.comparingDouble(aura::getDistanceToTarget).thenComparingDouble(this::getEffectiveHealth));
                    break;
                case "By Health":
                    Comparator<LivingEntity> healthComparator = Comparator.comparingDouble(this::getEffectiveHealth);
                    ClientPlayerEntity player = MinecraftClient.getInstance().player;
                    Objects.requireNonNull(player);
                    targets.sort(healthComparator.thenComparingDouble(player::distanceTo));
            }
        } else {
            this.attackCooldown = System.currentTimeMillis();
        }

        return targets.get(0);
    }

    public boolean canAttack() {
        boolean hasShield = this.settings.isEnabled(4) && MinecraftClient.getInstance().player.isBlocking() && !MinecraftClient.getInstance().crosshairTarget.isEntity();
        boolean isBlocking = NewCodeClient.getInstance().getModuleManager().criticals.isEnabled() && !Criticals.canCrit()
            && !MinecraftClient.getInstance().player.isUsingItem()
            && !MinecraftClient.getInstance().player.isSleeping()
            && (!MinecraftClient.getInstance().player.isFallFlying() || !MinecraftClient.getInstance().player.isTouchingWater())
            && !MinecraftClient.getInstance().player.isRiding()
            && !MinecraftClient.getInstance().player.abilities.flying
            && !MinecraftClient.getInstance().player.isFallFlying()
            && !MinecraftClient.getInstance().player.isUsingRiptide()
            && !MinecraftClient.getInstance().player.isClimbing();
       
        double distance = this.getDistanceToTarget(currentTarget);
        boolean inRange = distance < (MinecraftClient.getInstance().player.isFallFlying() ? elytraDistance.getValue() : attackDistance.getValue());
        boolean cooldownReady = MinecraftClient.getInstance().player.getAttackCooldownProgress(1.5F) >= 0.93F && this.attackCooldown <= System.currentTimeMillis();
       
        if (inRange && cooldownReady) {
            if (!isBlocking && this.settings.isEnabled(0)) {
                return hasShield || MinecraftClient.getInstance().player.isBlocking() || MinecraftClient.getInstance().player.attackCooldownProgress <= 0.0F;
            }
            return true;
        }
        return false;
    }

    public void attackTarget(LivingEntity target) {
        ModuleManager moduleManager = NewCodeClient.getInstance().getModuleManager();
        Vec3d attackVec;
       
        if (moduleManager.elytraFly.isEnabled()) {
            Rotation rotation = this.calculateRotation(target, true, moduleManager.elytraFly);
            float yawRad = (float) Math.toRadians(rotation.yaw);
            float pitchRad = (float) Math.toRadians(rotation.pitch);
            double x = -MathHelper.sin(yawRad) * MathHelper.cos(pitchRad);
            double y = -MathHelper.sin(pitchRad);
            double z = MathHelper.cos(yawRad) * MathHelper.cos(pitchRad);
            attackVec = new Vec3d(x, y, z);
        } else {
            Vec3d targetPos = target.getPos();
            targetPos = targetPos.add(0.0,
                MinecraftClient.getInstance().player.isFallFlying() && (target.isFallFlying() || target.isGliding()) && moduleManager.elytraFly.isEnabled()
                    ? MathHelper.clamp(target.getY() - target.getHeight(), 0.0, target.getHeight() / 2.0)
                    : target.getHeight() - 0.2,
                0.0);
            attackVec = targetPos.subtract(MinecraftClient.getInstance().player.getPos());
           
            if (MinecraftClient.getInstance().player.isFallFlying() && (target.isFallFlying() || target.isGliding()) && moduleManager.elytraFly.isEnabled()) {
                double expansion = moduleManager.elytraFly.target.getSpeed() / 20.0;
                Vec3d targetBox = target.getBoundingBox().expand(expansion, expansion, expansion);
                Vec3d playerBox = MinecraftClient.getInstance().player.getBoundingBox().expand(0.1, 0.1, 0.1);
                attackVec = attackVec.add(targetBox).add(playerBox);
            }
        }

        float targetYaw = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(attackVec.z, attackVec.x)) - 90.0);
        float targetPitch = (float) -Math.toDegrees(Math.atan2(attackVec.y, Math.hypot(attackVec.x, attackVec.z)));
       
        float yawDiff = MathHelper.wrapDegrees(targetYaw - this.currentRotation.yaw);
        float pitchDiff = MathHelper.wrapDegrees(targetPitch - this.currentRotation.pitch);
       
        float maxRotation = 150.0F;
        float yawStep = Math.min(Math.max(Math.abs(yawDiff), 0.0F), maxRotation);
        float pitchStep = Math.max(Math.abs(pitchDiff), 0.0F);
       
        float gcd = RotationUtils.getGCD();
       
        if (!this.settings.isEnabled(7)) {
            attackVec.add(target.lastRenderX - target.prevX, target.lastRenderY - target.prevY, target.lastRenderZ - target.prevZ);
        }

        switch (this.modeSetting.getIndex()) {
            case 0: // Grim mode
                if (!NewCodeClient.getInstance().getModuleManager().testModule.isActive) {
                    if (MinecraftClient.getInstance().player.isFallFlying() && (target.isFallFlying() || target.isGliding()) && NewCodeClient.getInstance().getModuleManager().elytraFly.isEnabled()) {
                        float elytraYawStep = Math.min(Math.max(Math.abs(yawDiff), 1.0F), maxRotation * 1.2F);
                        float elytraPitchStep = Math.max(Math.abs(pitchDiff), 1.0F);
                        float elytraRotationOffset = RotationUtils.getGCD((float) (Math.cos(System.currentTimeMillis() / 50.0) * NewCodeClient.getInstance().getModuleManager().elytraFly.targetSetting.getValue()));
                       
                        float newYaw = this.currentRotation.yaw + (yawDiff > 0.0F ? elytraYawStep : -elytraYawStep) + elytraRotationOffset;
                        float newPitch = MathHelper.clamp(this.currentRotation.pitch + (pitchDiff > 0.0F ? elytraPitchStep : -elytraPitchStep), -89.0F, 89.0F) + elytraRotationOffset;
                       
                        float gcdHalf = RotationUtils.getGCD() * 0.5F;
                        newYaw -= (newYaw - this.currentRotation.yaw) % gcdHalf;
                        newPitch -= (newPitch - this.currentRotation.pitch) % gcdHalf;
                       
                        this.currentRotation = new Rotation(newYaw, newPitch);
                    } else {
                        float randomYawOffset = (float) (Math.random() * 1.15);
                        float randomPitchOffset = (float) (Math.random() * 1.15);
                       
                        float newYaw = this.currentRotation.yaw + (yawDiff > 0.0F ? yawStep : -yawStep);
                        float newPitch = MathHelper.clamp(this.currentRotation.pitch + (pitchDiff > 0.0F ? pitchStep : -pitchStep), -89.0F, 89.0F);
                       
                        if (!MinecraftClient.getInstance().player.isFallFlying() && this.settings.isEnabled(9)) {
                            newYaw += randomYawOffset;
                            newPitch += randomPitchOffset;
                        }
                       
                        newYaw -= (newYaw - this.currentRotation.yaw) % gcd;
                        newPitch -= (newPitch - this.currentRotation.pitch) % gcd;
                       
                        this.currentRotation = new Rotation(newYaw, newPitch);
                    }
                }
                break;
               
            case 1: // SpookyTime mode
                float attackProgress = MinecraftClient.getInstance().player.lastAttackedTicks;
                boolean lowProgress = attackProgress > 0.0F && attackProgress < 0.7F;
                boolean highProgress = attackProgress >= 0.7F && attackProgress < 1.0F;
               
                if ((lowProgress || highProgress) && !this.spookyFlag) {
                    this.spookyFlag = true;
                } else if (!lowProgress && !highProgress && this.spookyFlag) {
                    this.isSpookyAttack = true;
                    this.attackTimer.reset();
                    this.spookyFlag = false;
                }
               
                if (this.isSpookyAttack && this.attackTimer.hasPassed(0)) {
                    this.isSpookyAttack = false;
                }
               
                float smoothing, maxYaw, maxPitch, randomFactor;
                if (highProgress) {
                    smoothing = 0.4F;
                    maxYaw = 175.0F;
                    maxPitch = 8.0F;
                    randomFactor = 0.01F;
                } else if (lowProgress) {
                    smoothing = 0.5F;
                    maxYaw = 70.0F;
                    maxPitch = 65.0F;
                    randomFactor = 0.09F;
                } else {
                    smoothing = 0.8F;
                    maxYaw = 45.0F;
                    maxPitch = 40.0F;
                    randomFactor = 0.15F;
                }
               
                yawStep = MathHelper.clamp(Math.abs(yawDiff), 0.3F, maxYaw);
                pitchStep = MathHelper.clamp(Math.abs(pitchDiff), 0.25F, maxPitch);
               
                if (Math.abs(yawDiff) < 5.0F && !highProgress) {
                    yawStep *= 0.8F + 0.05F * (float) Math.sin(0.0);
                }
               
                if (highProgress || lowProgress) {
                    float progressMultiplier = 2.0F - (float) Math.pow(attackProgress, 2.0);
                    yawStep *= progressMultiplier;
                    pitchStep *= progressMultiplier;
                }
               
                float finalYaw, finalPitch;
                if (highProgress) {
                    finalYaw = this.currentRotation.yaw;
                    finalPitch = MathHelper.clamp(this.currentRotation.pitch + (int) yawDiff, -60.0F, 60.0F);
                } else {
                    finalYaw = this.currentRotation.yaw + (yawDiff > 0.0F ? yawStep : -yawStep) * (1.0F - randomFactor * (float) Math.abs(Math.sin(0.0)));
                    finalPitch = MathHelper.clamp(this.currentRotation.pitch + (pitchDiff > 0.0F ? pitchStep : -pitchStep) - 12.0F, -85.0F, 85.0F + pitchStep);
                }
               
                if (!highProgress && !lowProgress && !this.isSpookyAttack) {
                    finalYaw += (Math.random() - 0.5) * 0.2;
                    finalPitch += (Math.random() - 0.5) * 0.1;
                }
               
                gcd = RotationUtils.getGCD() * (highProgress || lowProgress ? 0.7F : 1.0F);
                finalYaw -= (finalYaw - this.currentRotation.yaw) % gcd;
                finalPitch -= (finalPitch - this.currentRotation.pitch) % gcd;
               
                this.currentRotation = new Rotation(
                    finalYaw * smoothing + this.currentRotation.yaw * (1.0F - smoothing),
                    finalPitch * smoothing + this.currentRotation.pitch * (1.0F - smoothing)
                );
                break;
        }
    }

    public double getEffectiveHealth(Entity entity) {
        if (entity instanceof PlayerEntity player) {
            double armorReduction = this.calculateArmorProtection(player) / 20.0;
            return (player.getHealth() + player.getAbsorptionAmount()) * armorReduction;
        } else if (entity instanceof LivingEntity living) {
            return living.getHealth() + living.getAbsorptionAmount();
        }
        return 0.0;
    }

    public double getDistanceToTarget(LivingEntity target) {
        return RotationUtils.getDistanceToEntity(target).getLength();
    }

    public double getArmorProtection(ItemStack armor) {
        ArmorItem armorItem = (ArmorItem) armor.getItem();
        double protection = armorItem.getProtection();
        if (armor.hasEnchantments()) {
            protection += EnchantmentHelper.getLevel(Enchantments.PROTECTION, armor) * 0.25;
        }
        return protection;
    }

    public boolean hasLineOfSight(LivingEntity target) {
        Vec3d targetPos = target.getPos().add(0.0, (double) target.getStandingEyeHeight(), 0.0);
        Vec3d playerPos = MinecraftClient.getInstance().player.getPos().add(0.0, (double) MinecraftClient.getInstance().player.getStandingEyeHeight(), 0.0);
        BlockHitResult raycast = MinecraftClient.getInstance().world.raycast(new RaycastContext(
            playerPos, targetPos,
            RaycastContext.ShapeType.COLLIDER,
            RaycastContext.FluidHandling.NONE,
            MinecraftClient.getInstance().player
        ));
        return raycast.getType() == RaycastResult.Type.MISS;
    }

    public void performAttack(LivingEntity target) {
        if (this.settings.isEnabled(2)) {
            if (MinecraftClient.getInstance().player.isUsingItem()) {
                MinecraftClient.getInstance().interactionManager.stopUsingItem(MinecraftClient.getInstance().player);
            }
        }

        this.attackCooldown = System.currentTimeMillis() + 555L;
        Criticals.isCritting = true;
       
        if (NewCodeClient.getInstance().getModuleManager().criticals.isEnabled() && Criticals.canCrit()) {
            NewCodeClient.getInstance().getModuleManager().criticals.doCrit();
        }

        MinecraftClient.getInstance().interactionManager.attackEntity(MinecraftClient.getInstance().player, target);
        MinecraftClient.getInstance().player.swingHand(Hand.MAIN_HAND);
        Criticals.isCritting = false;
       
        if (this.settings.isEnabled(3)) {
            ShieldBreaker.breakShield();
        }
    }

    public boolean isValidTarget(LivingEntity entity) {
        if (entity == null || entity == MinecraftClient.getInstance().player || !entity.isAlive() || entity.isRemoved()) {
            return false;
        }
       
        if (entity instanceof PlayerEntity player) {
            String name = player.getGameProfile().getName();
            boolean isFriend = FriendManager.isFriend(name);
            boolean isTeammate = NewCodeClient.getInstance().getModuleManager().teams.getTarget() != null
                && name.equals(NewCodeClient.getInstance().getModuleManager().teams.getTarget().getGameProfile().getName());
            boolean isNaked = player.getArmor() == 0;
           
            if ((isFriend && !this.targetSelection.isEnabled(1))
                || isTeammate
                || (isNaked && (!this.targetSelection.isEnabled(0) || !this.targetSelection.isEnabled(2)))) {
                return false;
            }
        }

        if (AntiBot.isBot(entity)) {
            return false;
        }
       
        if (entity instanceof PassiveEntity && !this.targetSelection.isEnabled(3)) {
            return false;
        }
       
        if (entity instanceof PlayerEntity && !this.targetSelection.isEnabled(0)) {
            return false;
        }
       
        if (!(entity instanceof HostileEntity) && (!(entity instanceof PlayerEntity) || !((PlayerEntity) entity).isCreative())) {
            if (!this.settings.isEnabled(5) && !this.hasLineOfSight(entity)) {
                return false;
            }
           
            float elytraOffset = MinecraftClient.getInstance().player.isFallFlying() ? this.elytraRotation.getValue() : 0.0F;
            float rotationOffset = this.modeSetting.isCurrentMode("Grim") ? this.rotationSetting.getValue() + elytraOffset : 0.0F;
            double maxDistance = MinecraftClient.getInstance().player.isFallFlying()
                ? elytraDistance.getValue()
                : attackDistance.getValue() + rotationOffset;
           
            return this.getDistanceToTarget(entity) <= maxDistance;
        }
        return false;
    }

    public boolean onPacket(Packet<?> packet) {
        ModuleManager moduleManager = NewCodeClient.getInstance().getModuleManager();
       
        if (packet instanceof PlayerMoveC2SPacket movePacket) {
            if (movePacket.isOnGround() && currentTarget != MinecraftClient.getInstance().player && currentTarget != null) {
                if (MinecraftClient.getInstance().player.isFallFlying()
                    && moduleManager.elytraFly.isActive
                    && moduleManager.elytraFly.isEnabled()) {
                   
                    ElytraFly.sendElytraStart();
                    ElytraFly.sendElytraTick();
                   
                    Vec3d velocity = currentTarget.getVelocity();
                    float speed = moduleManager.elytraFly.target.getSpeed();
                    Vec3d offset = velocity.multiply(speed);
                   
                    if (currentTarget.isFallFlying()) {
                        Vec3d direction = MinecraftClient.getInstance().getNetworkHandler().getConnection().getChannel().remoteAddress();
                        // Отправка пакета движения с учетом элитры
                    }
                   
                    ElytraFly.sendElytraEnd();
                    ElytraFly.sendElytraStop();
                }
            }
        }

        if (packet instanceof EntitySpawnPacket spawnPacket) {
            if (spawnPacket.isAlive()) {
                PacketEntityType entityType = spawnPacket.getEntityType();
                if (entityType instanceof PlayerEntityPacket) {
                    PlayerEntityPacket playerPacket = (PlayerEntityPacket) entityType;
                    if (MinecraftClient.getInstance().world != null && MinecraftClient.getInstance().player != null) {
                        Entity entity = playerPacket.getEntity(MinecraftClient.getInstance().world);
                        if (entity instanceof PlayerEntity player) {
                            if (player != currentTarget) {
                                currentTarget = player;
                            }
                        }
                    }
                }
            }
        }

        if (packet instanceof KeepAlivePacket keepAlive) {
            if (currentTarget != null) {
                keepAlive.setResponse(true);
            }
        }

        if (packet instanceof PlayerInputPacket inputPacket) {
            if (this.settings.isEnabled(1) && this.correctionMode.isCurrentMode("FreeLook") && moduleManager.teams.getTarget() == null) {
                float yaw;
                if (moduleManager.testModule.isActive) {
                    yaw = MinecraftClient.getInstance().player.yaw;
                } else {
                    yaw = this.currentRotation.yaw;
                }
                MovementUtils.setYaw(inputPacket, yaw);
            }
        }

        if ((packet instanceof PlayerInteractEntityPacket && !this.modeSetting.isCurrentMode("FunTime")
            || packet instanceof ClientCommandPacket && this.modeSetting.isCurrentMode("FunTime"))
            && currentTarget != null) {
            this.attackTarget(currentTarget);
        }

        if (packet instanceof ClientCommandPacket) {
            if (currentTarget != null) {
                if (!MinecraftClient.getInstance().player.isBlocking()) {
                    moduleManager.killerAura.setEnabled(true);
                }
            }

            if (currentTarget == null || !this.isValidTarget(currentTarget)) {
                currentTarget = this.findTarget();
            }

            if (currentTarget == null) {
                this.attackCooldown = System.currentTimeMillis();
                this.currentRotation = new Rotation(MinecraftClient.getInstance().player.yaw, MinecraftClient.getInstance().player.pitch);
                return false;
            }

            if (currentTarget != null && this.canAttack()) {
                if (!MinecraftClient.getInstance().player.isSneaking()) {
                    if (MinecraftClient.getInstance().player.isSprinting()) {
                        MinecraftClient.getInstance().player.networkHandler.sendPacket(
                            new ClientCommandPacket(MinecraftClient.getInstance().player, ClientCommandPacket.Mode.STOP_SPRINTING)
                        );
                        MinecraftClient.getInstance().player.setSprinting(false);
                    }
                    MinecraftClient.getInstance().player.input.movementForward = 0.0F;
                    MinecraftClient.getInstance().player.input.movementSideways = 0.0F;
                    MinecraftClient.getInstance().options.sprintKey.setPressed(false);
                    MinecraftClient.getInstance().player.setSneaking(false);
                    moduleManager.killerAura.setEnabled(false);
                }
                this.performAttack(currentTarget);
            }
        }

        if (packet instanceof PlayerLookPositionPacket lookPacket) {
            if (currentTarget != null && !moduleManager.testModule.isActive) {
                lookPacket.setPitch(this.currentRotation.pitch);
                lookPacket.setYaw(this.currentRotation.yaw);
                MinecraftClient.getInstance().player.headYaw = this.currentRotation.yaw;
                MinecraftClient.getInstance().player.prevYaw = !this.modeSetting.isCurrentMode("SpookyTime") && !this.settings.isEnabled(8)
                    ? this.currentRotation.yaw
                    : MathUtils.lerpAngle(this.currentRotation.yaw, this.currentRotation.yaw);
                MinecraftClient.getInstance().player.renderPitch = this.currentRotation.pitch;
            }
        }

        if (packet instanceof PlayerPositionPacket positionPacket) {
            positionPacket.setPitch(this.currentRotation.pitch);
            positionPacket.setYaw(this.currentRotation.yaw);
        }

        return false;
    }
}
может быть не правильным хз ну вроде норм
ауру одобрили а лики нет че за фигня(
кому это надо?
 
Назад
Сверху Снизу