Подпишитесь на наш Telegram-канал, чтобы всегда быть в курсе важных обновлений! Перейти

Вопрос Помощь KillAura. Логикой ударов.

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
17 Дек 2023
Сообщения
6
Реакции
0
Здравствуйте ребят. Я в пастинге и в целом в minecraft api мало чего понимаю.
У меня проблема вот в Zenith 1.21.4 no recode базой. А точнее в KillAura. Когда я начинаю бить, у меня редко она бьет именно КРИТ ударами, бывают удары сплешом. Мне надо как то исправить это чтобы било только критами. Вот коды классов где сама проблема.

AttackUtil:
Expand Collapse Copy
public class AttackUtil implements QuickImports {

    public void attackEntity(Entity entity) {
        mc.interactionManager.attackEntity(mc.player, entity);
        mc.player.swingHand(Hand.MAIN_HAND);
    }

    public boolean hasMovementRestrictions() {
        return mc.player.hasStatusEffect(StatusEffects.BLINDNESS)
                || mc.player.hasStatusEffect(StatusEffects.LEVITATION)
                || PlayerIntersectionUtil.isPlayerInBlock(Blocks.COBWEB)
                || mc.player.isSubmergedInWater()
                || mc.player.isInLava()
                || mc.player.isClimbing()
                || !PlayerIntersectionUtil.canChangeIntoPose(EntityPose.STANDING, mc.player.getPos()) && mc.player.isInSneakingPose()
                || mc.player.getAbilities().flying;
    }
    public boolean hasPreMovementRestrictions(SimulatedPlayer simulatedPlayer) {
        return simulatedPlayer.hasStatusEffect(StatusEffects.BLINDNESS)
                || simulatedPlayer.hasStatusEffect(StatusEffects.LEVITATION)
                || PlayerIntersectionUtil.isBoxInBlock(simulatedPlayer.boundingBox, Blocks.COBWEB)
                || simulatedPlayer.isSubmergedInWater()
                || simulatedPlayer.isInLava()
                || simulatedPlayer.isClimbing()
                || !PlayerIntersectionUtil.canChangeIntoPose(EntityPose.STANDING, simulatedPlayer.pos) && mc.player.isInSneakingPose()
                || mc.player.getAbilities().flying;
    }

    public static boolean isPlayerInCriticalState() {
        if (mc.player == null) return false;

        boolean isFalling = !mc.player.isOnGround() && mc.player.fallDistance > 0.0F;

        if (!isFalling) return false;

        double verticalVelocity = mc.player.getVelocity().y;

        boolean isFallingDownward = verticalVelocity < -0.0784;

        float fallDist = mc.player.fallDistance;
        boolean optimalFallDistance = fallDist > 0.1F && fallDist < 3.5F;

        return isFallingDownward && optimalFallDistance;
    }

//    public boolean isPlayerInCriticalState() {
//        boolean crit = mc.player.fallDistance > 0 &&
//                (mc.player.fallDistance < 0.08 ||
//                        !SimulatedPlayer.simulateLocalPlayer(1).onGround);
//        return !mc.player.isOnGround() && crit;
//    }

    public boolean isPrePlayerInCriticalState(SimulatedPlayer simulatedPlayer) {
        boolean crit = simulatedPlayer.fallDistance > 0 &&
                (simulatedPlayer.fallDistance < 0.08 ||
                        !SimulatedPlayer.simulateLocalPlayer(2).onGround);
        return !simulatedPlayer.onGround && crit;
    }

    public void resetSprintClient() {
        mc.player.setSprinting(false);
    }
   
    public void resetSprintNormal() {
        boolean wasSprinting = mc.player.isSprinting();
        if (wasSprinting) {
            mc.player.setSprinting(false);
            new Thread(() -> {
                try {
                    Thread.sleep(1);
                    if (mc.player != null) {
                        mc.player.setSprinting(true);
                    }
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                }
            }).start();
        }
    }
   
    public void resetSprintLegit() {
        if (mc.player.isSprinting()) {
            mc.player.setSprinting(false);
            new Thread(() -> {
                try {
                    Thread.sleep((long) (Math.random() * 100 + 50));
                    if (mc.player != null) {
                        mc.player.setSprinting(true);
                    }
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                }
            }).start();
        }
    }
   
    public void resetSprintRage() {
        if (mc.player.isSprinting()) {
            float originalForward = mc.player.input.movementForward;
            float originalSideways = mc.player.input.movementSideways;
           
            mc.player.input.movementForward *= 0.1f;
            mc.player.input.movementSideways *= 0.1f;
           
            mc.player.setSprinting(false);
           
            if (mc.getNetworkHandler() != null) {
                mc.getNetworkHandler().sendPacket(
                        new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.STOP_SPRINTING)
                );
            }
           
            new Thread(() -> {
                try {
                    Thread.sleep(50);
                    if (mc.player != null && mc.player.input != null) {
                        mc.player.input.movementForward = originalForward;
                        mc.player.input.movementSideways = originalSideways;
                    }
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                }
            }).start();
        }
    }
   
    public void resetSprintFast() {
        if (mc.player.isSprinting()) {
            mc.player.setSprinting(false);
           
            if (mc.getNetworkHandler() != null) {
                mc.getNetworkHandler().sendPacket(
                        new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.STOP_SPRINTING)
                );
            }
           
            mc.player.input.movementForward *= 0.5f;
            mc.player.input.movementSideways *= 0.5f;
           
            new Thread(() -> {
                try {
                    Thread.sleep(1);
                    if (mc.player != null) {
                        mc.player.setSprinting(true);
                    }
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                }
            }).start();
        }
    }
   
    public void resetSprintPacket() {
        mc.player.setSprinting(false);
        if (mc.getNetworkHandler() != null) {
            mc.getNetworkHandler().sendPacket(
                    new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.STOP_SPRINTING)
            );
        }
    }
   
    public void resetSprint(String mode) {
        switch (mode) {
            case "Client":
                resetSprintClient();
                break;
            case "Normal":
                resetSprintNormal();
                break;
            case "Legit":
                resetSprintLegit();
                break;
            case "Rage":
                resetSprintRage();
                break;
            case "Fast":
                resetSprintFast();
                break;
            case "Packet":
                resetSprintPacket();
                break;
        }
    }
}



AttackHandler:
Expand Collapse Copy
public class AttackHandler implements QuickImports {
    private final StopWatch attackTimer = new StopWatch(), shieldWatch = new StopWatch();
    private final ClickScheduler clickScheduler = new ClickScheduler();
    private final StopWatch legitSprintTimer = new StopWatch();
    private int count = 0;
    private int rageStopTicks = 0;

    void tick() {}

    void onPacket(PacketEvent e) {
        Packet<?> packet = e.getPacket();
        if (packet instanceof HandSwingC2SPacket || packet instanceof UpdateSelectedSlotC2SPacket) {
            clickScheduler.recalculate();
        }
    }

    void onUsingItem(UsingItemEvent e) {
        if (e.getType() == EventType.START && !shieldWatch.finished(50)) {
            e.cancel();
        }
    }

    void handleAttack(AttackPerpetrator.AttackPerpetratorConfigurable config) {
        if (canAttack(config, 1)) preAttackEntity(config);
        if (RaytracingUtil.rayTrace(config) && canAttack(config, 0)) {
            attackEntity(config);
        }
    }

    void preAttackEntity(AttackPerpetrator.AttackPerpetratorConfigurable config) {
        if (config.isShouldUnPressShield() && mc.player.isUsingItem() && mc.player.getActiveItem().getItem().equals(Items.SHIELD)) {
            mc.interactionManager.stopUsingItem(mc.player);
            shieldWatch.reset();
        }

        if (!mc.player.isSwimming() && Aura.getInstance().getSprintReset().isValue()) {
            String sprintResetMode = Aura.getInstance().getSprintResetMode().getSelected();
            boolean wasSprinting = mc.player.isSprinting();
            if (wasSprinting) {
                switch (sprintResetMode) {
                    case "Client":
                        mc.player.setSprinting(false);
                        break;
                    case "Normal":
                        mc.player.setSprinting(false);
                        break;
                    case "Legit":
                        mc.player.setSprinting(false);
                        legitSprintTimer.reset();
                        break;
                    case "Rage":
                        boolean isActuallySprinting = mc.player.isSprinting() &&
                                (mc.player.input.movementForward > 0 ||
                                        Math.abs(mc.player.input.movementSideways) > 0);

                        if (isActuallySprinting) {
                            float originalForward = mc.player.input.movementForward;
                            float originalSideways = mc.player.input.movementSideways;

                            mc.player.input.movementForward *= 0.1f;
                            mc.player.input.movementSideways *= 0.1f;
                           
                            mc.player.setSprinting(false);
                           
                            if (mc.getNetworkHandler() != null) {
                                mc.getNetworkHandler().sendPacket(
                                        new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.STOP_SPRINTING)
                                );
                            }
                           
                            rageStopTicks = 2;
                           
                            new Thread(() -> {
                                try {
                                    Thread.sleep(50);
                                    if (mc.player != null && mc.player.input != null) {
                                        mc.player.input.movementForward = originalForward;
                                        mc.player.input.movementSideways = originalSideways;
                                    }
                                } catch (InterruptedException ex) {
                                    ex.printStackTrace();
                                }
                            }).start();
                        }
                        break;
                    case "Fast":
                        if (mc.player.isSprinting()) {
                            mc.player.setSprinting(false);
                           
                            mc.getNetworkHandler().sendPacket(
                                    new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.STOP_SPRINTING)
                            );
                           
                            mc.player.input.movementForward *= 0.5f;
                            mc.player.input.movementSideways *= 0.5f;
                           
                            mc.player.setSprinting(true);
                        }
                        break;
                    case "Packet":
                        mc.player.setSprinting(false);
                        mc.player.sendSprintingPacket();
                        attackEntity(config);
                        break;
                }
            }
        }
    }

    void attackEntity(AttackPerpetrator.AttackPerpetratorConfigurable config) {
        boolean wasSprinting = mc.player.isSprinting();
        attack(config);
        attackTimer.reset();
        count++;

        if (!mc.player.isSwimming() && Aura.getInstance().getSprintReset().isValue()) {
            String sprintResetMode = Aura.getInstance().getSprintResetMode().getSelected();
            if (wasSprinting) {
                switch (sprintResetMode) {
                    case "Normal":
                        mc.player.setSprinting(true);
                        break;
                    case "Legit":
                        if (legitSprintTimer.finished(MathUtil.getRandom(50, 150))) {
                            mc.player.setSprinting(true);
                        }
                        break;
                }
            }
        }
    }

    private void attack(AttackPerpetrator.AttackPerpetratorConfigurable config) {
        mc.interactionManager.attackEntity(mc.player, config.getTarget());
        mc.player.swingHand(Hand.MAIN_HAND);
    }

    private boolean isSprinting() {
        return EventListener.serverSprint && !mc.player.isGliding() && !mc.player.isTouchingWater();
    }

    public boolean canAttack(AttackPerpetrator.AttackPerpetratorConfigurable config, int ticks) {
        return canCrit(config, ticks);
    }

    public boolean canCrit(AttackPerpetrator.AttackPerpetratorConfigurable config, int ticks) {
        if (mc.player.isUsingItem() &&
                !mc.player.getActiveItem().getItem().equals(Items.SHIELD) &&
                config.isEatAndAttack()) {
            return false;
        }

        if (!clickScheduler.isCooldownComplete(config.isUseDynamicCooldown(), ticks)) {
            return false;
        }

        SimulatedPlayer simulated = SimulatedPlayer.simulateLocalPlayer(ticks);
        boolean noRestrict = !hasMovementRestrictions(simulated);
        boolean critState = isPlayerInCriticalState();

        if (config.isSmartCrits()) {
            if (config.isSpacePressed()) {
                return critState;
            }
            else {
                return true;
            }
        }

        if (config.isOnlyCritical() && !hasMovementRestrictions(simulated)) {
            return isPlayerInCriticalState();
        }

        return true;
    }

    private boolean hasMovementRestrictions(SimulatedPlayer simulated) {
        return simulated.hasStatusEffect(StatusEffects.BLINDNESS)
                || simulated.hasStatusEffect(StatusEffects.LEVITATION)
                || PlayerIntersectionUtil.isBoxInBlock(simulated.boundingBox.expand(-1e-3), Blocks.COBWEB)
                || simulated.isSubmergedInWater()
                || simulated.isInLava()
                || simulated.isClimbing()
                || !PlayerIntersectionUtil.canChangeIntoPose(EntityPose.STANDING, simulated.pos)
                || simulated.player.getAbilities().flying;
    }
}


В этих классах проблемы. Код KillAura я не скину так как проблема только в этих кодах.
 
Назад
Сверху Снизу