Сливаю вам килку под funtime expensive 3.0

Начинающий
Статус
Оффлайн
Регистрация
29 Июн 2023
Сообщения
175
Реакции[?]
0
Поинты[?]
4K
изначальный код килки взята с вериста но по полной переписаная
Код:
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.impl.combat.AntiBot;
import im.expensive.functions.impl.combat.AutoPotion;
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 net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.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.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;

@FunctionRegister(name="NewAura", type=Category.Combat)
public class KillAura extends Function {
    private final ModeSetting type = new ModeSetting("Тип", "Плавная", "Плавная", "Резкая");
    private final SliderSetting attackRange = new SliderSetting("Дистанция атаки", 3.0f, 3.0f, 6.0f, 0.1f);
    final ModeListSetting targets = new ModeListSetting("Цели", new BooleanSetting("Игроки", true), new BooleanSetting("Голые", true), new BooleanSetting("Мобы", false), new BooleanSetting("Животные", false), new BooleanSetting("Друзья", false), new BooleanSetting("Голые невидимки", true), new BooleanSetting("Невидимки", true));
    final BooleanSetting correctionType = new BooleanSetting("Незаметная", true);
    final BooleanSetting correctionType7 = new BooleanSetting("Только криты", true);
    final BooleanSetting correctionType6 = new BooleanSetting("Ломать щит", true);
    final BooleanSetting correctionType5 = new BooleanSetting("Отжимать щит", true);
    final BooleanSetting correctionType4 = new BooleanSetting("Ускорять атаку", false);
    final BooleanSetting correctionType3 = new BooleanSetting("Атака с ТПС", false);
    final BooleanSetting correctionType2 = new BooleanSetting("Одна цель", true);
    final BooleanSetting correctionType1 = 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(this.type, this.attackRange, this.targets, this.correctionType, this.correctionType1, this.correctionType2, this.correctionType3, this.correctionType4, this.correctionType5, this.correctionType6, this.correctionType7);
    }

    @Subscribe
    public void onInput(EventInput eventInput) {
        if (((Boolean)this.correctionType1.get()).booleanValue() && ((Boolean)this.correctionType.get()).booleanValue() && this.target != null && KillAura.mc.player != null) {
            MoveUtils.fixMovement(eventInput, this.rotateVector.x);
        }
    }

    @Subscribe
    public void onUpdate(EventUpdate e) {
        if (((Boolean)this.correctionType2.get()).booleanValue() && (this.target == null || !this.isValid(this.target)) || ((Boolean)this.correctionType2.get()).booleanValue()) {
            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 = 0;
            }
            if (this.type.is("Резкая")) {
                if (this.ticks > 0) {
                    this.updateRotation(true, 360.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()) {
            return;
        }
        float yaw = this.rotateVector.x;
        float pitch = this.rotateVector.y;
        e.setYaw(yaw);
        e.setPitch(pitch);
        KillAura.mc.player.rotationYawHead = yaw;
        KillAura.mc.player.renderYawOffset = yaw;
        KillAura.mc.player.rotationPitchHead = pitch;
    }

    private void updateTarget() {
        ArrayList<Object> targets = new ArrayList<Object>();
        for (Entity entity2 : KillAura.mc.world.getAllEntities()) {
            LivingEntity living;
            if (!(entity2 instanceof LivingEntity) || !this.isValid(living = (LivingEntity)entity2)) continue;
            targets.add(living);
        }
        if (targets.isEmpty()) {
            this.target = null;
            return;
        }
        if (targets.size() == 1) {
            this.target = (LivingEntity)targets.get(0);
            return;
        }
        targets.sort(Comparator.comparingDouble(object -> {
            if (object instanceof PlayerEntity) {
                PlayerEntity player = (PlayerEntity)object;
                return -this.getEntityArmor(player);
            }
            if (object instanceof LivingEntity) {
                LivingEntity base = (LivingEntity)object;
                return -base.getTotalArmorValue();
            }
            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 = KillAura.mc.player.getDistance((LivingEntity)object);
            double d3 = KillAura.mc.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 vec = this.target.getPositionVec().add(0.0, MathHelper.clamp(KillAura.mc.player.getPosYEye() - this.target.getPosY(), 0.0, (double)this.target.getHeight() * (KillAura.mc.player.getDistanceEyePos(this.target) / (double)((Float)this.attackRange.get()).floatValue())), 0.0).subtract(KillAura.mc.player.getEyePosition(0.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;
        switch ((String)this.type.get()) {
            case "Плавная": {
                float clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 2.0f), rotationYawSpeed);
                float clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 2.0f), rotationPitchSpeed);
                clampedPitch = attack && this.selected != this.target && ((Boolean)this.correctionType4.get()).booleanValue() ? Math.max(Math.abs(pitchDelta), 1.0f) : (clampedPitch /= 5.0f);
                if (Math.abs(clampedYaw - this.lastYaw) <= 5.0f) {
                    clampedYaw = this.lastYaw;
                }
                if (Math.abs(clampedPitch - this.lastPitch) <= 5.0f) {
                    clampedPitch = this.lastPitch;
                }
                this.rotateVector = new Vector2f(this.rotateVector.x + clampedYaw, this.rotateVector.y + clampedPitch);
                break;
            }
            case "Резкая": {
                this.rotateVector = new Vector2f(yawToTarget, pitchToTarget);
                break;
            }
        }
        this.lastYaw = this.rotateVector.x;
        this.lastPitch = this.rotateVector.y;
    }

    private void reset() {
        this.rotateVector = new Vector2f(KillAura.mc.player.rotationYaw, KillAura.mc.player.rotationPitch);
        this.target = null;
    }

    private boolean isValid(LivingEntity entity) {
        if (entity == null) {
            return false;
        }
        if (entity.equals(KillAura.mc.player)) {
            return false;
        }
        if (entity.isDead || entity.getHealth() <= 0.0f) {
            return false;
        }
        if (!this.targets.is("Все") && !this.targets.is("Игроки") && entity instanceof PlayerEntity) {
            return false;
        }
        if (!this.targets.is("Голые") && entity instanceof ArmorStandEntity) {
            return false;
        }
        if (!this.targets.is("Мобы") && entity instanceof MonsterEntity) {
            return false;
        }
        if (!this.targets.is("Животные") && entity instanceof AnimalEntity) {
            return false;
        }
        if (!this.targets.is("Друзья") && FriendStorage.isFriend(entity.getName().getString())) {
            return false;
        }
        if (!this.targets.is("Голые невидимки") && entity.isInvisible()) {
            return false;
        }
        return this.targets.is("Невидимки") || !entity.isInvisible();
    }

    private double getEntityHealth(LivingEntity entity) {
        return entity.getHealth() + entity.getAbsorptionAmount();
    }

    private double getEntityArmor(PlayerEntity entity) {
        double d = 0.0;
        for (ItemStack itemStack : entity.getArmorInventoryList()) {
            Item item = itemStack.getItem();
            if (!(item instanceof ArmorItem)) continue;
            ArmorItem armorItem = (ArmorItem)item;
            d += (double)armorItem.getArmorMaterial().getDamageReductionAmount() + (double)EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, itemStack);
        }
        return d;
    }

    private boolean shouldPlayerFalling() {
        ClientPlayerEntity player = KillAura.mc.player;
        return player != null && player.isFallFlying();
    }

    private void updateAttack() {
        if (this.target == null) {
            return;
        }
        double attackRange = (Double)this.attackRange.get();
        if (KillAura.mc.player.getDistance(this.target) > attackRange) {
            return;
        }
        if (this.selected == null || this.selected != this.target) {
            this.selected = this.target;
            if (this.selected instanceof PlayerEntity) {
                KillAura.mc.player.connection.sendPacket(new CHeldItemChangePacket(KillAura.mc.player.inventory.currentItem));
            }
        }
        KillAura.mc.playerController.attackEntity(KillAura.mc.player, this.target);
        KillAura.mc.player.swingArm(Hand.MAIN_HAND);
    }
}
 
Начинающий
Статус
Оффлайн
Регистрация
15 Июл 2024
Сообщения
43
Реакции[?]
0
Поинты[?]
1K
изначальный код килки взята с вериста но по полной переписаная
Код:
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.impl.combat.AntiBot;
import im.expensive.functions.impl.combat.AutoPotion;
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 net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.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.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;

@FunctionRegister(name="NewAura", type=Category.Combat)
public class KillAura extends Function {
    private final ModeSetting type = new ModeSetting("Тип", "Плавная", "Плавная", "Резкая");
    private final SliderSetting attackRange = new SliderSetting("Дистанция атаки", 3.0f, 3.0f, 6.0f, 0.1f);
    final ModeListSetting targets = new ModeListSetting("Цели", new BooleanSetting("Игроки", true), new BooleanSetting("Голые", true), new BooleanSetting("Мобы", false), new BooleanSetting("Животные", false), new BooleanSetting("Друзья", false), new BooleanSetting("Голые невидимки", true), new BooleanSetting("Невидимки", true));
    final BooleanSetting correctionType = new BooleanSetting("Незаметная", true);
    final BooleanSetting correctionType7 = new BooleanSetting("Только криты", true);
    final BooleanSetting correctionType6 = new BooleanSetting("Ломать щит", true);
    final BooleanSetting correctionType5 = new BooleanSetting("Отжимать щит", true);
    final BooleanSetting correctionType4 = new BooleanSetting("Ускорять атаку", false);
    final BooleanSetting correctionType3 = new BooleanSetting("Атака с ТПС", false);
    final BooleanSetting correctionType2 = new BooleanSetting("Одна цель", true);
    final BooleanSetting correctionType1 = 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(this.type, this.attackRange, this.targets, this.correctionType, this.correctionType1, this.correctionType2, this.correctionType3, this.correctionType4, this.correctionType5, this.correctionType6, this.correctionType7);
    }

    @Subscribe
    public void onInput(EventInput eventInput) {
        if (((Boolean)this.correctionType1.get()).booleanValue() && ((Boolean)this.correctionType.get()).booleanValue() && this.target != null && KillAura.mc.player != null) {
            MoveUtils.fixMovement(eventInput, this.rotateVector.x);
        }
    }

    @Subscribe
    public void onUpdate(EventUpdate e) {
        if (((Boolean)this.correctionType2.get()).booleanValue() && (this.target == null || !this.isValid(this.target)) || ((Boolean)this.correctionType2.get()).booleanValue()) {
            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 = 0;
            }
            if (this.type.is("Резкая")) {
                if (this.ticks > 0) {
                    this.updateRotation(true, 360.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()) {
            return;
        }
        float yaw = this.rotateVector.x;
        float pitch = this.rotateVector.y;
        e.setYaw(yaw);
        e.setPitch(pitch);
        KillAura.mc.player.rotationYawHead = yaw;
        KillAura.mc.player.renderYawOffset = yaw;
        KillAura.mc.player.rotationPitchHead = pitch;
    }

    private void updateTarget() {
        ArrayList<Object> targets = new ArrayList<Object>();
        for (Entity entity2 : KillAura.mc.world.getAllEntities()) {
            LivingEntity living;
            if (!(entity2 instanceof LivingEntity) || !this.isValid(living = (LivingEntity)entity2)) continue;
            targets.add(living);
        }
        if (targets.isEmpty()) {
            this.target = null;
            return;
        }
        if (targets.size() == 1) {
            this.target = (LivingEntity)targets.get(0);
            return;
        }
        targets.sort(Comparator.comparingDouble(object -> {
            if (object instanceof PlayerEntity) {
                PlayerEntity player = (PlayerEntity)object;
                return -this.getEntityArmor(player);
            }
            if (object instanceof LivingEntity) {
                LivingEntity base = (LivingEntity)object;
                return -base.getTotalArmorValue();
            }
            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 = KillAura.mc.player.getDistance((LivingEntity)object);
            double d3 = KillAura.mc.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 vec = this.target.getPositionVec().add(0.0, MathHelper.clamp(KillAura.mc.player.getPosYEye() - this.target.getPosY(), 0.0, (double)this.target.getHeight() * (KillAura.mc.player.getDistanceEyePos(this.target) / (double)((Float)this.attackRange.get()).floatValue())), 0.0).subtract(KillAura.mc.player.getEyePosition(0.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;
        switch ((String)this.type.get()) {
            case "Плавная": {
                float clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 2.0f), rotationYawSpeed);
                float clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 2.0f), rotationPitchSpeed);
                clampedPitch = attack && this.selected != this.target && ((Boolean)this.correctionType4.get()).booleanValue() ? Math.max(Math.abs(pitchDelta), 1.0f) : (clampedPitch /= 5.0f);
                if (Math.abs(clampedYaw - this.lastYaw) <= 5.0f) {
                    clampedYaw = this.lastYaw;
                }
                if (Math.abs(clampedPitch - this.lastPitch) <= 5.0f) {
                    clampedPitch = this.lastPitch;
                }
                this.rotateVector = new Vector2f(this.rotateVector.x + clampedYaw, this.rotateVector.y + clampedPitch);
                break;
            }
            case "Резкая": {
                this.rotateVector = new Vector2f(yawToTarget, pitchToTarget);
                break;
            }
        }
        this.lastYaw = this.rotateVector.x;
        this.lastPitch = this.rotateVector.y;
    }

    private void reset() {
        this.rotateVector = new Vector2f(KillAura.mc.player.rotationYaw, KillAura.mc.player.rotationPitch);
        this.target = null;
    }

    private boolean isValid(LivingEntity entity) {
        if (entity == null) {
            return false;
        }
        if (entity.equals(KillAura.mc.player)) {
            return false;
        }
        if (entity.isDead || entity.getHealth() <= 0.0f) {
            return false;
        }
        if (!this.targets.is("Все") && !this.targets.is("Игроки") && entity instanceof PlayerEntity) {
            return false;
        }
        if (!this.targets.is("Голые") && entity instanceof ArmorStandEntity) {
            return false;
        }
        if (!this.targets.is("Мобы") && entity instanceof MonsterEntity) {
            return false;
        }
        if (!this.targets.is("Животные") && entity instanceof AnimalEntity) {
            return false;
        }
        if (!this.targets.is("Друзья") && FriendStorage.isFriend(entity.getName().getString())) {
            return false;
        }
        if (!this.targets.is("Голые невидимки") && entity.isInvisible()) {
            return false;
        }
        return this.targets.is("Невидимки") || !entity.isInvisible();
    }

    private double getEntityHealth(LivingEntity entity) {
        return entity.getHealth() + entity.getAbsorptionAmount();
    }

    private double getEntityArmor(PlayerEntity entity) {
        double d = 0.0;
        for (ItemStack itemStack : entity.getArmorInventoryList()) {
            Item item = itemStack.getItem();
            if (!(item instanceof ArmorItem)) continue;
            ArmorItem armorItem = (ArmorItem)item;
            d += (double)armorItem.getArmorMaterial().getDamageReductionAmount() + (double)EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, itemStack);
        }
        return d;
    }

    private boolean shouldPlayerFalling() {
        ClientPlayerEntity player = KillAura.mc.player;
        return player != null && player.isFallFlying();
    }

    private void updateAttack() {
        if (this.target == null) {
            return;
        }
        double attackRange = (Double)this.attackRange.get();
        if (KillAura.mc.player.getDistance(this.target) > attackRange) {
            return;
        }
        if (this.selected == null || this.selected != this.target) {
            this.selected = this.target;
            if (this.selected instanceof PlayerEntity) {
                KillAura.mc.player.connection.sendPacket(new CHeldItemChangePacket(KillAura.mc.player.inventory.currentItem));
            }
        }
        KillAura.mc.playerController.attackEntity(KillAura.mc.player, this.target);
        KillAura.mc.player.swingArm(Hand.MAIN_HAND);
    }
}
хуйня
 
Начинающий
Статус
Оффлайн
Регистрация
13 Июл 2024
Сообщения
84
Реакции[?]
1
Поинты[?]
0
изначальный код килки взята с вериста но по полной переписаная
Код:
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.impl.combat.AntiBot;
import im.expensive.functions.impl.combat.AutoPotion;
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 net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.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.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;

@FunctionRegister(name="NewAura", type=Category.Combat)
public class KillAura extends Function {
    private final ModeSetting type = new ModeSetting("Тип", "Плавная", "Плавная", "Резкая");
    private final SliderSetting attackRange = new SliderSetting("Дистанция атаки", 3.0f, 3.0f, 6.0f, 0.1f);
    final ModeListSetting targets = new ModeListSetting("Цели", new BooleanSetting("Игроки", true), new BooleanSetting("Голые", true), new BooleanSetting("Мобы", false), new BooleanSetting("Животные", false), new BooleanSetting("Друзья", false), new BooleanSetting("Голые невидимки", true), new BooleanSetting("Невидимки", true));
    final BooleanSetting correctionType = new BooleanSetting("Незаметная", true);
    final BooleanSetting correctionType7 = new BooleanSetting("Только криты", true);
    final BooleanSetting correctionType6 = new BooleanSetting("Ломать щит", true);
    final BooleanSetting correctionType5 = new BooleanSetting("Отжимать щит", true);
    final BooleanSetting correctionType4 = new BooleanSetting("Ускорять атаку", false);
    final BooleanSetting correctionType3 = new BooleanSetting("Атака с ТПС", false);
    final BooleanSetting correctionType2 = new BooleanSetting("Одна цель", true);
    final BooleanSetting correctionType1 = 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(this.type, this.attackRange, this.targets, this.correctionType, this.correctionType1, this.correctionType2, this.correctionType3, this.correctionType4, this.correctionType5, this.correctionType6, this.correctionType7);
    }

    @Subscribe
    public void onInput(EventInput eventInput) {
        if (((Boolean)this.correctionType1.get()).booleanValue() && ((Boolean)this.correctionType.get()).booleanValue() && this.target != null && KillAura.mc.player != null) {
            MoveUtils.fixMovement(eventInput, this.rotateVector.x);
        }
    }

    @Subscribe
    public void onUpdate(EventUpdate e) {
        if (((Boolean)this.correctionType2.get()).booleanValue() && (this.target == null || !this.isValid(this.target)) || ((Boolean)this.correctionType2.get()).booleanValue()) {
            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 = 0;
            }
            if (this.type.is("Резкая")) {
                if (this.ticks > 0) {
                    this.updateRotation(true, 360.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()) {
            return;
        }
        float yaw = this.rotateVector.x;
        float pitch = this.rotateVector.y;
        e.setYaw(yaw);
        e.setPitch(pitch);
        KillAura.mc.player.rotationYawHead = yaw;
        KillAura.mc.player.renderYawOffset = yaw;
        KillAura.mc.player.rotationPitchHead = pitch;
    }

    private void updateTarget() {
        ArrayList<Object> targets = new ArrayList<Object>();
        for (Entity entity2 : KillAura.mc.world.getAllEntities()) {
            LivingEntity living;
            if (!(entity2 instanceof LivingEntity) || !this.isValid(living = (LivingEntity)entity2)) continue;
            targets.add(living);
        }
        if (targets.isEmpty()) {
            this.target = null;
            return;
        }
        if (targets.size() == 1) {
            this.target = (LivingEntity)targets.get(0);
            return;
        }
        targets.sort(Comparator.comparingDouble(object -> {
            if (object instanceof PlayerEntity) {
                PlayerEntity player = (PlayerEntity)object;
                return -this.getEntityArmor(player);
            }
            if (object instanceof LivingEntity) {
                LivingEntity base = (LivingEntity)object;
                return -base.getTotalArmorValue();
            }
            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 = KillAura.mc.player.getDistance((LivingEntity)object);
            double d3 = KillAura.mc.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 vec = this.target.getPositionVec().add(0.0, MathHelper.clamp(KillAura.mc.player.getPosYEye() - this.target.getPosY(), 0.0, (double)this.target.getHeight() * (KillAura.mc.player.getDistanceEyePos(this.target) / (double)((Float)this.attackRange.get()).floatValue())), 0.0).subtract(KillAura.mc.player.getEyePosition(0.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;
        switch ((String)this.type.get()) {
            case "Плавная": {
                float clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 2.0f), rotationYawSpeed);
                float clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 2.0f), rotationPitchSpeed);
                clampedPitch = attack && this.selected != this.target && ((Boolean)this.correctionType4.get()).booleanValue() ? Math.max(Math.abs(pitchDelta), 1.0f) : (clampedPitch /= 5.0f);
                if (Math.abs(clampedYaw - this.lastYaw) <= 5.0f) {
                    clampedYaw = this.lastYaw;
                }
                if (Math.abs(clampedPitch - this.lastPitch) <= 5.0f) {
                    clampedPitch = this.lastPitch;
                }
                this.rotateVector = new Vector2f(this.rotateVector.x + clampedYaw, this.rotateVector.y + clampedPitch);
                break;
            }
            case "Резкая": {
                this.rotateVector = new Vector2f(yawToTarget, pitchToTarget);
                break;
            }
        }
        this.lastYaw = this.rotateVector.x;
        this.lastPitch = this.rotateVector.y;
    }

    private void reset() {
        this.rotateVector = new Vector2f(KillAura.mc.player.rotationYaw, KillAura.mc.player.rotationPitch);
        this.target = null;
    }

    private boolean isValid(LivingEntity entity) {
        if (entity == null) {
            return false;
        }
        if (entity.equals(KillAura.mc.player)) {
            return false;
        }
        if (entity.isDead || entity.getHealth() <= 0.0f) {
            return false;
        }
        if (!this.targets.is("Все") && !this.targets.is("Игроки") && entity instanceof PlayerEntity) {
            return false;
        }
        if (!this.targets.is("Голые") && entity instanceof ArmorStandEntity) {
            return false;
        }
        if (!this.targets.is("Мобы") && entity instanceof MonsterEntity) {
            return false;
        }
        if (!this.targets.is("Животные") && entity instanceof AnimalEntity) {
            return false;
        }
        if (!this.targets.is("Друзья") && FriendStorage.isFriend(entity.getName().getString())) {
            return false;
        }
        if (!this.targets.is("Голые невидимки") && entity.isInvisible()) {
            return false;
        }
        return this.targets.is("Невидимки") || !entity.isInvisible();
    }

    private double getEntityHealth(LivingEntity entity) {
        return entity.getHealth() + entity.getAbsorptionAmount();
    }

    private double getEntityArmor(PlayerEntity entity) {
        double d = 0.0;
        for (ItemStack itemStack : entity.getArmorInventoryList()) {
            Item item = itemStack.getItem();
            if (!(item instanceof ArmorItem)) continue;
            ArmorItem armorItem = (ArmorItem)item;
            d += (double)armorItem.getArmorMaterial().getDamageReductionAmount() + (double)EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, itemStack);
        }
        return d;
    }

    private boolean shouldPlayerFalling() {
        ClientPlayerEntity player = KillAura.mc.player;
        return player != null && player.isFallFlying();
    }

    private void updateAttack() {
        if (this.target == null) {
            return;
        }
        double attackRange = (Double)this.attackRange.get();
        if (KillAura.mc.player.getDistance(this.target) > attackRange) {
            return;
        }
        if (this.selected == null || this.selected != this.target) {
            this.selected = this.target;
            if (this.selected instanceof PlayerEntity) {
                KillAura.mc.player.connection.sendPacket(new CHeldItemChangePacket(KillAura.mc.player.inventory.currentItem));
            }
        }
        KillAura.mc.playerController.attackEntity(KillAura.mc.player, this.target);
        KillAura.mc.player.swingArm(Hand.MAIN_HAND);
    }
}
1723221571914.png
 
Забаненный
Статус
Оффлайн
Регистрация
10 Май 2023
Сообщения
829
Реакции[?]
9
Поинты[?]
3K
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Начинающий
Статус
Оффлайн
Регистрация
28 Мар 2024
Сообщения
290
Реакции[?]
0
Поинты[?]
0
Забаненный
Статус
Оффлайн
Регистрация
10 Май 2023
Сообщения
829
Реакции[?]
9
Поинты[?]
3K
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Забаненный
Статус
Оффлайн
Регистрация
14 Фев 2023
Сообщения
70
Реакции[?]
0
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Начинающий
Статус
Оффлайн
Регистрация
10 Июл 2022
Сообщения
129
Реакции[?]
4
Поинты[?]
0
Начинающий
Статус
Оффлайн
Регистрация
29 Янв 2024
Сообщения
50
Реакции[?]
0
Поинты[?]
0
замолчи диванный критик
/del свое лицо не смог запастить шейдер уже говорит диванный критик хотя сам даже худ не может сделать
/del херня килка её все перебивают ( целка в том числе ) мб сделаю тему на имба килку
 
Начинающий
Статус
Оффлайн
Регистрация
29 Июн 2023
Сообщения
175
Реакции[?]
0
Поинты[?]
4K
Начинающий
Статус
Оффлайн
Регистрация
13 Июл 2024
Сообщения
84
Реакции[?]
1
Поинты[?]
0
Начинающий
Статус
Оффлайн
Регистрация
8 Фев 2023
Сообщения
46
Реакции[?]
0
Поинты[?]
0
По секрету килка с 3.1 до сих пор работает на фт :roflanEbalo:

Тему на интелку смог скачать а пофиксить баги нет 👌
xd не не обходит килка с 3.1 и та которую слили тоже ворк не будет)
 
Сверху Снизу