Вопрос Kill Aura 1.21.1

  • Автор темы Автор темы aklon
  • Дата начала Дата начала
Начинающий
Начинающий
Статус
Оффлайн
Регистрация
20 Ноя 2022
Сообщения
38
Реакции
0
Помогите! Не могу починить килку. Она просто не наводится на игрока
Код:
Expand Collapse Copy
public class TestAura extends Module {
    public static final Singleton<TestAura> singleton = Singleton.create(() -> Module.link(TestAura.class));
    //private final LowRotation lowRotation = new LowRotation();
    //private final StrongRotation strongRotation = new StrongRotation();
    private final TimerUtil attackTimer = new TimerUtil();
    private LivingEntity target;

    public TestAura() {
        super("TestAura", Category.COMBAT, -1);
    }

    ListSetting targets = new ListSetting("МультиМод",
            new BooleanSetting("Игроки", true),
            new BooleanSetting("Голые", true),
            new BooleanSetting("Мобы", true),
            new BooleanSetting("Монстры", true),
            new BooleanSetting("Житилей", false)).setParent(this);

    BooleanSetting onlyCriticals = new BooleanSetting("Только Криты", false).setParent(this);
    NumberSetting Distance = new NumberSetting("Дистанция", 1.0f, 1f, 6, 0.1f).setParent(this);
    NumberSetting DopDistance = new NumberSetting("Доп Дистанция", 0.0f, 0.0f, 3, 0.1f).setParent(this);
    BooleanSetting focusTarget = new BooleanSetting("Фокусировать таргет", true).setParent(this);

    ModeSetting Correction = new ModeSetting("Коррекция движений", "Слабая", "Слабая", "Сильная", "Нету").setParent(this);

    @EventHandler
    public void onInput(InputMoveEvent event) {
        if (Correction.get().equals("Слабая") && target != null) {
            //lowRotation.applyRotation(event);
        }
        if (Correction.get().equals("Сильная") && target != null) {
            //strongRotation.applyRotation(event);
        }
    }

    @EventHandler
    public void onUpdate(UpdateEvent event) {
        LocalPlayer player = Minecraft.getInstance().player;

        if (player == null || player.isDeadOrDying()) {
            return;
        }

        target = findTarget();

        if (target != null && isInRange(player, target)) {
            updateRotation(target); // Передаем цель
            if (shouldPlayerFalling() && attackTimer.isReached(500)) {
                attackTarget(player, target);
            }
        }
    }

    private void updateRotation(boolean b, int target, int maxChange) {

    }

    private boolean shouldPlayerFalling() {
        LocalPlayer player = Minecraft.getInstance().player;
        return player.fallDistance > 0 && !player.isInWater() && !player.isInLava() && !player.isFallFlying() && !player.onGround();
    }

    private LivingEntity findTarget() {
        List<Entity> potentialTargets = new ArrayList<>();
        for (Entity entity : Minecraft.getInstance().level.entitiesForRendering()) {
            if (entity instanceof LivingEntity livingEntity && isValidTarget(livingEntity) && entity != Minecraft.getInstance().player) {
                potentialTargets.add(entity);
            }
        }

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

        if (focusTarget.get() && target != null && isValidTarget(target)) {
            return target;
        }

        return (LivingEntity) potentialTargets.stream()
                .min(Comparator.comparingDouble(Minecraft.getInstance().player::distanceTo))
                .orElse(null);
    }

    private boolean isValidTarget(LivingEntity entity) {
        if (!targets.getValue(0) && !targets.getValue(1) && !targets.getValue(2)
                && !targets.getValue(3) && !targets.getValue(4) && !targets.getValue(5)) {
            return false;
        }

        if (entity.getScoreboardName().length() < 2)
            return false;
        if (entity.isDeadOrDying() || entity.getHealth() <= 0.0f)
            return false;
        if (entity instanceof Player) {
            if (entity.getArmorValue() == 0 && !targets.getValue(1)) return false;
            if (!entity.getUUID().equals(UUID.nameUUIDFromBytes(("OfflinePlayer:" + entity.getScoreboardName()).getBytes(StandardCharsets.UTF_8))) && !targets.getValue(3)) return false;
        }

        return true;
    }


    public LivingEntity getCurrentTarget() {
        return findTarget();
    }

    private boolean isInRange(LocalPlayer player, Entity target) {
        return player.distanceTo(target) <= Distance.get();
    }

    private void attackTarget(LocalPlayer player, Entity target) {
        if (!(target instanceof Player) || AntiBot.isBot(target)) {
            return;
        }

        boolean SprintStop = false;

        if (onlyCriticals.get() && player.isSprinting()) {
            player.setSprinting(false);
            player.connection.send(new ServerboundPlayerCommandPacket(player, ServerboundPlayerCommandPacket.Action.STOP_SPRINTING));
            SprintStop = true;
        }

        Vec3 targetPosition = new Vec3(target.getX(), target.getY() + target.getBbHeight() * 0.9, target.getZ());
        player.attack(target);
        Minecraft.getInstance().gameMode.attack(player, target);
        player.swing(InteractionHand.MAIN_HAND);

        if (SprintStop) {
            player.setSprinting(true);
            player.connection.send(new ServerboundPlayerCommandPacket(player, ServerboundPlayerCommandPacket.Action.START_SPRINTING));
        }

        attackTimer.reset();
    }


    private void updateRotation(Entity target) {
        if (target == null) return;

        double deltaX = target.getX() - mc.player.getX();
        double deltaZ = target.getZ() - mc.player.getZ();
        double deltaY = target.getY() - (mc.player.getY() + mc.player.getEyeHeight());

        double distance = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ);
        float yaw = (float) (Math.atan2(deltaZ, deltaX) * (180 / Math.PI)) - 90.0F;
        float pitch = (float) -(Math.atan2(deltaY, distance) * (180 / Math.PI));

        mc.player.rotationYaw = updateRotation((Float) mc.player.rotationYaw, yaw, 70.0F);
        mc.player.rotationPitch = updateRotation((Float) mc.player.rotationPitch, pitch, 30.0F);
    }

    private float updateRotation(float current, float target, float maxChange) {
        float delta = MathHelper.wrapDegrees(target - current);

        if (delta > maxChange) {
            delta = maxChange;
        }
        if (delta < -maxChange) {
            delta = -maxChange;
        }

        return current + delta;
    }

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

    @Override
    public void onDisable() {
        super.onDisable();
        attackTimer.reset();
        target = null;
    }
}
 
Помогите! Не могу починить килку. Она просто не наводится на игрока
Код:
Expand Collapse Copy
public class TestAura extends Module {
    public static final Singleton<TestAura> singleton = Singleton.create(() -> Module.link(TestAura.class));
    //private final LowRotation lowRotation = new LowRotation();
    //private final StrongRotation strongRotation = new StrongRotation();
    private final TimerUtil attackTimer = new TimerUtil();
    private LivingEntity target;

    public TestAura() {
        super("TestAura", Category.COMBAT, -1);
    }

    ListSetting targets = new ListSetting("МультиМод",
            new BooleanSetting("Игроки", true),
            new BooleanSetting("Голые", true),
            new BooleanSetting("Мобы", true),
            new BooleanSetting("Монстры", true),
            new BooleanSetting("Житилей", false)).setParent(this);

    BooleanSetting onlyCriticals = new BooleanSetting("Только Криты", false).setParent(this);
    NumberSetting Distance = new NumberSetting("Дистанция", 1.0f, 1f, 6, 0.1f).setParent(this);
    NumberSetting DopDistance = new NumberSetting("Доп Дистанция", 0.0f, 0.0f, 3, 0.1f).setParent(this);
    BooleanSetting focusTarget = new BooleanSetting("Фокусировать таргет", true).setParent(this);

    ModeSetting Correction = new ModeSetting("Коррекция движений", "Слабая", "Слабая", "Сильная", "Нету").setParent(this);

    @EventHandler
    public void onInput(InputMoveEvent event) {
        if (Correction.get().equals("Слабая") && target != null) {
            //lowRotation.applyRotation(event);
        }
        if (Correction.get().equals("Сильная") && target != null) {
            //strongRotation.applyRotation(event);
        }
    }

    @EventHandler
    public void onUpdate(UpdateEvent event) {
        LocalPlayer player = Minecraft.getInstance().player;

        if (player == null || player.isDeadOrDying()) {
            return;
        }

        target = findTarget();

        if (target != null && isInRange(player, target)) {
            updateRotation(target); // Передаем цель
            if (shouldPlayerFalling() && attackTimer.isReached(500)) {
                attackTarget(player, target);
            }
        }
    }

    private void updateRotation(boolean b, int target, int maxChange) {

    }

    private boolean shouldPlayerFalling() {
        LocalPlayer player = Minecraft.getInstance().player;
        return player.fallDistance > 0 && !player.isInWater() && !player.isInLava() && !player.isFallFlying() && !player.onGround();
    }

    private LivingEntity findTarget() {
        List<Entity> potentialTargets = new ArrayList<>();
        for (Entity entity : Minecraft.getInstance().level.entitiesForRendering()) {
            if (entity instanceof LivingEntity livingEntity && isValidTarget(livingEntity) && entity != Minecraft.getInstance().player) {
                potentialTargets.add(entity);
            }
        }

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

        if (focusTarget.get() && target != null && isValidTarget(target)) {
            return target;
        }

        return (LivingEntity) potentialTargets.stream()
                .min(Comparator.comparingDouble(Minecraft.getInstance().player::distanceTo))
                .orElse(null);
    }

    private boolean isValidTarget(LivingEntity entity) {
        if (!targets.getValue(0) && !targets.getValue(1) && !targets.getValue(2)
                && !targets.getValue(3) && !targets.getValue(4) && !targets.getValue(5)) {
            return false;
        }

        if (entity.getScoreboardName().length() < 2)
            return false;
        if (entity.isDeadOrDying() || entity.getHealth() <= 0.0f)
            return false;
        if (entity instanceof Player) {
            if (entity.getArmorValue() == 0 && !targets.getValue(1)) return false;
            if (!entity.getUUID().equals(UUID.nameUUIDFromBytes(("OfflinePlayer:" + entity.getScoreboardName()).getBytes(StandardCharsets.UTF_8))) && !targets.getValue(3)) return false;
        }

        return true;
    }


    public LivingEntity getCurrentTarget() {
        return findTarget();
    }

    private boolean isInRange(LocalPlayer player, Entity target) {
        return player.distanceTo(target) <= Distance.get();
    }

    private void attackTarget(LocalPlayer player, Entity target) {
        if (!(target instanceof Player) || AntiBot.isBot(target)) {
            return;
        }

        boolean SprintStop = false;

        if (onlyCriticals.get() && player.isSprinting()) {
            player.setSprinting(false);
            player.connection.send(new ServerboundPlayerCommandPacket(player, ServerboundPlayerCommandPacket.Action.STOP_SPRINTING));
            SprintStop = true;
        }

        Vec3 targetPosition = new Vec3(target.getX(), target.getY() + target.getBbHeight() * 0.9, target.getZ());
        player.attack(target);
        Minecraft.getInstance().gameMode.attack(player, target);
        player.swing(InteractionHand.MAIN_HAND);

        if (SprintStop) {
            player.setSprinting(true);
            player.connection.send(new ServerboundPlayerCommandPacket(player, ServerboundPlayerCommandPacket.Action.START_SPRINTING));
        }

        attackTimer.reset();
    }


    private void updateRotation(Entity target) {
        if (target == null) return;

        double deltaX = target.getX() - mc.player.getX();
        double deltaZ = target.getZ() - mc.player.getZ();
        double deltaY = target.getY() - (mc.player.getY() + mc.player.getEyeHeight());

        double distance = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ);
        float yaw = (float) (Math.atan2(deltaZ, deltaX) * (180 / Math.PI)) - 90.0F;
        float pitch = (float) -(Math.atan2(deltaY, distance) * (180 / Math.PI));

        mc.player.rotationYaw = updateRotation((Float) mc.player.rotationYaw, yaw, 70.0F);
        mc.player.rotationPitch = updateRotation((Float) mc.player.rotationPitch, pitch, 30.0F);
    }

    private float updateRotation(float current, float target, float maxChange) {
        float delta = MathHelper.wrapDegrees(target - current);

        if (delta > maxChange) {
            delta = maxChange;
        }
        if (delta < -maxChange) {
            delta = -maxChange;
        }

        return current + delta;
    }

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

    @Override
    public void onDisable() {
        super.onDisable();
        attackTimer.reset();
        target = null;
    }
}
я конечно не знаю что там у вас на 1.21.1 но мб надо гдц и то что тип сказал проверку тип
 
Помогите! Не могу починить килку. Она просто не наводится на игрока
Код:
Expand Collapse Copy
public class TestAura extends Module {
    public static final Singleton<TestAura> singleton = Singleton.create(() -> Module.link(TestAura.class));
    //private final LowRotation lowRotation = new LowRotation();
    //private final StrongRotation strongRotation = new StrongRotation();
    private final TimerUtil attackTimer = new TimerUtil();
    private LivingEntity target;

    public TestAura() {
        super("TestAura", Category.COMBAT, -1);
    }

    ListSetting targets = new ListSetting("МультиМод",
            new BooleanSetting("Игроки", true),
            new BooleanSetting("Голые", true),
            new BooleanSetting("Мобы", true),
            new BooleanSetting("Монстры", true),
            new BooleanSetting("Житилей", false)).setParent(this);

    BooleanSetting onlyCriticals = new BooleanSetting("Только Криты", false).setParent(this);
    NumberSetting Distance = new NumberSetting("Дистанция", 1.0f, 1f, 6, 0.1f).setParent(this);
    NumberSetting DopDistance = new NumberSetting("Доп Дистанция", 0.0f, 0.0f, 3, 0.1f).setParent(this);
    BooleanSetting focusTarget = new BooleanSetting("Фокусировать таргет", true).setParent(this);

    ModeSetting Correction = new ModeSetting("Коррекция движений", "Слабая", "Слабая", "Сильная", "Нету").setParent(this);

    @EventHandler
    public void onInput(InputMoveEvent event) {
        if (Correction.get().equals("Слабая") && target != null) {
            //lowRotation.applyRotation(event);
        }
        if (Correction.get().equals("Сильная") && target != null) {
            //strongRotation.applyRotation(event);
        }
    }

    @EventHandler
    public void onUpdate(UpdateEvent event) {
        LocalPlayer player = Minecraft.getInstance().player;

        if (player == null || player.isDeadOrDying()) {
            return;
        }

        target = findTarget();

        if (target != null && isInRange(player, target)) {
            updateRotation(target); // Передаем цель
            if (shouldPlayerFalling() && attackTimer.isReached(500)) {
                attackTarget(player, target);
            }
        }
    }

    private void updateRotation(boolean b, int target, int maxChange) {

    }

    private boolean shouldPlayerFalling() {
        LocalPlayer player = Minecraft.getInstance().player;
        return player.fallDistance > 0 && !player.isInWater() && !player.isInLava() && !player.isFallFlying() && !player.onGround();
    }

    private LivingEntity findTarget() {
        List<Entity> potentialTargets = new ArrayList<>();
        for (Entity entity : Minecraft.getInstance().level.entitiesForRendering()) {
            if (entity instanceof LivingEntity livingEntity && isValidTarget(livingEntity) && entity != Minecraft.getInstance().player) {
                potentialTargets.add(entity);
            }
        }

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

        if (focusTarget.get() && target != null && isValidTarget(target)) {
            return target;
        }

        return (LivingEntity) potentialTargets.stream()
                .min(Comparator.comparingDouble(Minecraft.getInstance().player::distanceTo))
                .orElse(null);
    }

    private boolean isValidTarget(LivingEntity entity) {
        if (!targets.getValue(0) && !targets.getValue(1) && !targets.getValue(2)
                && !targets.getValue(3) && !targets.getValue(4) && !targets.getValue(5)) {
            return false;
        }

        if (entity.getScoreboardName().length() < 2)
            return false;
        if (entity.isDeadOrDying() || entity.getHealth() <= 0.0f)
            return false;
        if (entity instanceof Player) {
            if (entity.getArmorValue() == 0 && !targets.getValue(1)) return false;
            if (!entity.getUUID().equals(UUID.nameUUIDFromBytes(("OfflinePlayer:" + entity.getScoreboardName()).getBytes(StandardCharsets.UTF_8))) && !targets.getValue(3)) return false;
        }

        return true;
    }


    public LivingEntity getCurrentTarget() {
        return findTarget();
    }

    private boolean isInRange(LocalPlayer player, Entity target) {
        return player.distanceTo(target) <= Distance.get();
    }

    private void attackTarget(LocalPlayer player, Entity target) {
        if (!(target instanceof Player) || AntiBot.isBot(target)) {
            return;
        }

        boolean SprintStop = false;

        if (onlyCriticals.get() && player.isSprinting()) {
            player.setSprinting(false);
            player.connection.send(new ServerboundPlayerCommandPacket(player, ServerboundPlayerCommandPacket.Action.STOP_SPRINTING));
            SprintStop = true;
        }

        Vec3 targetPosition = new Vec3(target.getX(), target.getY() + target.getBbHeight() * 0.9, target.getZ());
        player.attack(target);
        Minecraft.getInstance().gameMode.attack(player, target);
        player.swing(InteractionHand.MAIN_HAND);

        if (SprintStop) {
            player.setSprinting(true);
            player.connection.send(new ServerboundPlayerCommandPacket(player, ServerboundPlayerCommandPacket.Action.START_SPRINTING));
        }

        attackTimer.reset();
    }


    private void updateRotation(Entity target) {
        if (target == null) return;

        double deltaX = target.getX() - mc.player.getX();
        double deltaZ = target.getZ() - mc.player.getZ();
        double deltaY = target.getY() - (mc.player.getY() + mc.player.getEyeHeight());

        double distance = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ);
        float yaw = (float) (Math.atan2(deltaZ, deltaX) * (180 / Math.PI)) - 90.0F;
        float pitch = (float) -(Math.atan2(deltaY, distance) * (180 / Math.PI));

        mc.player.rotationYaw = updateRotation((Float) mc.player.rotationYaw, yaw, 70.0F);
        mc.player.rotationPitch = updateRotation((Float) mc.player.rotationPitch, pitch, 30.0F);
    }

    private float updateRotation(float current, float target, float maxChange) {
        float delta = MathHelper.wrapDegrees(target - current);

        if (delta > maxChange) {
            delta = maxChange;
        }
        if (delta < -maxChange) {
            delta = -maxChange;
        }

        return current + delta;
    }

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

    @Override
    public void onDisable() {
        super.onDisable();
        attackTimer.reset();
        target = null;
    }
}
double distance = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ); почему ты deltaY ты не учитываешь? может из за этого не наводится
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Помогите! Не могу починить килку. Она просто не наводится на игрока
Код:
Expand Collapse Copy
public class TestAura extends Module {
    public static final Singleton<TestAura> singleton = Singleton.create(() -> Module.link(TestAura.class));
    //private final LowRotation lowRotation = new LowRotation();
    //private final StrongRotation strongRotation = new StrongRotation();
    private final TimerUtil attackTimer = new TimerUtil();
    private LivingEntity target;

    public TestAura() {
        super("TestAura", Category.COMBAT, -1);
    }

    ListSetting targets = new ListSetting("МультиМод",
            new BooleanSetting("Игроки", true),
            new BooleanSetting("Голые", true),
            new BooleanSetting("Мобы", true),
            new BooleanSetting("Монстры", true),
            new BooleanSetting("Житилей", false)).setParent(this);

    BooleanSetting onlyCriticals = new BooleanSetting("Только Криты", false).setParent(this);
    NumberSetting Distance = new NumberSetting("Дистанция", 1.0f, 1f, 6, 0.1f).setParent(this);
    NumberSetting DopDistance = new NumberSetting("Доп Дистанция", 0.0f, 0.0f, 3, 0.1f).setParent(this);
    BooleanSetting focusTarget = new BooleanSetting("Фокусировать таргет", true).setParent(this);

    ModeSetting Correction = new ModeSetting("Коррекция движений", "Слабая", "Слабая", "Сильная", "Нету").setParent(this);

    @EventHandler
    public void onInput(InputMoveEvent event) {
        if (Correction.get().equals("Слабая") && target != null) {
            //lowRotation.applyRotation(event);
        }
        if (Correction.get().equals("Сильная") && target != null) {
            //strongRotation.applyRotation(event);
        }
    }

    @EventHandler
    public void onUpdate(UpdateEvent event) {
        LocalPlayer player = Minecraft.getInstance().player;

        if (player == null || player.isDeadOrDying()) {
            return;
        }

        target = findTarget();

        if (target != null && isInRange(player, target)) {
            updateRotation(target); // Передаем цель
            if (shouldPlayerFalling() && attackTimer.isReached(500)) {
                attackTarget(player, target);
            }
        }
    }

    private void updateRotation(boolean b, int target, int maxChange) {

    }

    private boolean shouldPlayerFalling() {
        LocalPlayer player = Minecraft.getInstance().player;
        return player.fallDistance > 0 && !player.isInWater() && !player.isInLava() && !player.isFallFlying() && !player.onGround();
    }

    private LivingEntity findTarget() {
        List<Entity> potentialTargets = new ArrayList<>();
        for (Entity entity : Minecraft.getInstance().level.entitiesForRendering()) {
            if (entity instanceof LivingEntity livingEntity && isValidTarget(livingEntity) && entity != Minecraft.getInstance().player) {
                potentialTargets.add(entity);
            }
        }

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

        if (focusTarget.get() && target != null && isValidTarget(target)) {
            return target;
        }

        return (LivingEntity) potentialTargets.stream()
                .min(Comparator.comparingDouble(Minecraft.getInstance().player::distanceTo))
                .orElse(null);
    }

    private boolean isValidTarget(LivingEntity entity) {
        if (!targets.getValue(0) && !targets.getValue(1) && !targets.getValue(2)
                && !targets.getValue(3) && !targets.getValue(4) && !targets.getValue(5)) {
            return false;
        }

        if (entity.getScoreboardName().length() < 2)
            return false;
        if (entity.isDeadOrDying() || entity.getHealth() <= 0.0f)
            return false;
        if (entity instanceof Player) {
            if (entity.getArmorValue() == 0 && !targets.getValue(1)) return false;
            if (!entity.getUUID().equals(UUID.nameUUIDFromBytes(("OfflinePlayer:" + entity.getScoreboardName()).getBytes(StandardCharsets.UTF_8))) && !targets.getValue(3)) return false;
        }

        return true;
    }


    public LivingEntity getCurrentTarget() {
        return findTarget();
    }

    private boolean isInRange(LocalPlayer player, Entity target) {
        return player.distanceTo(target) <= Distance.get();
    }

    private void attackTarget(LocalPlayer player, Entity target) {
        if (!(target instanceof Player) || AntiBot.isBot(target)) {
            return;
        }

        boolean SprintStop = false;

        if (onlyCriticals.get() && player.isSprinting()) {
            player.setSprinting(false);
            player.connection.send(new ServerboundPlayerCommandPacket(player, ServerboundPlayerCommandPacket.Action.STOP_SPRINTING));
            SprintStop = true;
        }

        Vec3 targetPosition = new Vec3(target.getX(), target.getY() + target.getBbHeight() * 0.9, target.getZ());
        player.attack(target);
        Minecraft.getInstance().gameMode.attack(player, target);
        player.swing(InteractionHand.MAIN_HAND);

        if (SprintStop) {
            player.setSprinting(true);
            player.connection.send(new ServerboundPlayerCommandPacket(player, ServerboundPlayerCommandPacket.Action.START_SPRINTING));
        }

        attackTimer.reset();
    }


    private void updateRotation(Entity target) {
        if (target == null) return;

        double deltaX = target.getX() - mc.player.getX();
        double deltaZ = target.getZ() - mc.player.getZ();
        double deltaY = target.getY() - (mc.player.getY() + mc.player.getEyeHeight());

        double distance = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ);
        float yaw = (float) (Math.atan2(deltaZ, deltaX) * (180 / Math.PI)) - 90.0F;
        float pitch = (float) -(Math.atan2(deltaY, distance) * (180 / Math.PI));

        mc.player.rotationYaw = updateRotation((Float) mc.player.rotationYaw, yaw, 70.0F);
        mc.player.rotationPitch = updateRotation((Float) mc.player.rotationPitch, pitch, 30.0F);
    }

    private float updateRotation(float current, float target, float maxChange) {
        float delta = MathHelper.wrapDegrees(target - current);

        if (delta > maxChange) {
            delta = maxChange;
        }
        if (delta < -maxChange) {
            delta = -maxChange;
        }

        return current + delta;
    }

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

    @Override
    public void onDisable() {
        super.onDisable();
        attackTimer.reset();
        target = null;
    }
}
На нашей базе пастеры сидят уже…
 
Помогите! Не могу починить килку. Она просто не наводится на игрока
Код:
Expand Collapse Copy
public class TestAura extends Module {
    public static final Singleton<TestAura> singleton = Singleton.create(() -> Module.link(TestAura.class));
    //private final LowRotation lowRotation = new LowRotation();
    //private final StrongRotation strongRotation = new StrongRotation();
    private final TimerUtil attackTimer = new TimerUtil();
    private LivingEntity target;

    public TestAura() {
        super("TestAura", Category.COMBAT, -1);
    }

    ListSetting targets = new ListSetting("МультиМод",
            new BooleanSetting("Игроки", true),
            new BooleanSetting("Голые", true),
            new BooleanSetting("Мобы", true),
            new BooleanSetting("Монстры", true),
            new BooleanSetting("Житилей", false)).setParent(this);

    BooleanSetting onlyCriticals = new BooleanSetting("Только Криты", false).setParent(this);
    NumberSetting Distance = new NumberSetting("Дистанция", 1.0f, 1f, 6, 0.1f).setParent(this);
    NumberSetting DopDistance = new NumberSetting("Доп Дистанция", 0.0f, 0.0f, 3, 0.1f).setParent(this);
    BooleanSetting focusTarget = new BooleanSetting("Фокусировать таргет", true).setParent(this);

    ModeSetting Correction = new ModeSetting("Коррекция движений", "Слабая", "Слабая", "Сильная", "Нету").setParent(this);

    @EventHandler
    public void onInput(InputMoveEvent event) {
        if (Correction.get().equals("Слабая") && target != null) {
            //lowRotation.applyRotation(event);
        }
        if (Correction.get().equals("Сильная") && target != null) {
            //strongRotation.applyRotation(event);
        }
    }

    @EventHandler
    public void onUpdate(UpdateEvent event) {
        LocalPlayer player = Minecraft.getInstance().player;

        if (player == null || player.isDeadOrDying()) {
            return;
        }

        target = findTarget();

        if (target != null && isInRange(player, target)) {
            updateRotation(target); // Передаем цель
            if (shouldPlayerFalling() && attackTimer.isReached(500)) {
                attackTarget(player, target);
            }
        }
    }

    private void updateRotation(boolean b, int target, int maxChange) {

    }

    private boolean shouldPlayerFalling() {
        LocalPlayer player = Minecraft.getInstance().player;
        return player.fallDistance > 0 && !player.isInWater() && !player.isInLava() && !player.isFallFlying() && !player.onGround();
    }

    private LivingEntity findTarget() {
        List<Entity> potentialTargets = new ArrayList<>();
        for (Entity entity : Minecraft.getInstance().level.entitiesForRendering()) {
            if (entity instanceof LivingEntity livingEntity && isValidTarget(livingEntity) && entity != Minecraft.getInstance().player) {
                potentialTargets.add(entity);
            }
        }

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

        if (focusTarget.get() && target != null && isValidTarget(target)) {
            return target;
        }

        return (LivingEntity) potentialTargets.stream()
                .min(Comparator.comparingDouble(Minecraft.getInstance().player::distanceTo))
                .orElse(null);
    }

    private boolean isValidTarget(LivingEntity entity) {
        if (!targets.getValue(0) && !targets.getValue(1) && !targets.getValue(2)
                && !targets.getValue(3) && !targets.getValue(4) && !targets.getValue(5)) {
            return false;
        }

        if (entity.getScoreboardName().length() < 2)
            return false;
        if (entity.isDeadOrDying() || entity.getHealth() <= 0.0f)
            return false;
        if (entity instanceof Player) {
            if (entity.getArmorValue() == 0 && !targets.getValue(1)) return false;
            if (!entity.getUUID().equals(UUID.nameUUIDFromBytes(("OfflinePlayer:" + entity.getScoreboardName()).getBytes(StandardCharsets.UTF_8))) && !targets.getValue(3)) return false;
        }

        return true;
    }


    public LivingEntity getCurrentTarget() {
        return findTarget();
    }

    private boolean isInRange(LocalPlayer player, Entity target) {
        return player.distanceTo(target) <= Distance.get();
    }

    private void attackTarget(LocalPlayer player, Entity target) {
        if (!(target instanceof Player) || AntiBot.isBot(target)) {
            return;
        }

        boolean SprintStop = false;

        if (onlyCriticals.get() && player.isSprinting()) {
            player.setSprinting(false);
            player.connection.send(new ServerboundPlayerCommandPacket(player, ServerboundPlayerCommandPacket.Action.STOP_SPRINTING));
            SprintStop = true;
        }

        Vec3 targetPosition = new Vec3(target.getX(), target.getY() + target.getBbHeight() * 0.9, target.getZ());
        player.attack(target);
        Minecraft.getInstance().gameMode.attack(player, target);
        player.swing(InteractionHand.MAIN_HAND);

        if (SprintStop) {
            player.setSprinting(true);
            player.connection.send(new ServerboundPlayerCommandPacket(player, ServerboundPlayerCommandPacket.Action.START_SPRINTING));
        }

        attackTimer.reset();
    }


    private void updateRotation(Entity target) {
        if (target == null) return;

        double deltaX = target.getX() - mc.player.getX();
        double deltaZ = target.getZ() - mc.player.getZ();
        double deltaY = target.getY() - (mc.player.getY() + mc.player.getEyeHeight());

        double distance = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ);
        float yaw = (float) (Math.atan2(deltaZ, deltaX) * (180 / Math.PI)) - 90.0F;
        float pitch = (float) -(Math.atan2(deltaY, distance) * (180 / Math.PI));

        mc.player.rotationYaw = updateRotation((Float) mc.player.rotationYaw, yaw, 70.0F);
        mc.player.rotationPitch = updateRotation((Float) mc.player.rotationPitch, pitch, 30.0F);
    }

    private float updateRotation(float current, float target, float maxChange) {
        float delta = MathHelper.wrapDegrees(target - current);

        if (delta > maxChange) {
            delta = maxChange;
        }
        if (delta < -maxChange) {
            delta = -maxChange;
        }

        return current + delta;
    }

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

    @Override
    public void onDisable() {
        super.onDisable();
        attackTimer.reset();
        target = null;
    }
}
Хватит пастить Сукаа
 
Тупое существо, у тебя нихуя нет в методе ротации уебан жирный
Код:
Expand Collapse Copy
    private void updateRotation(Entity target) {
        if (target == null) return;

        double deltaX = target.getX() - mc.player.getX();
        double deltaZ = target.getZ() - mc.player.getZ();
        double deltaY = target.getY() - (mc.player.getY() + mc.player.getEyeHeight());

        double distance = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ);
        float yaw = (float) (Math.atan2(deltaZ, deltaX) * (180 / Math.PI)) - 90.0F;
        float pitch = (float) -(Math.atan2(deltaY, distance) * (180 / Math.PI));

        mc.player.rotationYaw = updateRotation((Float) mc.player.rotationYaw, yaw, 70.0F);
        mc.player.rotationPitch = updateRotation((Float) mc.player.rotationPitch, pitch, 30.0F);
    }

    private float updateRotation(float current, float target, float maxChange) {
        float delta = MathHelper.wrapDegrees(target - current);

        if (delta > maxChange) {
            delta = maxChange;
        }
        if (delta < -maxChange) {
            delta = -maxChange;
        }

        return current + delta;
    }

    [USER=1367676]@override[/USER]
    public void onEnable() {
        super.onEnable();
        target = null;
    }

Чем тебе не метод?
 
(пссс эта тема была создана для реакций и сообщений)
 
Помогите! Не могу починить килку. Она просто не наводится на игрока
Код:
Expand Collapse Copy
public class TestAura extends Module {
    public static final Singleton<TestAura> singleton = Singleton.create(() -> Module.link(TestAura.class));
    //private final LowRotation lowRotation = new LowRotation();
    //private final StrongRotation strongRotation = new StrongRotation();
    private final TimerUtil attackTimer = new TimerUtil();
    private LivingEntity target;

    public TestAura() {
        super("TestAura", Category.COMBAT, -1);
    }

    ListSetting targets = new ListSetting("МультиМод",
            new BooleanSetting("Игроки", true),
            new BooleanSetting("Голые", true),
            new BooleanSetting("Мобы", true),
            new BooleanSetting("Монстры", true),
            new BooleanSetting("Житилей", false)).setParent(this);

    BooleanSetting onlyCriticals = new BooleanSetting("Только Криты", false).setParent(this);
    NumberSetting Distance = new NumberSetting("Дистанция", 1.0f, 1f, 6, 0.1f).setParent(this);
    NumberSetting DopDistance = new NumberSetting("Доп Дистанция", 0.0f, 0.0f, 3, 0.1f).setParent(this);
    BooleanSetting focusTarget = new BooleanSetting("Фокусировать таргет", true).setParent(this);

    ModeSetting Correction = new ModeSetting("Коррекция движений", "Слабая", "Слабая", "Сильная", "Нету").setParent(this);

    @EventHandler
    public void onInput(InputMoveEvent event) {
        if (Correction.get().equals("Слабая") && target != null) {
            //lowRotation.applyRotation(event);
        }
        if (Correction.get().equals("Сильная") && target != null) {
            //strongRotation.applyRotation(event);
        }
    }

    @EventHandler
    public void onUpdate(UpdateEvent event) {
        LocalPlayer player = Minecraft.getInstance().player;

        if (player == null || player.isDeadOrDying()) {
            return;
        }

        target = findTarget();

        if (target != null && isInRange(player, target)) {
            updateRotation(target); // Передаем цель
            if (shouldPlayerFalling() && attackTimer.isReached(500)) {
                attackTarget(player, target);
            }
        }
    }

    private void updateRotation(boolean b, int target, int maxChange) {

    }

    private boolean shouldPlayerFalling() {
        LocalPlayer player = Minecraft.getInstance().player;
        return player.fallDistance > 0 && !player.isInWater() && !player.isInLava() && !player.isFallFlying() && !player.onGround();
    }

    private LivingEntity findTarget() {
        List<Entity> potentialTargets = new ArrayList<>();
        for (Entity entity : Minecraft.getInstance().level.entitiesForRendering()) {
            if (entity instanceof LivingEntity livingEntity && isValidTarget(livingEntity) && entity != Minecraft.getInstance().player) {
                potentialTargets.add(entity);
            }
        }

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

        if (focusTarget.get() && target != null && isValidTarget(target)) {
            return target;
        }

        return (LivingEntity) potentialTargets.stream()
                .min(Comparator.comparingDouble(Minecraft.getInstance().player::distanceTo))
                .orElse(null);
    }

    private boolean isValidTarget(LivingEntity entity) {
        if (!targets.getValue(0) && !targets.getValue(1) && !targets.getValue(2)
                && !targets.getValue(3) && !targets.getValue(4) && !targets.getValue(5)) {
            return false;
        }

        if (entity.getScoreboardName().length() < 2)
            return false;
        if (entity.isDeadOrDying() || entity.getHealth() <= 0.0f)
            return false;
        if (entity instanceof Player) {
            if (entity.getArmorValue() == 0 && !targets.getValue(1)) return false;
            if (!entity.getUUID().equals(UUID.nameUUIDFromBytes(("OfflinePlayer:" + entity.getScoreboardName()).getBytes(StandardCharsets.UTF_8))) && !targets.getValue(3)) return false;
        }

        return true;
    }


    public LivingEntity getCurrentTarget() {
        return findTarget();
    }

    private boolean isInRange(LocalPlayer player, Entity target) {
        return player.distanceTo(target) <= Distance.get();
    }

    private void attackTarget(LocalPlayer player, Entity target) {
        if (!(target instanceof Player) || AntiBot.isBot(target)) {
            return;
        }

        boolean SprintStop = false;

        if (onlyCriticals.get() && player.isSprinting()) {
            player.setSprinting(false);
            player.connection.send(new ServerboundPlayerCommandPacket(player, ServerboundPlayerCommandPacket.Action.STOP_SPRINTING));
            SprintStop = true;
        }

        Vec3 targetPosition = new Vec3(target.getX(), target.getY() + target.getBbHeight() * 0.9, target.getZ());
        player.attack(target);
        Minecraft.getInstance().gameMode.attack(player, target);
        player.swing(InteractionHand.MAIN_HAND);

        if (SprintStop) {
            player.setSprinting(true);
            player.connection.send(new ServerboundPlayerCommandPacket(player, ServerboundPlayerCommandPacket.Action.START_SPRINTING));
        }

        attackTimer.reset();
    }


    private void updateRotation(Entity target) {
        if (target == null) return;

        double deltaX = target.getX() - mc.player.getX();
        double deltaZ = target.getZ() - mc.player.getZ();
        double deltaY = target.getY() - (mc.player.getY() + mc.player.getEyeHeight());

        double distance = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ);
        float yaw = (float) (Math.atan2(deltaZ, deltaX) * (180 / Math.PI)) - 90.0F;
        float pitch = (float) -(Math.atan2(deltaY, distance) * (180 / Math.PI));

        mc.player.rotationYaw = updateRotation((Float) mc.player.rotationYaw, yaw, 70.0F);
        mc.player.rotationPitch = updateRotation((Float) mc.player.rotationPitch, pitch, 30.0F);
    }

    private float updateRotation(float current, float target, float maxChange) {
        float delta = MathHelper.wrapDegrees(target - current);

        if (delta > maxChange) {
            delta = maxChange;
        }
        if (delta < -maxChange) {
            delta = -maxChange;
        }

        return current + delta;
    }

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

    @Override
    public void onDisable() {
        super.onDisable();
        attackTimer.reset();
        target = null;
    }
}
double distance = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ);
учитывай deltaY, double distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ);
 
Назад
Сверху Снизу