Подведи собственные итоги года совместно с YOUGAME и забери ценные призы! Перейти

Вопрос Как сделать возрат головы после выключение KillAura на базу 3.1

Я не ебу че там за код я не пишу на экспе

Код:
Expand Collapse Copy
package im.expensive.functions.impl.combat;

import com.google.common.eventbus.Subscribe;
import im.expensive.Expensive;
import im.expensive.command.friends.FriendStorage;
import im.expensive.events.EventInput;
import im.expensive.events.EventMotion;
import im.expensive.events.EventUpdate;
import im.expensive.functions.api.Category;
import im.expensive.functions.api.Function;
import im.expensive.functions.api.FunctionRegister;
import im.expensive.functions.settings.impl.BooleanSetting;
import im.expensive.functions.settings.impl.ModeListSetting;
import im.expensive.functions.settings.impl.ModeSetting;
import im.expensive.functions.settings.impl.SliderSetting;
import im.expensive.utils.math.SensUtils;
import im.expensive.utils.math.StopWatch;
import im.expensive.utils.player.InventoryUtil;
import im.expensive.utils.player.MouseUtil;
import im.expensive.utils.player.MoveUtils;
import lombok.Getter;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.CHeldItemChangePacket;
import net.minecraft.network.play.client.CEntityActionPacket;
import net.minecraft.network.play.client.CUseEntityPacket;
import net.minecraft.block.Blocks;
import net.minecraft.tags.FluidTags;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Random;

import static java.lang.Math.hypot;
import static net.minecraft.util.math.MathHelper.clamp;
import static net.minecraft.util.math.MathHelper.wrapDegrees;

@FunctionRegister(name = "KillAura", type = Category.Combat)
public class KillAura extends Function {
    @Getter
    private final ModeSetting type = new ModeSetting("Тип", "Плавная", "Плавная", "Резкая", "HolyWorld", "HvH", "Spookytime", "RW");
    private final SliderSetting attackRange = new SliderSetting("Дистанция аттаки", 3f, 3f, 6f, 0.1f);
    private final SliderSetting elytraRange = new SliderSetting("Дистанция на элитре", 6.0F, 0.0F, 16.0F, 0.05F);
    private final SliderSetting preRange = new SliderSetting("Дистанция наводки", 0.3F, 0.0F, 3.0F, 0.05F);
    private final SliderSetting tick = new SliderSetting("Тики", 2.0F, 1.0F, 10.0F, 1.0F);
    
    private final SliderSetting points = new SliderSetting("Мультипоинты", 1, 1, 5, 1);
    private final BooleanSetting headPriority = new BooleanSetting("Приоритет на голову", true);

    final ModeListSetting targets = new ModeListSetting("Таргеты",
            new BooleanSetting("Игроки", true),
            new BooleanSetting("Голые", true),
            new BooleanSetting("Мобы", false),
            new BooleanSetting("Животные", false),
            new BooleanSetting("Друзья", false),
            new BooleanSetting("Голые невидимки", true),
            new BooleanSetting("Невидимки", true));

    @Getter
    final ModeListSetting options = new ModeListSetting("Опции",
            new BooleanSetting("Только криты", true),
            new BooleanSetting("Ломать щит", true),
            new BooleanSetting("Отжимать щит", true),
            new BooleanSetting("Синхронизировать атаку с ТПС", false),
            new BooleanSetting("Фокусировать одну цель", true),
            new BooleanSetting("Коррекция движения", true));

    final ModeSetting correctionType = new ModeSetting("Тип коррекции", "Незаметный", "Незаметный", "Сфокусированный");

    final ModeSetting sprints = new ModeSetting("Сброс спринта", "Выкл", "Выкл", "Грим", "Legit");

    @Getter
    private final StopWatch stopWatch = new StopWatch();
    @Getter
    public Vector2f rotateVector = new Vector2f(0, 0);
    @Getter
    private LivingEntity target;
    private Entity selected;

    int ticks = 0;
    boolean isRotated;
    boolean elytraTargetRule;
    float lastYaw;
    float lastPitch;

    final AutoPotion autoPotion;

    public KillAura(AutoPotion autoPotion) {
        this.autoPotion = autoPotion;
        addSettings(type, attackRange, elytraRange, preRange, tick, points, headPriority, targets, options, correctionType, sprints);
    }

    @Subscribe
    public void onInput(EventInput eventInput) {
        if (options.getValueByName("Коррекция движения").get() && correctionType.is("Незаметный") && target != null) {
            MoveUtils.fixMovement(eventInput, rotateVector.x);
        }
    }

    @Subscribe
    public void onUpdate(EventUpdate e) {
        if (options.getValueByName("Фокусировать одну цель").get() && (target == null || !isValid(target)) || !options.getValueByName("Фокусировать одну цель").get()) {
            updateTarget();
        }

        if (target != null && !(autoPotion.isState() && autoPotion.isActive())) {
            isRotated = false;
            if (shouldPlayerFalling() && (stopWatch.hasTimeElapsed())) {
                updateAttack();
                ticks = ((Float) tick.get()).intValue();
            }

            if (type.is("Резкая")) {
                if (ticks > 0) {
                    setRotate();
                    ticks--;
                } else {
                    reset();
                }
            } else {
                if (!isRotated) {
                    setRotate();
                }
            }

        } else {
            stopWatch.setLastMS(0);
            reset();
        }
    }

    @Subscribe
    private void onWalking(EventMotion e) {
        if (target == null || autoPotion.isState() && autoPotion.isActive()) return;

        e.setYaw(rotateVector.x);
        e.setPitch(rotateVector.y);

        mc.player.rotationYawHead = rotateVector.x;
        mc.player.renderYawOffset = rotateVector.x;
        mc.player.rotationPitchHead = rotateVector.y;
    }

    private void setRotate() {
        elytraTargetRule = mc.player.isElytraFlying() && target.isElytraFlying();
        if (type.is("Резкая")) {
            updateRotation(2.1474836E9F);
        } else {
            updateRotation(9999.0F);
        }
    }

    private float aimDistance() {
        return !this.type.is("Резкая") ? (Float) preRange.get() : 0.0F;
    }

    public float getMaxRange() {
        return getAttackRange() + aimDistance();
    }

    public float getAttackRange() {
        return (float) attackRange.get() + (mc.player.isElytraFlying() ? (float) elytraRange.get() : 0.0F);
    }

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

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

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

        if (targets.size() == 1) {
            target = targets.get(0);
            return;
        }

        targets.sort(Comparator.comparingDouble(object -> {
            if (object instanceof PlayerEntity player) {
                return -getEntityArmor(player);
            }
            if (object instanceof LivingEntity base) {
                return -base.getTotalArmorValue();
            }
            return 0.0;
        }).thenComparing((object, object2) -> {
            double d2 = getEntityHealth((LivingEntity) object);
            double d3 = getEntityHealth((LivingEntity) object2);
            return Double.compare(d2, d3);
        }).thenComparing((object, object2) -> {
            double d2 = mc.player.getDistance((LivingEntity) object);
            double d3 = mc.player.getDistance((LivingEntity) object2);
            return Double.compare(d2, d3);
        }));

        target = targets.get(0);
    }

    private Vector3d getMultiPointPosition(LivingEntity entity, int pointIndex, int totalPoints) {
        Vector3d basePos = entity.getPositionVec();
        float height = entity.getHeight();
        
        if (headPriority.get() && totalPoints > 1) {
            if (pointIndex == 0) {
                return basePos.add(0, height, 0);
            } else {
                float pointHeight = height * (0.7f + 0.3f * ((pointIndex - 1) / (float)(totalPoints - 2)));
                float randomOffsetX = (new Random().nextFloat() - 0.5f) * 0.15f;
                float randomOffsetZ = (new Random().nextFloat() - 0.5f) * 0.15f;
                return basePos.add(randomOffsetX, pointHeight, randomOffsetZ);
            }
        } else {
            float pointHeight = height * (pointIndex / (float)(totalPoints - 1));
            float randomOffsetX = (new Random().nextFloat() - 0.5f) * 0.2f;
            float randomOffsetZ = (new Random().nextFloat() - 0.5f) * 0.2f;
            return basePos.add(randomOffsetX, pointHeight, randomOffsetZ);
        }
    }

    private Vector3d getTargetHeadPosition() {
        return target.getPositionVec().add(0, target.getEyeHeight(), 0);
    }

    private Vector3d getOptimalHitPosition() {
        int totalPoints = points.get().intValue();
        
        if (totalPoints == 1 || !headPriority.get()) {
            int currentPoint = (int)((System.currentTimeMillis() / 100) % totalPoints);
            return getMultiPointPosition(target, currentPoint, totalPoints);
        }

        // Приоритет на голову: чаще выбираем голову
        Random random = new Random();
        int choice = random.nextInt(100);

        if (choice < 70) {
            return getTargetHeadPosition();
        } else {
            int currentPoint = 1 + (int)((System.currentTimeMillis() / 100) % (totalPoints - 1));
            return getMultiPointPosition(target, currentPoint, totalPoints);
        }
    }

    private void updateRotation(float rotationYawSpeed) {
        elytraTargetRule = mc.player.isElytraFlying() && target.isElytraFlying();

        Vector3d vec;
        float yawToTarget;
        float pitchToTarget;
        float yawDelta;
        float pitchDelta;
        
        Vector3d targetPos = getOptimalHitPosition();

        if (elytraTargetRule) {
            float scaleFactor = 75.0F / 20.0F;
            vec = targetPos.subtract(mc.player.getEyePosition(1.0F))
                    .add(target.getMotion().mul(scaleFactor, scaleFactor, scaleFactor));

            yawToTarget = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90.0);
            pitchToTarget = (float) (-Math.toDegrees(Math.atan2(vec.y, hypot(vec.x, vec.z))));
            yawDelta = MathHelper.wrapDegrees(yawToTarget - rotateVector.x);
            pitchDelta = MathHelper.wrapDegrees(pitchToTarget - rotateVector.y);
        } else {
            vec = targetPos.subtract(mc.player.getEyePosition(1.0F));

            yawToTarget = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90.0);
            pitchToTarget = (float) (-Math.toDegrees(Math.atan2(vec.y, hypot(vec.x, vec.z))));
            yawDelta = MathHelper.wrapDegrees(yawToTarget - rotateVector.x);
            pitchDelta = MathHelper.wrapDegrees(pitchToTarget - rotateVector.y);
        }

        isRotated = true;
        int roundedYaw = (int) yawDelta;

        switch (type.get()) {
            case "Плавная" -> {
                float yawSpeed = Math.min(Math.max(Math.abs(yawDelta), 1.0F), rotationYawSpeed);
                float pitchSpeed = Math.max(Math.abs(pitchDelta), 1.0F);

                float yaw = rotateVector.x + (yawDelta > 0.0F ? yawSpeed : -yawSpeed);
                float pitch = MathHelper.clamp(rotateVector.y + (pitchDelta > 0.0F ? pitchSpeed : -pitchSpeed), -90.0F, 90.0F);

                float gcd = SensUtils.getGCDValue();
                yaw -= (yaw - rotateVector.x) % gcd;
                pitch -= (pitch - rotateVector.y) % gcd;

                rotateVector = new Vector2f(yaw, pitch);
                lastYaw = yawSpeed;
                lastPitch = pitchSpeed;

                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = rotateVector.x;
                }
            }
            case "HvH" -> {
                float yawSpeed = Math.min(Math.max(Math.abs(yawDelta), 10.0F), rotationYawSpeed);
                float pitchSpeed = Math.max(Math.abs(pitchDelta), 10.0F);

                float yaw = rotateVector.x + (yawDelta > 0.0F ? yawSpeed : -yawSpeed);
                float pitch = MathHelper.clamp(rotateVector.y + (pitchDelta > 20.0F ? pitchSpeed : -pitchSpeed), -90.0F, 90.0F);

                float gcd = SensUtils.getGCDValue();
                yaw -= (yaw - rotateVector.x) % gcd;
                pitch -= (pitch - rotateVector.y) % gcd;

                rotateVector = new Vector2f(yaw, pitch);
                lastYaw = yawSpeed;
                lastPitch = pitchSpeed;

                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = rotateVector.x;
                }
            }
            case "Резкая" -> {
                float yaw = rotateVector.x + yawDelta;
                float pitch = MathHelper.clamp(rotateVector.y + pitchDelta, -90.0F, 90.0F);

                float gcd = SensUtils.getGCDValue();
                yaw -= (yaw - rotateVector.x) % gcd;
                pitch -= (pitch - rotateVector.y) % gcd;

                rotateVector = new Vector2f(yaw, pitch);

                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = rotateVector.x;
                }
            }
            case "RW" -> {
                float yawSpeed = Math.min(Math.max(Math.abs(yawDelta), 2.5F), rotationYawSpeed);
                float pitchSpeed = Math.max(Math.abs(pitchDelta), 2.5F);

                float yaw = rotateVector.x + (yawDelta > 0.0F ? yawSpeed : -yawSpeed);
                float pitch = MathHelper.clamp(rotateVector.y + (pitchDelta > 0.0F ? pitchSpeed : -pitchSpeed), -90.0F, 90.0F);

                float gcd = SensUtils.getGCDValue();
                yaw -= (yaw - rotateVector.x) % gcd;
                pitch -= (pitch - rotateVector.y) % gcd;

                rotateVector = new Vector2f(yaw, pitch);
                lastYaw = yawSpeed;
                lastPitch = pitchSpeed;

                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = rotateVector.x;
                }
            }
            case "Spookytime" -> {
                float clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 1.0E-4F), 22.5F);
                float clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 1.0E-4F), 7.0F);
                float randomYawFactor = (float)(Math.random() * 2.5F - 1.5F);
                float randomPitchFactor = (float)(Math.random() * 2.5F - 1.0F);
                float randomThreshold = (float)(Math.random() * 2.5F);
                float randomAddition = (float)(Math.random() * 3.5F + 2.5F);

                if (selected != target) {
                    clampedPitch = Math.max(Math.abs(pitchDelta), 1.0F);
                } else {
                    clampedPitch /= 3.0F;
                }

                if (Math.abs(clampedYaw - lastYaw) <= randomThreshold) {
                    clampedYaw = lastYaw + randomAddition;
                }

                clampedYaw += randomYawFactor;
                clampedPitch += randomPitchFactor;

                float yaw = rotateVector.x + (yawDelta > 0.0F ? clampedYaw : -clampedYaw);
                float pitch = MathHelper.clamp(rotateVector.y + (pitchDelta > 0.0F ? clampedPitch : -clampedPitch), -80.0F, 70.0F);

                float gcd = SensUtils.getGCDValue();
                yaw -= (yaw - rotateVector.x) % gcd;
                pitch -= (pitch - rotateVector.y) % gcd;

                rotateVector = new Vector2f(yaw, pitch);
                lastYaw = clampedYaw;
                lastPitch = clampedPitch;

                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = rotateVector.x;
                }
            }
            case "HolyWorld" -> {
                float clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 1.0E-4F), 52.0F);
                float clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 1.0E-4F), 22.0F);
                float randomYawFactor = (float)(Math.random() * 1.5 - 1.5);
                float randomPitchFactor = (float)(Math.random() * 1.5 - 1.0);
                float randomThreshold = (float)(Math.random() * 1.5);
                float randomAddition = (float)(Math.random() * 2.5 + 1.5);

                if (selected != target) {
                    clampedPitch = Math.max(Math.abs(pitchDelta), 1.0F);
                } else {
                    clampedPitch /= 3.0F;
                }

                if (Math.abs(clampedYaw - lastYaw) <= randomThreshold) {
                    clampedYaw = lastYaw + randomAddition;
                }

                clampedYaw += randomYawFactor;
                clampedPitch += randomPitchFactor;

                float yaw = rotateVector.x + (yawDelta > 0.0F ? clampedYaw : -clampedYaw);
                float pitch = MathHelper.clamp(rotateVector.y + (pitchDelta > 0.0F ? clampedPitch : -clampedPitch), -90.0F, 90.0F);

                float gcd = SensUtils.getGCDValue();
                yaw -= (yaw - rotateVector.x) % gcd;
                pitch -= (pitch - rotateVector.y) % gcd;

                rotateVector = new Vector2f(yaw, pitch);
                lastYaw = clampedYaw;
                lastPitch = clampedPitch;

                if (options.getValueByName("Коррекция движения").get()) {
                    mc.player.rotationYawOffset = rotateVector.x;
                }
            }
        }
    }

    private void updateAttack() {
        selected = MouseUtil.getMouseOver(target, rotateVector.x, rotateVector.y, getAttackRange());

        if ((selected == null || selected != target) && !mc.player.isElytraFlying()) {
            return;
        }

        if (mc.player.isBlocking() && options.getValueByName("Отжимать щит").get()) {
            mc.playerController.onStoppedUsingItem(mc.player);
        }

        stopWatch.setLastMS(600);
        mc.playerController.attackEntity(mc.player, target);
        mc.player.swingArm(Hand.MAIN_HAND);

        boolean is_sprint = mc.player.isSprinting();
        boolean sprint = false;
        if (is_sprint) {
            if (sprints.is("Грим")) {
                mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.STOP_SPRINTING));
                if (mc.player.isInWater()) {
                    mc.player.setSprinting(false);
                    sprint = true;
                }
                sprint = true;
            }
            if (sprints.is("Legit")) {
                mc.player.connection.sendPacket(new CUseEntityPacket(target, mc.player.isSneaking()));

                new Thread(() -> {
                    try {
                        Thread.sleep(50);
                        mc.player.setSprinting(true);
                    } catch (InterruptedException ignored) {}
                }).start();
            }
        }

        if (target instanceof PlayerEntity player && options.getValueByName("Ломать щит").get()) {
            breakShieldPlayer(player);
        }
    }

    private boolean shouldPlayerFalling() {
        boolean cancelReason = mc.player.isInWater() && mc.player.areEyesInFluid(FluidTags.WATER) || mc.player.isInLava() || mc.player.isOnLadder() || mc.player.isPassenger() || mc.player.abilities.isFlying;

        float attackStrength = mc.player.getCooledAttackStrength(options.getValueByName("Синхронизировать атаку с ТПС").get()
                ? Expensive.getInstance().getTpsCalc().getAdjustTicks() : 1.5f);

        if (attackStrength < 0.92f) {
            return false;
        }

        boolean onlyCrits = options.getValueByName("Только криты").get();
        BlockPos playerPos = new BlockPos(mc.player.getPosX(), mc.player.getPosY(), mc.player.getPosZ());
        boolean inWeb = mc.world.getBlockState(playerPos).getBlock() == Blocks.COBWEB ||
                mc.world.getBlockState(playerPos.down()).getBlock() == Blocks.COBWEB;
        boolean attackBlocked = mc.player.isBlocking();

        if (onlyCrits && !cancelReason) {
            if (inWeb || attackBlocked) {
                return true;
            }
            return !mc.player.isOnGround() && mc.player.fallDistance > 0;
        }

        return !cancelReason;
    }

    private boolean isValid(LivingEntity entity) {
        if (entity instanceof ClientPlayerEntity) return false;

        if (entity.ticksExisted < 3) return false;
        if (mc.player.getDistanceEyePos(entity) > getMaxRange()) return false;

        if (entity instanceof PlayerEntity p) {
            if (AntiBot.isBot(entity)) {
                return false;
            }
            if (!targets.getValueByName("Друзья").get() && FriendStorage.isFriend(p.getName().getString())) {
                return false;
            }
            if (p.getName().getString().equalsIgnoreCase(mc.player.getName().getString())) return false;
        }

        if (entity instanceof PlayerEntity && !targets.getValueByName("Игроки").get()) {
            return false;
        }
        if (entity instanceof PlayerEntity && entity.getTotalArmorValue() == 0 && !targets.getValueByName("Голые").get()) {
            return false;
        }
        if (entity instanceof PlayerEntity && entity.isInvisible() && entity.getTotalArmorValue() == 0 && !targets.getValueByName("Голые невидимки").get()) {
            return false;
        }
        if (entity instanceof PlayerEntity && entity.isInvisible() && !targets.getValueByName("Невидимки").get()) {
            return false;
        }

        if (entity instanceof MonsterEntity && !targets.getValueByName("Мобы").get()) {
            return false;
        }
        if (entity instanceof AnimalEntity && !targets.getValueByName("Животные").get()) {
            return false;
        }

        return !entity.isInvulnerable() && entity.isAlive() && !(entity instanceof ArmorStandEntity);
    }

    private void breakShieldPlayer(PlayerEntity entity) {
        if (entity.isBlocking()) {
            int invSlot = InventoryUtil.getInstance().getAxeInInventory(false);
            int hotBarSlot = InventoryUtil.getInstance().getAxeInInventory(true);

            if (hotBarSlot == -1 && invSlot != -1) {
                int bestSlot = InventoryUtil.getInstance().findBestSlotInHotBar();
                mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, mc.player);
                mc.playerController.windowClick(0, bestSlot + 36, 0, ClickType.PICKUP, mc.player);

                mc.player.connection.sendPacket(new CHeldItemChangePacket(bestSlot));
                mc.playerController.attackEntity(mc.player, entity);
                mc.player.swingArm(Hand.MAIN_HAND);
                mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));

                mc.playerController.windowClick(0, bestSlot + 36, 0, ClickType.PICKUP, mc.player);
                mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, mc.player);
            }

            if (hotBarSlot != -1) {
                mc.player.connection.sendPacket(new CHeldItemChangePacket(hotBarSlot));
                mc.playerController.attackEntity(mc.player, entity);
                mc.player.swingArm(Hand.MAIN_HAND);
                mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
            }
        }
    }

    private void reset() {
        if (options.getValueByName("Коррекция движения").get()) {
            mc.player.rotationYawOffset = Integer.MIN_VALUE;
        }
        rotateVector = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
    }

    @Override
    public boolean onEnable() {
        super.onEnable();
        reset();
        target = null;
        return false;
    }

    @Override
    public void onDisable() {
        super.onDisable();
        reset();
        stopWatch.setLastMS(0);
        target = null;
    }

    private double getEntityArmor(PlayerEntity entityPlayer2) {
        double d2 = 0.0;
        for (int i2 = 0; i2 < 4; ++i2) {
            ItemStack is = entityPlayer2.inventory.armorInventory.get(i2);
            if (!(is.getItem() instanceof ArmorItem)) continue;
            d2 += getProtectionLvl(is);
        }
        return d2;
    }

    private double getProtectionLvl(ItemStack stack) {
        if (stack.getItem() instanceof ArmorItem i) {
            double damageReduceAmount = i.getDamageReduceAmount();
            if (stack.isEnchanted()) {
                damageReduceAmount += (double) EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25;
            }
            return damageReduceAmount;
        }
        return 0;
    }

    private double getEntityHealth(LivingEntity ent) {
        if (ent instanceof PlayerEntity player) {
            return (double) (player.getHealth() + player.getAbsorptionAmount()) * (getEntityArmor(player) / 20.0);
        }
        return ent.getHealth() + ent.getAbsorptionAmount();
    }
}
 
нужен обработчик который продолжит обрабатывать ротацию даже после отключения модуля, а не в onDisable пихать
Бляха я тупой нечего не понимаю как эта сделать
 
Как сделать так что бы после выключение KillAura у тебя плавно возращялась голова как в нурсултан или найт длс
сделать утилку для поворота камеры и совместить ее с фрилуком
дальше зделать 3 режима (наводки, отводки, ожидание)
и если режим наводка и время прошло (оно может быть любое)
то режим отводки который наводится куда ты смотришь
так же с этим но если скалярный вектор похож по градусам
 
Назад
Сверху Снизу