Исходник KillAura с eclipse (Expensive 3.1 ready!)

Начинающий
Статус
Оффлайн
Регистрация
15 Мар 2024
Сообщения
212
Реакции[?]
1
Поинты[?]
1K

Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:

  • бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
  • маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
  • приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
  • обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.

Спасибо!

Мои любимые говно-пастеры держите высер с eclipsа под HW :roflanEbalo: :roflanBuldiga: 🍿
WOW you are a star like:
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

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.Setting;
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 java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
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.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.CHeldItemChangePacket;
import net.minecraft.tags.FluidTags;
import net.minecraft.util.Hand;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.RayTraceContext.BlockMode;
import net.minecraft.util.math.RayTraceContext.FluidMode;
import net.minecraft.util.math.RayTraceResult.Type;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;

@FunctionRegister(
        name = "KillAura",
        type = Category.Combat
)
public class KillAura extends Function {
    private final ModeSetting type = new ModeSetting("Тип", "Lite", new String[]{"Lite", "Classic", "Lite1", "Lite2"});
    private final SliderSetting attackRange = new SliderSetting("Дистанция аттаки", 3.0F, 3.0F, 6.0F, 0.1F);
    final ModeListSetting targets = new ModeListSetting("Таргеты", new BooleanSetting[]{new BooleanSetting("Игроки", true), new BooleanSetting("Голые", true), new BooleanSetting("Мобы", false), new BooleanSetting("Животные", false), new BooleanSetting("Друзья", false), new BooleanSetting("Голые невидимки", true), new BooleanSetting("Невидимки", true)});
    final ModeListSetting options = new ModeListSetting("Опции", new BooleanSetting[]{new BooleanSetting("Только криты", true), new BooleanSetting("Ломать щит", true), new BooleanSetting("Отжимать щит", true), new BooleanSetting("Ускорять ротацию при атаке", false), new BooleanSetting("Синхронизировать атаку с ТПС", false), new BooleanSetting("Фокусировать одну цель", true), new BooleanSetting("Коррекция движения", true)});
    final ModeSetting correctionType = new ModeSetting("Тип коррекции", "Сфокусированный", new String[]{"Сфокусированный", "Незаметный"});
    private final BooleanSetting checkWallObstruction = new BooleanSetting("не бить через стену", true);
    private final StopWatch stopWatch = new StopWatch();
    private Vector2f rotateVector = new Vector2f(0.0F, 0.0F);
    private LivingEntity target;
    private Entity selected;
    int ticks = 0;
    boolean isRotated;
    final AutoPotion autoPotion;
    float lastYaw;
    float lastPitch;

    public KillAura(AutoPotion autoPotion) {
        this.autoPotion = autoPotion;
        this.addSettings(new Setting[]{this.type, this.attackRange, this.targets, this.options, this.correctionType, this.checkWallObstruction});
    }

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

    }

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

        if (this.target != null && (!this.autoPotion.isState() || !this.autoPotion.isActive())) {
            this.isRotated = false;
            if (this.shouldPlayerFalling() && this.stopWatch.hasTimeElapsed()) {
                this.updateAttack();
                this.ticks = 2;
            }

            if (this.type.is("Classic")) {
                if (this.ticks > 0) {
                    this.updateRotation(true, 180.0F, 90.0F);
                    --this.ticks;
                } else {
                    this.reset();
                }
            } else if (!this.isRotated) {
                this.updateRotation(false, 80.0F, 35.0F);
            }
        } else {
            this.stopWatch.setLastMS(0L);
            this.reset();
        }

    }

    @Subscribe
    private void onWalking(EventMotion e) {
        if (this.target != null && (!this.autoPotion.isState() || !this.autoPotion.isActive())) {
            float yaw = this.rotateVector.x;
            float pitch = this.rotateVector.y;
            e.setYaw(yaw);
            e.setPitch(pitch);
            Minecraft var10000 = mc;
            Minecraft.player.rotationYawHead = yaw;
            var10000 = mc;
            Minecraft.player.renderYawOffset = yaw;
            var10000 = mc;
            Minecraft.player.rotationPitchHead = pitch;
        }
    }

    private void updateTarget() {
        List<LivingEntity> targets = new ArrayList();
        Minecraft var10000 = mc;
        Iterator var2 = Minecraft.world.getAllEntities().iterator();

        while(var2.hasNext()) {
            Entity entity = (Entity)var2.next();
            if (entity instanceof LivingEntity living) {
                if (this.isValid(living)) {
                    targets.add(living);
                }
            }
        }

        if (targets.isEmpty()) {
            this.target = null;
        } else if (targets.size() == 1) {
            this.target = (LivingEntity)targets.get(0);
        } else {
            targets.sort(Comparator.comparingDouble((object) -> {
                if (object instanceof PlayerEntity player) {
                    return -this.getEntityArmor(player);
                } else if (object instanceof LivingEntity base) {
                    return (double)(-base.getTotalArmorValue());
                } else {
                    return 0.0;
                }
            }).thenComparing((object, object2) -> {
                double d2 = this.getEntityHealth((LivingEntity)object);
                double d3 = this.getEntityHealth((LivingEntity)object2);
                return Double.compare(d2, d3);
            }).thenComparing((object, object2) -> {
                double d2 = (double)Minecraft.player.getDistance((LivingEntity)object);
                double d3 = (double)Minecraft.player.getDistance((LivingEntity)object2);
                return Double.compare(d2, d3);
            }));
            this.target = (LivingEntity)targets.get(0);
        }
    }

    private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
        Vector3d var10000 = this.target.getPositionVec().add(0.0, MathHelper.clamp(1.1, 0.3, (double)this.target.getHeight()), 0.0);
        Minecraft var10001 = mc;
        Vector3d vec = var10000.subtract(Minecraft.player.getEyePosition(1.0F));
        this.isRotated = true;
        float yawToTarget = (float)MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90.0);
        float pitchToTarget = (float)(-Math.toDegrees(Math.atan2(vec.y, Math.hypot(vec.x, vec.z))));
        float yawDelta = MathHelper.wrapDegrees(yawToTarget - this.rotateVector.x);
        float pitchDelta = MathHelper.wrapDegrees(pitchToTarget - this.rotateVector.y);
        int roundedYaw = (int)yawDelta;
        float clampedYaw;
        float clampedPitch;
        float yaw;
        float pitch;
        float gcd;
        Minecraft var17;
        switch ((String)this.type.get()) {
            case "Lite1":
                clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 0.2F), rotationYawSpeed * 0.5F);
                clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 0.2F), rotationPitchSpeed * 0.5F);
                if (attack && this.selected != this.target && (Boolean)this.options.getValueByName("Ускорять ротацию при атаке").get()) {
                    clampedPitch = Math.max(Math.abs(pitchDelta), 1.0F);
                } else {
                    clampedPitch /= 3.0F;
                }

                if (Math.abs(clampedYaw - this.lastYaw) <= 3.0F) {
                    clampedYaw = this.lastYaw + 3.1F;
                }

                yaw = this.rotateVector.x + ((double)yawDelta > 0.1 ? clampedYaw : -clampedYaw);
                pitch = MathHelper.clamp(this.rotateVector.y + ((double)pitchDelta > 0.1 ? clampedPitch : -clampedPitch), -89.0F, 89.0F);
                gcd = SensUtils.getGCDValue();
                yaw -= (yaw - this.rotateVector.x) % gcd;
                pitch -= (pitch - this.rotateVector.y) % gcd;
                this.rotateVector = new Vector2f(yaw, pitch);
                this.lastYaw = clampedYaw;
                this.lastPitch = clampedPitch;
                if ((Boolean)this.options.getValueByName("Коррекция движения").get()) {
                    var17 = mc;
                    Minecraft.player.rotationYawOffset = yaw;
                }
                break;
            case "Lite":
                clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 3.0F), rotationYawSpeed * 1.5F);
                clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 3.0F), rotationPitchSpeed * 1.5F);
                if (attack && this.selected != this.target && (Boolean)this.options.getValueByName("Ускорять ротацию при атаке").get()) {
                    clampedPitch = Math.max(Math.abs(pitchDelta), 1.0F);
                } else {
                    clampedPitch /= 3.0F;
                }

                if (Math.abs(clampedYaw - this.lastYaw) <= 3.0F) {
                    clampedYaw = this.lastYaw + 3.1F;
                }

                yaw = this.rotateVector.x + (yawDelta > 0.0F ? clampedYaw : -clampedYaw);
                pitch = MathHelper.clamp(this.rotateVector.y + (pitchDelta > 0.0F ? clampedPitch : -clampedPitch), -89.0F, 89.0F);
                gcd = SensUtils.getGCDValue();
                yaw -= (yaw - this.rotateVector.x) % gcd;
                pitch -= (pitch - this.rotateVector.y) % gcd;
                this.rotateVector = new Vector2f(yaw, pitch);
                this.lastYaw = clampedYaw;
                this.lastPitch = clampedPitch;
                if ((Boolean)this.options.getValueByName("Коррекция движения").get()) {
                    var17 = mc;
                    Minecraft.player.rotationYawOffset = yaw;
                }
                break;
            case "Lite2":
                clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 1.0F), rotationYawSpeed);
                clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 1.0F), rotationPitchSpeed);
                if (attack && this.selected != this.target && (Boolean)this.options.getValueByName("Ускорять ротацию при атаке").get()) {
                    clampedPitch = Math.max(Math.abs(pitchDelta), 1.0F);
                } else {
                    clampedPitch /= 3.0F;
                }

                if (Math.abs(clampedYaw - this.lastYaw) <= 3.0F) {
                    clampedYaw = this.lastYaw + 3.1F;
                }

                yaw = this.rotateVector.x + (yawDelta > 0.0F ? clampedYaw : -clampedYaw);
                pitch = MathHelper.clamp(this.rotateVector.y + (pitchDelta > 0.0F ? clampedPitch : -clampedPitch), -89.0F, 89.0F);
                gcd = SensUtils.getGCDValue();
                yaw -= (yaw - this.rotateVector.x) % gcd;
                pitch -= (pitch - this.rotateVector.y) % gcd;
                this.rotateVector = new Vector2f(yaw, pitch);
                this.lastYaw = clampedYaw;
                this.lastPitch = clampedPitch;
                if ((Boolean)this.options.getValueByName("Коррекция движения").get()) {
                    var17 = mc;
                    Minecraft.player.rotationYawOffset = yaw;
                }
                break;
            case "Classic":
                clampedYaw = this.rotateVector.x + (float)roundedYaw;
                clampedPitch = MathHelper.clamp(this.rotateVector.y + pitchDelta, -90.0F, 90.0F);
                yaw = SensUtils.getGCDValue();
                clampedYaw -= (clampedYaw - this.rotateVector.x) % yaw;
                clampedPitch -= (clampedPitch - this.rotateVector.y) % yaw;
                this.rotateVector = new Vector2f(clampedYaw, clampedPitch);
                if ((Boolean)this.options.getValueByName("Коррекция движения").get()) {
                    var17 = mc;
                    Minecraft.player.rotationYawOffset = clampedYaw;
                }
        }

    }

    private void updateAttack() {
        if (!(Boolean)this.checkWallObstruction.get() || this.canSeeThroughWall(this.target)) {
            this.selected = MouseUtil.getMouseOver(this.target, this.rotateVector.x, this.rotateVector.y, (double)(Float)this.attackRange.get());
            if ((Boolean)this.options.getValueByName("Ускорять ротацию при атаке").get()) {
                this.updateRotation(true, 60.0F, 35.0F);
            }

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

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

            this.stopWatch.setLastMS(500L);
            var10001 = mc;
            mc.playerController.attackEntity(Minecraft.player, this.target);
            var10000 = mc;
            Minecraft.player.swingArm(Hand.MAIN_HAND);
            LivingEntity var2 = this.target;
            if (var2 instanceof PlayerEntity) {
                PlayerEntity player = (PlayerEntity)var2;
                if ((Boolean)this.options.getValueByName("Ломать щит").get()) {
                    this.breakShieldPlayer(player);
                }
            }

        }
    }

    private boolean canSeeThroughWall(Entity entity) {
        Minecraft var10000 = mc;
        ClientWorld var3 = Minecraft.world;
        Minecraft var10003 = mc;
        Vector3d var4 = Minecraft.player.getEyePosition(1.0F);
        Vector3d var10004 = entity.getEyePosition(1.0F);
        Minecraft var10007 = mc;
        RayTraceResult result = var3.rayTraceBlocks(new RayTraceContext(var4, var10004, BlockMode.COLLIDER, FluidMode.NONE, Minecraft.player));
        return result == null || result.getType() == Type.MISS;
    }

    private boolean shouldPlayerFalling() {
        Minecraft var10000;
        boolean var3;
        label46: {
            label45: {
                var10000 = mc;
                if (Minecraft.player.isInWater()) {
                    var10000 = mc;
                    if (Minecraft.player.areEyesInFluid(FluidTags.WATER)) {
                        break label45;
                    }
                }

                var10000 = mc;
                if (!Minecraft.player.isInLava()) {
                    var10000 = mc;
                    if (!Minecraft.player.isOnLadder()) {
                        var10000 = mc;
                        if (!Minecraft.player.isPassenger()) {
                            var10000 = mc;
                            if (!Minecraft.player.abilities.isFlying) {
                                var3 = false;
                                break label46;
                            }
                        }
                    }
                }
            }

            var3 = true;
        }

        boolean cancelReason = var3;
        var10000 = mc;
        float attackStrength = Minecraft.player.getCooledAttackStrength((Boolean)this.options.getValueByName("Синхронизировать атаку с ТПС").get() ? Expensive.getInstance().getTpsCalc().getAdjustTicks() : 1.5F);
        if (attackStrength < 0.92F) {
            return false;
        } else if (!cancelReason && (Boolean)this.options.getValueByName("Только криты").get()) {
            var10000 = mc;
            if (!Minecraft.player.isOnGround()) {
                var10000 = mc;
                if (Minecraft.player.fallDistance > 0.0F) {
                    var3 = true;
                    return var3;
                }
            }

            var3 = false;
            return var3;
        } else {
            return true;
        }
    }

    private boolean isValid(LivingEntity entity) {
        if (entity instanceof ClientPlayerEntity) {
            return false;
        } else if (entity.ticksExisted < 3) {
            return false;
        } else {
            Minecraft var10000 = mc;
            if (Minecraft.player.getDistanceEyePos(entity) > (double)(Float)this.attackRange.get()) {
                return false;
            } else {
                if (entity instanceof PlayerEntity) {
                    PlayerEntity p = (PlayerEntity)entity;
                    if (!(Boolean)this.targets.getValueByName("Друзья").get() && FriendStorage.isFriend(p.getName().getString())) {
                        return false;
                    }

                    String var3 = p.getName().getString();
                    Minecraft var10001 = mc;
                    if (var3.equalsIgnoreCase(Minecraft.player.getName().getString())) {
                        return false;
                    }
                }

                if (entity instanceof PlayerEntity && !(Boolean)this.targets.getValueByName("Игроки").get()) {
                    return false;
                } else if (entity instanceof PlayerEntity && entity.getTotalArmorValue() == 0 && !(Boolean)this.targets.getValueByName("Голые").get()) {
                    return false;
                } else if (entity instanceof PlayerEntity && entity.isInvisible() && entity.getTotalArmorValue() == 0 && !(Boolean)this.targets.getValueByName("Голые невидимки").get()) {
                    return false;
                } else if (entity instanceof PlayerEntity && entity.isInvisible() && !(Boolean)this.targets.getValueByName("Невидимки").get()) {
                    return false;
                } else if (entity instanceof MonsterEntity && !(Boolean)this.targets.getValueByName("Мобы").get()) {
                    return false;
                } else if (entity instanceof AnimalEntity && !(Boolean)this.targets.getValueByName("Животные").get()) {
                    return false;
                } else {
                    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);
            Minecraft var10000;
            Minecraft var10001;
            Minecraft var10003;
            if (hotBarSlot == -1 && invSlot != -1) {
                int bestSlot = InventoryUtil.getInstance().findBestSlotInHotBar();
                Minecraft var10005 = mc;
                mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, Minecraft.player);
                int var10002 = bestSlot + 36;
                var10005 = mc;
                mc.playerController.windowClick(0, var10002, 0, ClickType.PICKUP, Minecraft.player);
                var10000 = mc;
                Minecraft.player.connection.sendPacket(new CHeldItemChangePacket(bestSlot));
                var10001 = mc;
                mc.playerController.attackEntity(Minecraft.player, entity);
                var10000 = mc;
                Minecraft.player.swingArm(Hand.MAIN_HAND);
                var10000 = mc;
                var10003 = mc;
                Minecraft.player.connection.sendPacket(new CHeldItemChangePacket(Minecraft.player.inventory.currentItem));
                var10002 = bestSlot + 36;
                var10005 = mc;
                mc.playerController.windowClick(0, var10002, 0, ClickType.PICKUP, Minecraft.player);
                var10005 = mc;
                mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, Minecraft.player);
            }

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

    }

    private void reset() {
        if ((Boolean)this.options.getValueByName("Коррекция движения").get()) {
            Minecraft var10000 = mc;
            Minecraft.player.rotationYawOffset = -2.14748365E9F;
        }

        Minecraft var10003 = mc;
        Minecraft var10004 = mc;
        this.rotateVector = new Vector2f(Minecraft.player.rotationYaw, Minecraft.player.rotationPitch);
    }

    public void onEnable() {
        super.onEnable();
        this.reset();
        this.target = null;
    }

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

    private double getEntityArmor(PlayerEntity entityPlayer2) {
        double d2 = 0.0;

        for(int i2 = 0; i2 < 4; ++i2) {
            ItemStack is = (ItemStack)entityPlayer2.inventory.armorInventory.get(i2);
            if (is.getItem() instanceof ArmorItem) {
                d2 += this.getProtectionLvl(is);
            }
        }

        return d2;
    }

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

            return damageReduceAmount;
        } else {
            return 0.0;
        }
    }

    private double getEntityHealth(LivingEntity ent) {
        if (ent instanceof PlayerEntity player) {
            return (double)(player.getHealth() + player.getAbsorptionAmount()) * (this.getEntityArmor(player) / 20.0);
        } else {
            return (double)(ent.getHealth() + ent.getAbsorptionAmount());
        }
    }

    public ModeSetting getType() {
        return this.type;
    }

    public ModeListSetting getOptions() {
        return this.options;
    }

    public StopWatch getStopWatch() {
        return this.stopWatch;
    }

    public LivingEntity getTarget() {
        return this.target;
    }
}
 
Начинающий
Статус
Оффлайн
Регистрация
7 Авг 2024
Сообщения
6
Реакции[?]
0
Поинты[?]
0
Мои любимые говно-пастеры держите высер с eclipsа под HW :roflanEbalo: :roflanBuldiga: 🍿
WOW you are a star like:
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

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.Setting;
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 java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
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.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.CHeldItemChangePacket;
import net.minecraft.tags.FluidTags;
import net.minecraft.util.Hand;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.RayTraceContext.BlockMode;
import net.minecraft.util.math.RayTraceContext.FluidMode;
import net.minecraft.util.math.RayTraceResult.Type;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;

@FunctionRegister(
        name = "KillAura",
        type = Category.Combat
)
public class KillAura extends Function {
    private final ModeSetting type = new ModeSetting("Тип", "Lite", new String[]{"Lite", "Classic", "Lite1", "Lite2"});
    private final SliderSetting attackRange = new SliderSetting("Дистанция аттаки", 3.0F, 3.0F, 6.0F, 0.1F);
    final ModeListSetting targets = new ModeListSetting("Таргеты", new BooleanSetting[]{new BooleanSetting("Игроки", true), new BooleanSetting("Голые", true), new BooleanSetting("Мобы", false), new BooleanSetting("Животные", false), new BooleanSetting("Друзья", false), new BooleanSetting("Голые невидимки", true), new BooleanSetting("Невидимки", true)});
    final ModeListSetting options = new ModeListSetting("Опции", new BooleanSetting[]{new BooleanSetting("Только криты", true), new BooleanSetting("Ломать щит", true), new BooleanSetting("Отжимать щит", true), new BooleanSetting("Ускорять ротацию при атаке", false), new BooleanSetting("Синхронизировать атаку с ТПС", false), new BooleanSetting("Фокусировать одну цель", true), new BooleanSetting("Коррекция движения", true)});
    final ModeSetting correctionType = new ModeSetting("Тип коррекции", "Сфокусированный", new String[]{"Сфокусированный", "Незаметный"});
    private final BooleanSetting checkWallObstruction = new BooleanSetting("не бить через стену", true);
    private final StopWatch stopWatch = new StopWatch();
    private Vector2f rotateVector = new Vector2f(0.0F, 0.0F);
    private LivingEntity target;
    private Entity selected;
    int ticks = 0;
    boolean isRotated;
    final AutoPotion autoPotion;
    float lastYaw;
    float lastPitch;

    public KillAura(AutoPotion autoPotion) {
        this.autoPotion = autoPotion;
        this.addSettings(new Setting[]{this.type, this.attackRange, this.targets, this.options, this.correctionType, this.checkWallObstruction});
    }

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

    }

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

        if (this.target != null && (!this.autoPotion.isState() || !this.autoPotion.isActive())) {
            this.isRotated = false;
            if (this.shouldPlayerFalling() && this.stopWatch.hasTimeElapsed()) {
                this.updateAttack();
                this.ticks = 2;
            }

            if (this.type.is("Classic")) {
                if (this.ticks > 0) {
                    this.updateRotation(true, 180.0F, 90.0F);
                    --this.ticks;
                } else {
                    this.reset();
                }
            } else if (!this.isRotated) {
                this.updateRotation(false, 80.0F, 35.0F);
            }
        } else {
            this.stopWatch.setLastMS(0L);
            this.reset();
        }

    }

    @Subscribe
    private void onWalking(EventMotion e) {
        if (this.target != null && (!this.autoPotion.isState() || !this.autoPotion.isActive())) {
            float yaw = this.rotateVector.x;
            float pitch = this.rotateVector.y;
            e.setYaw(yaw);
            e.setPitch(pitch);
            Minecraft var10000 = mc;
            Minecraft.player.rotationYawHead = yaw;
            var10000 = mc;
            Minecraft.player.renderYawOffset = yaw;
            var10000 = mc;
            Minecraft.player.rotationPitchHead = pitch;
        }
    }

    private void updateTarget() {
        List<LivingEntity> targets = new ArrayList();
        Minecraft var10000 = mc;
        Iterator var2 = Minecraft.world.getAllEntities().iterator();

        while(var2.hasNext()) {
            Entity entity = (Entity)var2.next();
            if (entity instanceof LivingEntity living) {
                if (this.isValid(living)) {
                    targets.add(living);
                }
            }
        }

        if (targets.isEmpty()) {
            this.target = null;
        } else if (targets.size() == 1) {
            this.target = (LivingEntity)targets.get(0);
        } else {
            targets.sort(Comparator.comparingDouble((object) -> {
                if (object instanceof PlayerEntity player) {
                    return -this.getEntityArmor(player);
                } else if (object instanceof LivingEntity base) {
                    return (double)(-base.getTotalArmorValue());
                } else {
                    return 0.0;
                }
            }).thenComparing((object, object2) -> {
                double d2 = this.getEntityHealth((LivingEntity)object);
                double d3 = this.getEntityHealth((LivingEntity)object2);
                return Double.compare(d2, d3);
            }).thenComparing((object, object2) -> {
                double d2 = (double)Minecraft.player.getDistance((LivingEntity)object);
                double d3 = (double)Minecraft.player.getDistance((LivingEntity)object2);
                return Double.compare(d2, d3);
            }));
            this.target = (LivingEntity)targets.get(0);
        }
    }

    private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
        Vector3d var10000 = this.target.getPositionVec().add(0.0, MathHelper.clamp(1.1, 0.3, (double)this.target.getHeight()), 0.0);
        Minecraft var10001 = mc;
        Vector3d vec = var10000.subtract(Minecraft.player.getEyePosition(1.0F));
        this.isRotated = true;
        float yawToTarget = (float)MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90.0);
        float pitchToTarget = (float)(-Math.toDegrees(Math.atan2(vec.y, Math.hypot(vec.x, vec.z))));
        float yawDelta = MathHelper.wrapDegrees(yawToTarget - this.rotateVector.x);
        float pitchDelta = MathHelper.wrapDegrees(pitchToTarget - this.rotateVector.y);
        int roundedYaw = (int)yawDelta;
        float clampedYaw;
        float clampedPitch;
        float yaw;
        float pitch;
        float gcd;
        Minecraft var17;
        switch ((String)this.type.get()) {
            case "Lite1":
                clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 0.2F), rotationYawSpeed * 0.5F);
                clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 0.2F), rotationPitchSpeed * 0.5F);
                if (attack && this.selected != this.target && (Boolean)this.options.getValueByName("Ускорять ротацию при атаке").get()) {
                    clampedPitch = Math.max(Math.abs(pitchDelta), 1.0F);
                } else {
                    clampedPitch /= 3.0F;
                }

                if (Math.abs(clampedYaw - this.lastYaw) <= 3.0F) {
                    clampedYaw = this.lastYaw + 3.1F;
                }

                yaw = this.rotateVector.x + ((double)yawDelta > 0.1 ? clampedYaw : -clampedYaw);
                pitch = MathHelper.clamp(this.rotateVector.y + ((double)pitchDelta > 0.1 ? clampedPitch : -clampedPitch), -89.0F, 89.0F);
                gcd = SensUtils.getGCDValue();
                yaw -= (yaw - this.rotateVector.x) % gcd;
                pitch -= (pitch - this.rotateVector.y) % gcd;
                this.rotateVector = new Vector2f(yaw, pitch);
                this.lastYaw = clampedYaw;
                this.lastPitch = clampedPitch;
                if ((Boolean)this.options.getValueByName("Коррекция движения").get()) {
                    var17 = mc;
                    Minecraft.player.rotationYawOffset = yaw;
                }
                break;
            case "Lite":
                clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 3.0F), rotationYawSpeed * 1.5F);
                clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 3.0F), rotationPitchSpeed * 1.5F);
                if (attack && this.selected != this.target && (Boolean)this.options.getValueByName("Ускорять ротацию при атаке").get()) {
                    clampedPitch = Math.max(Math.abs(pitchDelta), 1.0F);
                } else {
                    clampedPitch /= 3.0F;
                }

                if (Math.abs(clampedYaw - this.lastYaw) <= 3.0F) {
                    clampedYaw = this.lastYaw + 3.1F;
                }

                yaw = this.rotateVector.x + (yawDelta > 0.0F ? clampedYaw : -clampedYaw);
                pitch = MathHelper.clamp(this.rotateVector.y + (pitchDelta > 0.0F ? clampedPitch : -clampedPitch), -89.0F, 89.0F);
                gcd = SensUtils.getGCDValue();
                yaw -= (yaw - this.rotateVector.x) % gcd;
                pitch -= (pitch - this.rotateVector.y) % gcd;
                this.rotateVector = new Vector2f(yaw, pitch);
                this.lastYaw = clampedYaw;
                this.lastPitch = clampedPitch;
                if ((Boolean)this.options.getValueByName("Коррекция движения").get()) {
                    var17 = mc;
                    Minecraft.player.rotationYawOffset = yaw;
                }
                break;
            case "Lite2":
                clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 1.0F), rotationYawSpeed);
                clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 1.0F), rotationPitchSpeed);
                if (attack && this.selected != this.target && (Boolean)this.options.getValueByName("Ускорять ротацию при атаке").get()) {
                    clampedPitch = Math.max(Math.abs(pitchDelta), 1.0F);
                } else {
                    clampedPitch /= 3.0F;
                }

                if (Math.abs(clampedYaw - this.lastYaw) <= 3.0F) {
                    clampedYaw = this.lastYaw + 3.1F;
                }

                yaw = this.rotateVector.x + (yawDelta > 0.0F ? clampedYaw : -clampedYaw);
                pitch = MathHelper.clamp(this.rotateVector.y + (pitchDelta > 0.0F ? clampedPitch : -clampedPitch), -89.0F, 89.0F);
                gcd = SensUtils.getGCDValue();
                yaw -= (yaw - this.rotateVector.x) % gcd;
                pitch -= (pitch - this.rotateVector.y) % gcd;
                this.rotateVector = new Vector2f(yaw, pitch);
                this.lastYaw = clampedYaw;
                this.lastPitch = clampedPitch;
                if ((Boolean)this.options.getValueByName("Коррекция движения").get()) {
                    var17 = mc;
                    Minecraft.player.rotationYawOffset = yaw;
                }
                break;
            case "Classic":
                clampedYaw = this.rotateVector.x + (float)roundedYaw;
                clampedPitch = MathHelper.clamp(this.rotateVector.y + pitchDelta, -90.0F, 90.0F);
                yaw = SensUtils.getGCDValue();
                clampedYaw -= (clampedYaw - this.rotateVector.x) % yaw;
                clampedPitch -= (clampedPitch - this.rotateVector.y) % yaw;
                this.rotateVector = new Vector2f(clampedYaw, clampedPitch);
                if ((Boolean)this.options.getValueByName("Коррекция движения").get()) {
                    var17 = mc;
                    Minecraft.player.rotationYawOffset = clampedYaw;
                }
        }

    }

    private void updateAttack() {
        if (!(Boolean)this.checkWallObstruction.get() || this.canSeeThroughWall(this.target)) {
            this.selected = MouseUtil.getMouseOver(this.target, this.rotateVector.x, this.rotateVector.y, (double)(Float)this.attackRange.get());
            if ((Boolean)this.options.getValueByName("Ускорять ротацию при атаке").get()) {
                this.updateRotation(true, 60.0F, 35.0F);
            }

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

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

            this.stopWatch.setLastMS(500L);
            var10001 = mc;
            mc.playerController.attackEntity(Minecraft.player, this.target);
            var10000 = mc;
            Minecraft.player.swingArm(Hand.MAIN_HAND);
            LivingEntity var2 = this.target;
            if (var2 instanceof PlayerEntity) {
                PlayerEntity player = (PlayerEntity)var2;
                if ((Boolean)this.options.getValueByName("Ломать щит").get()) {
                    this.breakShieldPlayer(player);
                }
            }

        }
    }

    private boolean canSeeThroughWall(Entity entity) {
        Minecraft var10000 = mc;
        ClientWorld var3 = Minecraft.world;
        Minecraft var10003 = mc;
        Vector3d var4 = Minecraft.player.getEyePosition(1.0F);
        Vector3d var10004 = entity.getEyePosition(1.0F);
        Minecraft var10007 = mc;
        RayTraceResult result = var3.rayTraceBlocks(new RayTraceContext(var4, var10004, BlockMode.COLLIDER, FluidMode.NONE, Minecraft.player));
        return result == null || result.getType() == Type.MISS;
    }

    private boolean shouldPlayerFalling() {
        Minecraft var10000;
        boolean var3;
        label46: {
            label45: {
                var10000 = mc;
                if (Minecraft.player.isInWater()) {
                    var10000 = mc;
                    if (Minecraft.player.areEyesInFluid(FluidTags.WATER)) {
                        break label45;
                    }
                }

                var10000 = mc;
                if (!Minecraft.player.isInLava()) {
                    var10000 = mc;
                    if (!Minecraft.player.isOnLadder()) {
                        var10000 = mc;
                        if (!Minecraft.player.isPassenger()) {
                            var10000 = mc;
                            if (!Minecraft.player.abilities.isFlying) {
                                var3 = false;
                                break label46;
                            }
                        }
                    }
                }
            }

            var3 = true;
        }

        boolean cancelReason = var3;
        var10000 = mc;
        float attackStrength = Minecraft.player.getCooledAttackStrength((Boolean)this.options.getValueByName("Синхронизировать атаку с ТПС").get() ? Expensive.getInstance().getTpsCalc().getAdjustTicks() : 1.5F);
        if (attackStrength < 0.92F) {
            return false;
        } else if (!cancelReason && (Boolean)this.options.getValueByName("Только криты").get()) {
            var10000 = mc;
            if (!Minecraft.player.isOnGround()) {
                var10000 = mc;
                if (Minecraft.player.fallDistance > 0.0F) {
                    var3 = true;
                    return var3;
                }
            }

            var3 = false;
            return var3;
        } else {
            return true;
        }
    }

    private boolean isValid(LivingEntity entity) {
        if (entity instanceof ClientPlayerEntity) {
            return false;
        } else if (entity.ticksExisted < 3) {
            return false;
        } else {
            Minecraft var10000 = mc;
            if (Minecraft.player.getDistanceEyePos(entity) > (double)(Float)this.attackRange.get()) {
                return false;
            } else {
                if (entity instanceof PlayerEntity) {
                    PlayerEntity p = (PlayerEntity)entity;
                    if (!(Boolean)this.targets.getValueByName("Друзья").get() && FriendStorage.isFriend(p.getName().getString())) {
                        return false;
                    }

                    String var3 = p.getName().getString();
                    Minecraft var10001 = mc;
                    if (var3.equalsIgnoreCase(Minecraft.player.getName().getString())) {
                        return false;
                    }
                }

                if (entity instanceof PlayerEntity && !(Boolean)this.targets.getValueByName("Игроки").get()) {
                    return false;
                } else if (entity instanceof PlayerEntity && entity.getTotalArmorValue() == 0 && !(Boolean)this.targets.getValueByName("Голые").get()) {
                    return false;
                } else if (entity instanceof PlayerEntity && entity.isInvisible() && entity.getTotalArmorValue() == 0 && !(Boolean)this.targets.getValueByName("Голые невидимки").get()) {
                    return false;
                } else if (entity instanceof PlayerEntity && entity.isInvisible() && !(Boolean)this.targets.getValueByName("Невидимки").get()) {
                    return false;
                } else if (entity instanceof MonsterEntity && !(Boolean)this.targets.getValueByName("Мобы").get()) {
                    return false;
                } else if (entity instanceof AnimalEntity && !(Boolean)this.targets.getValueByName("Животные").get()) {
                    return false;
                } else {
                    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);
            Minecraft var10000;
            Minecraft var10001;
            Minecraft var10003;
            if (hotBarSlot == -1 && invSlot != -1) {
                int bestSlot = InventoryUtil.getInstance().findBestSlotInHotBar();
                Minecraft var10005 = mc;
                mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, Minecraft.player);
                int var10002 = bestSlot + 36;
                var10005 = mc;
                mc.playerController.windowClick(0, var10002, 0, ClickType.PICKUP, Minecraft.player);
                var10000 = mc;
                Minecraft.player.connection.sendPacket(new CHeldItemChangePacket(bestSlot));
                var10001 = mc;
                mc.playerController.attackEntity(Minecraft.player, entity);
                var10000 = mc;
                Minecraft.player.swingArm(Hand.MAIN_HAND);
                var10000 = mc;
                var10003 = mc;
                Minecraft.player.connection.sendPacket(new CHeldItemChangePacket(Minecraft.player.inventory.currentItem));
                var10002 = bestSlot + 36;
                var10005 = mc;
                mc.playerController.windowClick(0, var10002, 0, ClickType.PICKUP, Minecraft.player);
                var10005 = mc;
                mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, Minecraft.player);
            }

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

    }

    private void reset() {
        if ((Boolean)this.options.getValueByName("Коррекция движения").get()) {
            Minecraft var10000 = mc;
            Minecraft.player.rotationYawOffset = -2.14748365E9F;
        }

        Minecraft var10003 = mc;
        Minecraft var10004 = mc;
        this.rotateVector = new Vector2f(Minecraft.player.rotationYaw, Minecraft.player.rotationPitch);
    }

    public void onEnable() {
        super.onEnable();
        this.reset();
        this.target = null;
    }

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

    private double getEntityArmor(PlayerEntity entityPlayer2) {
        double d2 = 0.0;

        for(int i2 = 0; i2 < 4; ++i2) {
            ItemStack is = (ItemStack)entityPlayer2.inventory.armorInventory.get(i2);
            if (is.getItem() instanceof ArmorItem) {
                d2 += this.getProtectionLvl(is);
            }
        }

        return d2;
    }

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

            return damageReduceAmount;
        } else {
            return 0.0;
        }
    }

    private double getEntityHealth(LivingEntity ent) {
        if (ent instanceof PlayerEntity player) {
            return (double)(player.getHealth() + player.getAbsorptionAmount()) * (this.getEntityArmor(player) / 20.0);
        } else {
            return (double)(ent.getHealth() + ent.getAbsorptionAmount());
        }
    }

    public ModeSetting getType() {
        return this.type;
    }

    public ModeListSetting getOptions() {
        return this.options;
    }

    public StopWatch getStopWatch() {
        return this.stopWatch;
    }

    public LivingEntity getTarget() {
        return this.target;
    }
}
Блять ты взял килку с эклипса 1.8 где нету обфы
 
Начинающий
Статус
Оффлайн
Регистрация
14 Дек 2022
Сообщения
22
Реакции[?]
1
Поинты[?]
1K
Мои любимые говно-пастеры держите высер с eclipsа под HW :roflanEbalo: :roflanBuldiga: 🍿
WOW you are a star like:
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

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.Setting;
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 java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
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.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.CHeldItemChangePacket;
import net.minecraft.tags.FluidTags;
import net.minecraft.util.Hand;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.RayTraceContext.BlockMode;
import net.minecraft.util.math.RayTraceContext.FluidMode;
import net.minecraft.util.math.RayTraceResult.Type;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;

@FunctionRegister(
        name = "KillAura",
        type = Category.Combat
)
public class KillAura extends Function {
    private final ModeSetting type = new ModeSetting("Тип", "Lite", new String[]{"Lite", "Classic", "Lite1", "Lite2"});
    private final SliderSetting attackRange = new SliderSetting("Дистанция аттаки", 3.0F, 3.0F, 6.0F, 0.1F);
    final ModeListSetting targets = new ModeListSetting("Таргеты", new BooleanSetting[]{new BooleanSetting("Игроки", true), new BooleanSetting("Голые", true), new BooleanSetting("Мобы", false), new BooleanSetting("Животные", false), new BooleanSetting("Друзья", false), new BooleanSetting("Голые невидимки", true), new BooleanSetting("Невидимки", true)});
    final ModeListSetting options = new ModeListSetting("Опции", new BooleanSetting[]{new BooleanSetting("Только криты", true), new BooleanSetting("Ломать щит", true), new BooleanSetting("Отжимать щит", true), new BooleanSetting("Ускорять ротацию при атаке", false), new BooleanSetting("Синхронизировать атаку с ТПС", false), new BooleanSetting("Фокусировать одну цель", true), new BooleanSetting("Коррекция движения", true)});
    final ModeSetting correctionType = new ModeSetting("Тип коррекции", "Сфокусированный", new String[]{"Сфокусированный", "Незаметный"});
    private final BooleanSetting checkWallObstruction = new BooleanSetting("не бить через стену", true);
    private final StopWatch stopWatch = new StopWatch();
    private Vector2f rotateVector = new Vector2f(0.0F, 0.0F);
    private LivingEntity target;
    private Entity selected;
    int ticks = 0;
    boolean isRotated;
    final AutoPotion autoPotion;
    float lastYaw;
    float lastPitch;

    public KillAura(AutoPotion autoPotion) {
        this.autoPotion = autoPotion;
        this.addSettings(new Setting[]{this.type, this.attackRange, this.targets, this.options, this.correctionType, this.checkWallObstruction});
    }

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

    }

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

        if (this.target != null && (!this.autoPotion.isState() || !this.autoPotion.isActive())) {
            this.isRotated = false;
            if (this.shouldPlayerFalling() && this.stopWatch.hasTimeElapsed()) {
                this.updateAttack();
                this.ticks = 2;
            }

            if (this.type.is("Classic")) {
                if (this.ticks > 0) {
                    this.updateRotation(true, 180.0F, 90.0F);
                    --this.ticks;
                } else {
                    this.reset();
                }
            } else if (!this.isRotated) {
                this.updateRotation(false, 80.0F, 35.0F);
            }
        } else {
            this.stopWatch.setLastMS(0L);
            this.reset();
        }

    }

    @Subscribe
    private void onWalking(EventMotion e) {
        if (this.target != null && (!this.autoPotion.isState() || !this.autoPotion.isActive())) {
            float yaw = this.rotateVector.x;
            float pitch = this.rotateVector.y;
            e.setYaw(yaw);
            e.setPitch(pitch);
            Minecraft var10000 = mc;
            Minecraft.player.rotationYawHead = yaw;
            var10000 = mc;
            Minecraft.player.renderYawOffset = yaw;
            var10000 = mc;
            Minecraft.player.rotationPitchHead = pitch;
        }
    }

    private void updateTarget() {
        List<LivingEntity> targets = new ArrayList();
        Minecraft var10000 = mc;
        Iterator var2 = Minecraft.world.getAllEntities().iterator();

        while(var2.hasNext()) {
            Entity entity = (Entity)var2.next();
            if (entity instanceof LivingEntity living) {
                if (this.isValid(living)) {
                    targets.add(living);
                }
            }
        }

        if (targets.isEmpty()) {
            this.target = null;
        } else if (targets.size() == 1) {
            this.target = (LivingEntity)targets.get(0);
        } else {
            targets.sort(Comparator.comparingDouble((object) -> {
                if (object instanceof PlayerEntity player) {
                    return -this.getEntityArmor(player);
                } else if (object instanceof LivingEntity base) {
                    return (double)(-base.getTotalArmorValue());
                } else {
                    return 0.0;
                }
            }).thenComparing((object, object2) -> {
                double d2 = this.getEntityHealth((LivingEntity)object);
                double d3 = this.getEntityHealth((LivingEntity)object2);
                return Double.compare(d2, d3);
            }).thenComparing((object, object2) -> {
                double d2 = (double)Minecraft.player.getDistance((LivingEntity)object);
                double d3 = (double)Minecraft.player.getDistance((LivingEntity)object2);
                return Double.compare(d2, d3);
            }));
            this.target = (LivingEntity)targets.get(0);
        }
    }

    private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
        Vector3d var10000 = this.target.getPositionVec().add(0.0, MathHelper.clamp(1.1, 0.3, (double)this.target.getHeight()), 0.0);
        Minecraft var10001 = mc;
        Vector3d vec = var10000.subtract(Minecraft.player.getEyePosition(1.0F));
        this.isRotated = true;
        float yawToTarget = (float)MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90.0);
        float pitchToTarget = (float)(-Math.toDegrees(Math.atan2(vec.y, Math.hypot(vec.x, vec.z))));
        float yawDelta = MathHelper.wrapDegrees(yawToTarget - this.rotateVector.x);
        float pitchDelta = MathHelper.wrapDegrees(pitchToTarget - this.rotateVector.y);
        int roundedYaw = (int)yawDelta;
        float clampedYaw;
        float clampedPitch;
        float yaw;
        float pitch;
        float gcd;
        Minecraft var17;
        switch ((String)this.type.get()) {
            case "Lite1":
                clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 0.2F), rotationYawSpeed * 0.5F);
                clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 0.2F), rotationPitchSpeed * 0.5F);
                if (attack && this.selected != this.target && (Boolean)this.options.getValueByName("Ускорять ротацию при атаке").get()) {
                    clampedPitch = Math.max(Math.abs(pitchDelta), 1.0F);
                } else {
                    clampedPitch /= 3.0F;
                }

                if (Math.abs(clampedYaw - this.lastYaw) <= 3.0F) {
                    clampedYaw = this.lastYaw + 3.1F;
                }

                yaw = this.rotateVector.x + ((double)yawDelta > 0.1 ? clampedYaw : -clampedYaw);
                pitch = MathHelper.clamp(this.rotateVector.y + ((double)pitchDelta > 0.1 ? clampedPitch : -clampedPitch), -89.0F, 89.0F);
                gcd = SensUtils.getGCDValue();
                yaw -= (yaw - this.rotateVector.x) % gcd;
                pitch -= (pitch - this.rotateVector.y) % gcd;
                this.rotateVector = new Vector2f(yaw, pitch);
                this.lastYaw = clampedYaw;
                this.lastPitch = clampedPitch;
                if ((Boolean)this.options.getValueByName("Коррекция движения").get()) {
                    var17 = mc;
                    Minecraft.player.rotationYawOffset = yaw;
                }
                break;
            case "Lite":
                clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 3.0F), rotationYawSpeed * 1.5F);
                clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 3.0F), rotationPitchSpeed * 1.5F);
                if (attack && this.selected != this.target && (Boolean)this.options.getValueByName("Ускорять ротацию при атаке").get()) {
                    clampedPitch = Math.max(Math.abs(pitchDelta), 1.0F);
                } else {
                    clampedPitch /= 3.0F;
                }

                if (Math.abs(clampedYaw - this.lastYaw) <= 3.0F) {
                    clampedYaw = this.lastYaw + 3.1F;
                }

                yaw = this.rotateVector.x + (yawDelta > 0.0F ? clampedYaw : -clampedYaw);
                pitch = MathHelper.clamp(this.rotateVector.y + (pitchDelta > 0.0F ? clampedPitch : -clampedPitch), -89.0F, 89.0F);
                gcd = SensUtils.getGCDValue();
                yaw -= (yaw - this.rotateVector.x) % gcd;
                pitch -= (pitch - this.rotateVector.y) % gcd;
                this.rotateVector = new Vector2f(yaw, pitch);
                this.lastYaw = clampedYaw;
                this.lastPitch = clampedPitch;
                if ((Boolean)this.options.getValueByName("Коррекция движения").get()) {
                    var17 = mc;
                    Minecraft.player.rotationYawOffset = yaw;
                }
                break;
            case "Lite2":
                clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 1.0F), rotationYawSpeed);
                clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 1.0F), rotationPitchSpeed);
                if (attack && this.selected != this.target && (Boolean)this.options.getValueByName("Ускорять ротацию при атаке").get()) {
                    clampedPitch = Math.max(Math.abs(pitchDelta), 1.0F);
                } else {
                    clampedPitch /= 3.0F;
                }

                if (Math.abs(clampedYaw - this.lastYaw) <= 3.0F) {
                    clampedYaw = this.lastYaw + 3.1F;
                }

                yaw = this.rotateVector.x + (yawDelta > 0.0F ? clampedYaw : -clampedYaw);
                pitch = MathHelper.clamp(this.rotateVector.y + (pitchDelta > 0.0F ? clampedPitch : -clampedPitch), -89.0F, 89.0F);
                gcd = SensUtils.getGCDValue();
                yaw -= (yaw - this.rotateVector.x) % gcd;
                pitch -= (pitch - this.rotateVector.y) % gcd;
                this.rotateVector = new Vector2f(yaw, pitch);
                this.lastYaw = clampedYaw;
                this.lastPitch = clampedPitch;
                if ((Boolean)this.options.getValueByName("Коррекция движения").get()) {
                    var17 = mc;
                    Minecraft.player.rotationYawOffset = yaw;
                }
                break;
            case "Classic":
                clampedYaw = this.rotateVector.x + (float)roundedYaw;
                clampedPitch = MathHelper.clamp(this.rotateVector.y + pitchDelta, -90.0F, 90.0F);
                yaw = SensUtils.getGCDValue();
                clampedYaw -= (clampedYaw - this.rotateVector.x) % yaw;
                clampedPitch -= (clampedPitch - this.rotateVector.y) % yaw;
                this.rotateVector = new Vector2f(clampedYaw, clampedPitch);
                if ((Boolean)this.options.getValueByName("Коррекция движения").get()) {
                    var17 = mc;
                    Minecraft.player.rotationYawOffset = clampedYaw;
                }
        }

    }

    private void updateAttack() {
        if (!(Boolean)this.checkWallObstruction.get() || this.canSeeThroughWall(this.target)) {
            this.selected = MouseUtil.getMouseOver(this.target, this.rotateVector.x, this.rotateVector.y, (double)(Float)this.attackRange.get());
            if ((Boolean)this.options.getValueByName("Ускорять ротацию при атаке").get()) {
                this.updateRotation(true, 60.0F, 35.0F);
            }

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

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

            this.stopWatch.setLastMS(500L);
            var10001 = mc;
            mc.playerController.attackEntity(Minecraft.player, this.target);
            var10000 = mc;
            Minecraft.player.swingArm(Hand.MAIN_HAND);
            LivingEntity var2 = this.target;
            if (var2 instanceof PlayerEntity) {
                PlayerEntity player = (PlayerEntity)var2;
                if ((Boolean)this.options.getValueByName("Ломать щит").get()) {
                    this.breakShieldPlayer(player);
                }
            }

        }
    }

    private boolean canSeeThroughWall(Entity entity) {
        Minecraft var10000 = mc;
        ClientWorld var3 = Minecraft.world;
        Minecraft var10003 = mc;
        Vector3d var4 = Minecraft.player.getEyePosition(1.0F);
        Vector3d var10004 = entity.getEyePosition(1.0F);
        Minecraft var10007 = mc;
        RayTraceResult result = var3.rayTraceBlocks(new RayTraceContext(var4, var10004, BlockMode.COLLIDER, FluidMode.NONE, Minecraft.player));
        return result == null || result.getType() == Type.MISS;
    }

    private boolean shouldPlayerFalling() {
        Minecraft var10000;
        boolean var3;
        label46: {
            label45: {
                var10000 = mc;
                if (Minecraft.player.isInWater()) {
                    var10000 = mc;
                    if (Minecraft.player.areEyesInFluid(FluidTags.WATER)) {
                        break label45;
                    }
                }

                var10000 = mc;
                if (!Minecraft.player.isInLava()) {
                    var10000 = mc;
                    if (!Minecraft.player.isOnLadder()) {
                        var10000 = mc;
                        if (!Minecraft.player.isPassenger()) {
                            var10000 = mc;
                            if (!Minecraft.player.abilities.isFlying) {
                                var3 = false;
                                break label46;
                            }
                        }
                    }
                }
            }

            var3 = true;
        }

        boolean cancelReason = var3;
        var10000 = mc;
        float attackStrength = Minecraft.player.getCooledAttackStrength((Boolean)this.options.getValueByName("Синхронизировать атаку с ТПС").get() ? Expensive.getInstance().getTpsCalc().getAdjustTicks() : 1.5F);
        if (attackStrength < 0.92F) {
            return false;
        } else if (!cancelReason && (Boolean)this.options.getValueByName("Только криты").get()) {
            var10000 = mc;
            if (!Minecraft.player.isOnGround()) {
                var10000 = mc;
                if (Minecraft.player.fallDistance > 0.0F) {
                    var3 = true;
                    return var3;
                }
            }

            var3 = false;
            return var3;
        } else {
            return true;
        }
    }

    private boolean isValid(LivingEntity entity) {
        if (entity instanceof ClientPlayerEntity) {
            return false;
        } else if (entity.ticksExisted < 3) {
            return false;
        } else {
            Minecraft var10000 = mc;
            if (Minecraft.player.getDistanceEyePos(entity) > (double)(Float)this.attackRange.get()) {
                return false;
            } else {
                if (entity instanceof PlayerEntity) {
                    PlayerEntity p = (PlayerEntity)entity;
                    if (!(Boolean)this.targets.getValueByName("Друзья").get() && FriendStorage.isFriend(p.getName().getString())) {
                        return false;
                    }

                    String var3 = p.getName().getString();
                    Minecraft var10001 = mc;
                    if (var3.equalsIgnoreCase(Minecraft.player.getName().getString())) {
                        return false;
                    }
                }

                if (entity instanceof PlayerEntity && !(Boolean)this.targets.getValueByName("Игроки").get()) {
                    return false;
                } else if (entity instanceof PlayerEntity && entity.getTotalArmorValue() == 0 && !(Boolean)this.targets.getValueByName("Голые").get()) {
                    return false;
                } else if (entity instanceof PlayerEntity && entity.isInvisible() && entity.getTotalArmorValue() == 0 && !(Boolean)this.targets.getValueByName("Голые невидимки").get()) {
                    return false;
                } else if (entity instanceof PlayerEntity && entity.isInvisible() && !(Boolean)this.targets.getValueByName("Невидимки").get()) {
                    return false;
                } else if (entity instanceof MonsterEntity && !(Boolean)this.targets.getValueByName("Мобы").get()) {
                    return false;
                } else if (entity instanceof AnimalEntity && !(Boolean)this.targets.getValueByName("Животные").get()) {
                    return false;
                } else {
                    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);
            Minecraft var10000;
            Minecraft var10001;
            Minecraft var10003;
            if (hotBarSlot == -1 && invSlot != -1) {
                int bestSlot = InventoryUtil.getInstance().findBestSlotInHotBar();
                Minecraft var10005 = mc;
                mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, Minecraft.player);
                int var10002 = bestSlot + 36;
                var10005 = mc;
                mc.playerController.windowClick(0, var10002, 0, ClickType.PICKUP, Minecraft.player);
                var10000 = mc;
                Minecraft.player.connection.sendPacket(new CHeldItemChangePacket(bestSlot));
                var10001 = mc;
                mc.playerController.attackEntity(Minecraft.player, entity);
                var10000 = mc;
                Minecraft.player.swingArm(Hand.MAIN_HAND);
                var10000 = mc;
                var10003 = mc;
                Minecraft.player.connection.sendPacket(new CHeldItemChangePacket(Minecraft.player.inventory.currentItem));
                var10002 = bestSlot + 36;
                var10005 = mc;
                mc.playerController.windowClick(0, var10002, 0, ClickType.PICKUP, Minecraft.player);
                var10005 = mc;
                mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, Minecraft.player);
            }

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

    }

    private void reset() {
        if ((Boolean)this.options.getValueByName("Коррекция движения").get()) {
            Minecraft var10000 = mc;
            Minecraft.player.rotationYawOffset = -2.14748365E9F;
        }

        Minecraft var10003 = mc;
        Minecraft var10004 = mc;
        this.rotateVector = new Vector2f(Minecraft.player.rotationYaw, Minecraft.player.rotationPitch);
    }

    public void onEnable() {
        super.onEnable();
        this.reset();
        this.target = null;
    }

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

    private double getEntityArmor(PlayerEntity entityPlayer2) {
        double d2 = 0.0;

        for(int i2 = 0; i2 < 4; ++i2) {
            ItemStack is = (ItemStack)entityPlayer2.inventory.armorInventory.get(i2);
            if (is.getItem() instanceof ArmorItem) {
                d2 += this.getProtectionLvl(is);
            }
        }

        return d2;
    }

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

            return damageReduceAmount;
        } else {
            return 0.0;
        }
    }

    private double getEntityHealth(LivingEntity ent) {
        if (ent instanceof PlayerEntity player) {
            return (double)(player.getHealth() + player.getAbsorptionAmount()) * (this.getEntityArmor(player) / 20.0);
        } else {
            return (double)(ent.getHealth() + ent.getAbsorptionAmount());
        }
    }

    public ModeSetting getType() {
        return this.type;
    }

    public ModeListSetting getOptions() {
        return this.options;
    }

    public StopWatch getStopWatch() {
        return this.stopWatch;
    }

    public LivingEntity getTarget() {
        return this.target;
    }
}
Это чудо хотя бы хвх сервера обходит ? Хаха
 
Забаненный
Статус
Оффлайн
Регистрация
10 Май 2023
Сообщения
827
Реакции[?]
9
Поинты[?]
3K
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Начинающий
Статус
Оффлайн
Регистрация
14 Май 2022
Сообщения
16
Реакции[?]
0
Поинты[?]
0
Мои любимые говно-пастеры держите высер с eclipsа под HW :roflanEbalo: :roflanBuldiga: 🍿
WOW you are a star like:
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

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.Setting;
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 java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
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.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.CHeldItemChangePacket;
import net.minecraft.tags.FluidTags;
import net.minecraft.util.Hand;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.RayTraceContext.BlockMode;
import net.minecraft.util.math.RayTraceContext.FluidMode;
import net.minecraft.util.math.RayTraceResult.Type;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;

@FunctionRegister(
        name = "KillAura",
        type = Category.Combat
)
public class KillAura extends Function {
    private final ModeSetting type = new ModeSetting("Тип", "Lite", new String[]{"Lite", "Classic", "Lite1", "Lite2"});
    private final SliderSetting attackRange = new SliderSetting("Дистанция аттаки", 3.0F, 3.0F, 6.0F, 0.1F);
    final ModeListSetting targets = new ModeListSetting("Таргеты", new BooleanSetting[]{new BooleanSetting("Игроки", true), new BooleanSetting("Голые", true), new BooleanSetting("Мобы", false), new BooleanSetting("Животные", false), new BooleanSetting("Друзья", false), new BooleanSetting("Голые невидимки", true), new BooleanSetting("Невидимки", true)});
    final ModeListSetting options = new ModeListSetting("Опции", new BooleanSetting[]{new BooleanSetting("Только криты", true), new BooleanSetting("Ломать щит", true), new BooleanSetting("Отжимать щит", true), new BooleanSetting("Ускорять ротацию при атаке", false), new BooleanSetting("Синхронизировать атаку с ТПС", false), new BooleanSetting("Фокусировать одну цель", true), new BooleanSetting("Коррекция движения", true)});
    final ModeSetting correctionType = new ModeSetting("Тип коррекции", "Сфокусированный", new String[]{"Сфокусированный", "Незаметный"});
    private final BooleanSetting checkWallObstruction = new BooleanSetting("не бить через стену", true);
    private final StopWatch stopWatch = new StopWatch();
    private Vector2f rotateVector = new Vector2f(0.0F, 0.0F);
    private LivingEntity target;
    private Entity selected;
    int ticks = 0;
    boolean isRotated;
    final AutoPotion autoPotion;
    float lastYaw;
    float lastPitch;

    public KillAura(AutoPotion autoPotion) {
        this.autoPotion = autoPotion;
        this.addSettings(new Setting[]{this.type, this.attackRange, this.targets, this.options, this.correctionType, this.checkWallObstruction});
    }

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

    }

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

        if (this.target != null && (!this.autoPotion.isState() || !this.autoPotion.isActive())) {
            this.isRotated = false;
            if (this.shouldPlayerFalling() && this.stopWatch.hasTimeElapsed()) {
                this.updateAttack();
                this.ticks = 2;
            }

            if (this.type.is("Classic")) {
                if (this.ticks > 0) {
                    this.updateRotation(true, 180.0F, 90.0F);
                    --this.ticks;
                } else {
                    this.reset();
                }
            } else if (!this.isRotated) {
                this.updateRotation(false, 80.0F, 35.0F);
            }
        } else {
            this.stopWatch.setLastMS(0L);
            this.reset();
        }

    }

    @Subscribe
    private void onWalking(EventMotion e) {
        if (this.target != null && (!this.autoPotion.isState() || !this.autoPotion.isActive())) {
            float yaw = this.rotateVector.x;
            float pitch = this.rotateVector.y;
            e.setYaw(yaw);
            e.setPitch(pitch);
            Minecraft var10000 = mc;
            Minecraft.player.rotationYawHead = yaw;
            var10000 = mc;
            Minecraft.player.renderYawOffset = yaw;
            var10000 = mc;
            Minecraft.player.rotationPitchHead = pitch;
        }
    }

    private void updateTarget() {
        List<LivingEntity> targets = new ArrayList();
        Minecraft var10000 = mc;
        Iterator var2 = Minecraft.world.getAllEntities().iterator();

        while(var2.hasNext()) {
            Entity entity = (Entity)var2.next();
            if (entity instanceof LivingEntity living) {
                if (this.isValid(living)) {
                    targets.add(living);
                }
            }
        }

        if (targets.isEmpty()) {
            this.target = null;
        } else if (targets.size() == 1) {
            this.target = (LivingEntity)targets.get(0);
        } else {
            targets.sort(Comparator.comparingDouble((object) -> {
                if (object instanceof PlayerEntity player) {
                    return -this.getEntityArmor(player);
                } else if (object instanceof LivingEntity base) {
                    return (double)(-base.getTotalArmorValue());
                } else {
                    return 0.0;
                }
            }).thenComparing((object, object2) -> {
                double d2 = this.getEntityHealth((LivingEntity)object);
                double d3 = this.getEntityHealth((LivingEntity)object2);
                return Double.compare(d2, d3);
            }).thenComparing((object, object2) -> {
                double d2 = (double)Minecraft.player.getDistance((LivingEntity)object);
                double d3 = (double)Minecraft.player.getDistance((LivingEntity)object2);
                return Double.compare(d2, d3);
            }));
            this.target = (LivingEntity)targets.get(0);
        }
    }

    private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
        Vector3d var10000 = this.target.getPositionVec().add(0.0, MathHelper.clamp(1.1, 0.3, (double)this.target.getHeight()), 0.0);
        Minecraft var10001 = mc;
        Vector3d vec = var10000.subtract(Minecraft.player.getEyePosition(1.0F));
        this.isRotated = true;
        float yawToTarget = (float)MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90.0);
        float pitchToTarget = (float)(-Math.toDegrees(Math.atan2(vec.y, Math.hypot(vec.x, vec.z))));
        float yawDelta = MathHelper.wrapDegrees(yawToTarget - this.rotateVector.x);
        float pitchDelta = MathHelper.wrapDegrees(pitchToTarget - this.rotateVector.y);
        int roundedYaw = (int)yawDelta;
        float clampedYaw;
        float clampedPitch;
        float yaw;
        float pitch;
        float gcd;
        Minecraft var17;
        switch ((String)this.type.get()) {
            case "Lite1":
                clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 0.2F), rotationYawSpeed * 0.5F);
                clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 0.2F), rotationPitchSpeed * 0.5F);
                if (attack && this.selected != this.target && (Boolean)this.options.getValueByName("Ускорять ротацию при атаке").get()) {
                    clampedPitch = Math.max(Math.abs(pitchDelta), 1.0F);
                } else {
                    clampedPitch /= 3.0F;
                }

                if (Math.abs(clampedYaw - this.lastYaw) <= 3.0F) {
                    clampedYaw = this.lastYaw + 3.1F;
                }

                yaw = this.rotateVector.x + ((double)yawDelta > 0.1 ? clampedYaw : -clampedYaw);
                pitch = MathHelper.clamp(this.rotateVector.y + ((double)pitchDelta > 0.1 ? clampedPitch : -clampedPitch), -89.0F, 89.0F);
                gcd = SensUtils.getGCDValue();
                yaw -= (yaw - this.rotateVector.x) % gcd;
                pitch -= (pitch - this.rotateVector.y) % gcd;
                this.rotateVector = new Vector2f(yaw, pitch);
                this.lastYaw = clampedYaw;
                this.lastPitch = clampedPitch;
                if ((Boolean)this.options.getValueByName("Коррекция движения").get()) {
                    var17 = mc;
                    Minecraft.player.rotationYawOffset = yaw;
                }
                break;
            case "Lite":
                clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 3.0F), rotationYawSpeed * 1.5F);
                clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 3.0F), rotationPitchSpeed * 1.5F);
                if (attack && this.selected != this.target && (Boolean)this.options.getValueByName("Ускорять ротацию при атаке").get()) {
                    clampedPitch = Math.max(Math.abs(pitchDelta), 1.0F);
                } else {
                    clampedPitch /= 3.0F;
                }

                if (Math.abs(clampedYaw - this.lastYaw) <= 3.0F) {
                    clampedYaw = this.lastYaw + 3.1F;
                }

                yaw = this.rotateVector.x + (yawDelta > 0.0F ? clampedYaw : -clampedYaw);
                pitch = MathHelper.clamp(this.rotateVector.y + (pitchDelta > 0.0F ? clampedPitch : -clampedPitch), -89.0F, 89.0F);
                gcd = SensUtils.getGCDValue();
                yaw -= (yaw - this.rotateVector.x) % gcd;
                pitch -= (pitch - this.rotateVector.y) % gcd;
                this.rotateVector = new Vector2f(yaw, pitch);
                this.lastYaw = clampedYaw;
                this.lastPitch = clampedPitch;
                if ((Boolean)this.options.getValueByName("Коррекция движения").get()) {
                    var17 = mc;
                    Minecraft.player.rotationYawOffset = yaw;
                }
                break;
            case "Lite2":
                clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 1.0F), rotationYawSpeed);
                clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 1.0F), rotationPitchSpeed);
                if (attack && this.selected != this.target && (Boolean)this.options.getValueByName("Ускорять ротацию при атаке").get()) {
                    clampedPitch = Math.max(Math.abs(pitchDelta), 1.0F);
                } else {
                    clampedPitch /= 3.0F;
                }

                if (Math.abs(clampedYaw - this.lastYaw) <= 3.0F) {
                    clampedYaw = this.lastYaw + 3.1F;
                }

                yaw = this.rotateVector.x + (yawDelta > 0.0F ? clampedYaw : -clampedYaw);
                pitch = MathHelper.clamp(this.rotateVector.y + (pitchDelta > 0.0F ? clampedPitch : -clampedPitch), -89.0F, 89.0F);
                gcd = SensUtils.getGCDValue();
                yaw -= (yaw - this.rotateVector.x) % gcd;
                pitch -= (pitch - this.rotateVector.y) % gcd;
                this.rotateVector = new Vector2f(yaw, pitch);
                this.lastYaw = clampedYaw;
                this.lastPitch = clampedPitch;
                if ((Boolean)this.options.getValueByName("Коррекция движения").get()) {
                    var17 = mc;
                    Minecraft.player.rotationYawOffset = yaw;
                }
                break;
            case "Classic":
                clampedYaw = this.rotateVector.x + (float)roundedYaw;
                clampedPitch = MathHelper.clamp(this.rotateVector.y + pitchDelta, -90.0F, 90.0F);
                yaw = SensUtils.getGCDValue();
                clampedYaw -= (clampedYaw - this.rotateVector.x) % yaw;
                clampedPitch -= (clampedPitch - this.rotateVector.y) % yaw;
                this.rotateVector = new Vector2f(clampedYaw, clampedPitch);
                if ((Boolean)this.options.getValueByName("Коррекция движения").get()) {
                    var17 = mc;
                    Minecraft.player.rotationYawOffset = clampedYaw;
                }
        }

    }

    private void updateAttack() {
        if (!(Boolean)this.checkWallObstruction.get() || this.canSeeThroughWall(this.target)) {
            this.selected = MouseUtil.getMouseOver(this.target, this.rotateVector.x, this.rotateVector.y, (double)(Float)this.attackRange.get());
            if ((Boolean)this.options.getValueByName("Ускорять ротацию при атаке").get()) {
                this.updateRotation(true, 60.0F, 35.0F);
            }

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

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

            this.stopWatch.setLastMS(500L);
            var10001 = mc;
            mc.playerController.attackEntity(Minecraft.player, this.target);
            var10000 = mc;
            Minecraft.player.swingArm(Hand.MAIN_HAND);
            LivingEntity var2 = this.target;
            if (var2 instanceof PlayerEntity) {
                PlayerEntity player = (PlayerEntity)var2;
                if ((Boolean)this.options.getValueByName("Ломать щит").get()) {
                    this.breakShieldPlayer(player);
                }
            }

        }
    }

    private boolean canSeeThroughWall(Entity entity) {
        Minecraft var10000 = mc;
        ClientWorld var3 = Minecraft.world;
        Minecraft var10003 = mc;
        Vector3d var4 = Minecraft.player.getEyePosition(1.0F);
        Vector3d var10004 = entity.getEyePosition(1.0F);
        Minecraft var10007 = mc;
        RayTraceResult result = var3.rayTraceBlocks(new RayTraceContext(var4, var10004, BlockMode.COLLIDER, FluidMode.NONE, Minecraft.player));
        return result == null || result.getType() == Type.MISS;
    }

    private boolean shouldPlayerFalling() {
        Minecraft var10000;
        boolean var3;
        label46: {
            label45: {
                var10000 = mc;
                if (Minecraft.player.isInWater()) {
                    var10000 = mc;
                    if (Minecraft.player.areEyesInFluid(FluidTags.WATER)) {
                        break label45;
                    }
                }

                var10000 = mc;
                if (!Minecraft.player.isInLava()) {
                    var10000 = mc;
                    if (!Minecraft.player.isOnLadder()) {
                        var10000 = mc;
                        if (!Minecraft.player.isPassenger()) {
                            var10000 = mc;
                            if (!Minecraft.player.abilities.isFlying) {
                                var3 = false;
                                break label46;
                            }
                        }
                    }
                }
            }

            var3 = true;
        }

        boolean cancelReason = var3;
        var10000 = mc;
        float attackStrength = Minecraft.player.getCooledAttackStrength((Boolean)this.options.getValueByName("Синхронизировать атаку с ТПС").get() ? Expensive.getInstance().getTpsCalc().getAdjustTicks() : 1.5F);
        if (attackStrength < 0.92F) {
            return false;
        } else if (!cancelReason && (Boolean)this.options.getValueByName("Только криты").get()) {
            var10000 = mc;
            if (!Minecraft.player.isOnGround()) {
                var10000 = mc;
                if (Minecraft.player.fallDistance > 0.0F) {
                    var3 = true;
                    return var3;
                }
            }

            var3 = false;
            return var3;
        } else {
            return true;
        }
    }

    private boolean isValid(LivingEntity entity) {
        if (entity instanceof ClientPlayerEntity) {
            return false;
        } else if (entity.ticksExisted < 3) {
            return false;
        } else {
            Minecraft var10000 = mc;
            if (Minecraft.player.getDistanceEyePos(entity) > (double)(Float)this.attackRange.get()) {
                return false;
            } else {
                if (entity instanceof PlayerEntity) {
                    PlayerEntity p = (PlayerEntity)entity;
                    if (!(Boolean)this.targets.getValueByName("Друзья").get() && FriendStorage.isFriend(p.getName().getString())) {
                        return false;
                    }

                    String var3 = p.getName().getString();
                    Minecraft var10001 = mc;
                    if (var3.equalsIgnoreCase(Minecraft.player.getName().getString())) {
                        return false;
                    }
                }

                if (entity instanceof PlayerEntity && !(Boolean)this.targets.getValueByName("Игроки").get()) {
                    return false;
                } else if (entity instanceof PlayerEntity && entity.getTotalArmorValue() == 0 && !(Boolean)this.targets.getValueByName("Голые").get()) {
                    return false;
                } else if (entity instanceof PlayerEntity && entity.isInvisible() && entity.getTotalArmorValue() == 0 && !(Boolean)this.targets.getValueByName("Голые невидимки").get()) {
                    return false;
                } else if (entity instanceof PlayerEntity && entity.isInvisible() && !(Boolean)this.targets.getValueByName("Невидимки").get()) {
                    return false;
                } else if (entity instanceof MonsterEntity && !(Boolean)this.targets.getValueByName("Мобы").get()) {
                    return false;
                } else if (entity instanceof AnimalEntity && !(Boolean)this.targets.getValueByName("Животные").get()) {
                    return false;
                } else {
                    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);
            Minecraft var10000;
            Minecraft var10001;
            Minecraft var10003;
            if (hotBarSlot == -1 && invSlot != -1) {
                int bestSlot = InventoryUtil.getInstance().findBestSlotInHotBar();
                Minecraft var10005 = mc;
                mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, Minecraft.player);
                int var10002 = bestSlot + 36;
                var10005 = mc;
                mc.playerController.windowClick(0, var10002, 0, ClickType.PICKUP, Minecraft.player);
                var10000 = mc;
                Minecraft.player.connection.sendPacket(new CHeldItemChangePacket(bestSlot));
                var10001 = mc;
                mc.playerController.attackEntity(Minecraft.player, entity);
                var10000 = mc;
                Minecraft.player.swingArm(Hand.MAIN_HAND);
                var10000 = mc;
                var10003 = mc;
                Minecraft.player.connection.sendPacket(new CHeldItemChangePacket(Minecraft.player.inventory.currentItem));
                var10002 = bestSlot + 36;
                var10005 = mc;
                mc.playerController.windowClick(0, var10002, 0, ClickType.PICKUP, Minecraft.player);
                var10005 = mc;
                mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, Minecraft.player);
            }

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

    }

    private void reset() {
        if ((Boolean)this.options.getValueByName("Коррекция движения").get()) {
            Minecraft var10000 = mc;
            Minecraft.player.rotationYawOffset = -2.14748365E9F;
        }

        Minecraft var10003 = mc;
        Minecraft var10004 = mc;
        this.rotateVector = new Vector2f(Minecraft.player.rotationYaw, Minecraft.player.rotationPitch);
    }

    public void onEnable() {
        super.onEnable();
        this.reset();
        this.target = null;
    }

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

    private double getEntityArmor(PlayerEntity entityPlayer2) {
        double d2 = 0.0;

        for(int i2 = 0; i2 < 4; ++i2) {
            ItemStack is = (ItemStack)entityPlayer2.inventory.armorInventory.get(i2);
            if (is.getItem() instanceof ArmorItem) {
                d2 += this.getProtectionLvl(is);
            }
        }

        return d2;
    }

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

            return damageReduceAmount;
        } else {
            return 0.0;
        }
    }

    private double getEntityHealth(LivingEntity ent) {
        if (ent instanceof PlayerEntity player) {
            return (double)(player.getHealth() + player.getAbsorptionAmount()) * (this.getEntityArmor(player) / 20.0);
        } else {
            return (double)(ent.getHealth() + ent.getAbsorptionAmount());
        }
    }

    public ModeSetting getType() {
        return this.type;
    }

    public ModeListSetting getOptions() {
        return this.options;
    }

    public StopWatch getStopWatch() {
        return this.stopWatch;
    }

    public LivingEntity getTarget() {
        return this.target;
    }
}
Ты сливаешь это в августе
Слил бы, котябы, ласт версию килки.
 
Сверху Снизу