Исходник KillAura Rogalik Client | Expensive 3.1

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

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

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

Спасибо!

Всем ку сливаю вам киллауру и Rogalik Client на Expensive 3.1
Не судите строго это моя первая публикация

package im.expensive.functions.impl.combat;

import com.google.common.eventbus.Subscribe;
import lombok.Getter;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.merchant.villager.VillagerEntity;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.monster.PhantomEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.play.client.CHeldItemChangePacket;
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.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import im.expensive.Expensive;
import im.expensive.command.friends.FriendStorage;
import im.expensive.events.EventInput;
import im.expensive.events.EventMotion;
import im.expensive.events.EventUpdate;
import im.expensive.functions.api.Category;
import im.expensive.functions.api.Function;
import im.expensive.functions.api.FunctionRegister;
import im.expensive.functions.settings.impl.BooleanSetting;
import im.expensive.functions.settings.impl.ModeListSetting;
import im.expensive.functions.settings.impl.ModeSetting;
import im.expensive.functions.settings.impl.SliderSetting;
import im.expensive.utils.client.Calculator;
import im.expensive.utils.math.SensUtils;
import im.expensive.utils.math.StopWatch;
import im.expensive.utils.player.AttackUtil;
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.List;

@FunctionRegister(name = "KillAura", type = Category.Combat)
public class KillAura extends Function {
Getter
private final ModeSetting type = new ModeSetting("Ротация", "Плавная", "Плавная", "Резкая");

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

public static final SliderSetting attackRange = new SliderSetting("Дистанция аттаки", 3.0F, 3.0F, 6.0F, 0.1F).setVisible(() -> !options.getValueByName("Оптимальная дистанция атаки").get());
private final SliderSetting rotationRange = new SliderSetting("Дистанция ротации", 0.6F, 0.0F, 3.0F, 0.1F);
private final SliderSetting elytraRotation = new SliderSetting("Элитра ротация", 20F, 0F, 30F, 0.5F);

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

Getter
final ModeListSetting consider = new ModeListSetting("Учитывать",
new BooleanSetting("Хп", true),
new BooleanSetting("Броню", true),
new BooleanSetting("Дистанцию", true),
new BooleanSetting("Баффы", true)
);

public final ModeSetting correction = new ModeSetting("Тип коррекции", "Сфокусированная", "Незаметная", "Сфокусированная").setVisible(() -> options.getValueByName("Коррекция движения").get());

public final BooleanSetting wallCheck = new BooleanSetting("Бить через стены", true);
public final BooleanSetting noAttackIfEat = new BooleanSetting("Не бить если ешь", true);
public final BooleanSetting onlySpace = new BooleanSetting("Умные криты", false).setVisible(() -> options.getValueByName("Только криты").get());

public static Vector2f rotateVector = new Vector2f(0.0F, 0.0F);
public static Vector2f pearlVector = null;
float lastYaw;
float lastPitch;

Getter
private final StopWatch stopWatch = new StopWatch();
Getter
private static LivingEntity target;
private Entity selected;

public int ticks = 0;
public boolean isRotated;
public final AutoPotion autoPotion;

public KillAura(AutoPotion autoPotion) {
this.autoPotion = autoPotion;
this.addSettings(this.type, attackRange, this.rotationRange, this.elytraRotation, this.targets, this.consider, options, this.correction, this.wallCheck, this.noAttackIfEat, this.onlySpace);
}

@Subscribe
private void onInput(EventInput e) {
if (target != null && options.getValueByName("Коррекция движения").get() && this.correction.is("Незаметная")) {
MoveUtils.fixMovement(e, Expensive.getInstance().getFunctionRegistry().getAutopotion().isActive() ? mc.player.rotationYaw : rotateVector.x);
}
}

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

if (target == null) {
this.stopWatch.setLastMS(0L);
this.reset();
return;
}

this.isRotated = false;

if (this.shouldPlayerFalling() && this.stopWatch.hasTimeElapsed()) {
this.updateAttack();
this.ticks = 2;
}

if (this.type.is("Резкая")) {
if (this.ticks > 0) {
this.updateRotation(true, 180.0F, 90.0F);
--this.ticks;
} else {
this.reset();
}
} else if (!this.isRotated) {
this.updateRotation(false, 115.0F, 60.0F);
}
}

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

float yaw = rotateVector.x;
float pitch = rotateVector.y;

e.setYaw(yaw);
e.setPitch(pitch);

mc.player.rotationYawHead = yaw;
mc.player.renderYawOffset = yaw;
mc.player.rotationPitchHead = pitch;
}

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

for (Entity entity : mc.world.getAllEntities()) {
if (!(entity instanceof LivingEntity living)) continue;
if (!this.isValid(living)) continue;

targets.add(living);
}

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

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

targets.sort(Comparator.comparingDouble(entity ->
Calculator.entity(
entity,
consider.getValueByName("Хп").get(),
consider.getValueByName("Броню").get(),
consider.getValueByName("Дистанцию").get(),
attackDistance() + rotationRange.get() + (mc.player.isElytraFlying() ? elytraRotation.get() : 0.0),
consider.getValueByName("Баффы").get()
)));

target = targets.get(0);
}

private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
float yawToTarget;
float pitchToTarget;

if (pearlVector == null) {
Vector3d vec = target.getPositionVec().add(0.0, MathHelper.clamp(mc.player.getPosYEye() - target.getPosY(), 0.0, (double) target.getHeight() * (mc.player.getDistanceEyePos(target) / attackDistance())), 0.0).subtract(mc.player.getEyePosition(1.0F));

this.isRotated = true;
yawToTarget = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90.0);
pitchToTarget = (float) (-Math.toDegrees(Math.atan2(vec.y, Math.hypot(vec.x, vec.z))));
} else {
this.isRotated = true;
yawToTarget = pearlVector.x;
pitchToTarget = pearlVector.y;
}

float yawDelta = MathHelper.wrapDegrees(yawToTarget - rotateVector.x);
float pitchDelta = MathHelper.wrapDegrees(pitchToTarget - rotateVector.y);

int roundedYaw = (int) yawDelta;
float gcd = SensUtils.getGCDValue();

float clampedYaw;
float clampedPitch;
float yaw;
float pitch;

if (type.is("Плавная") && pearlVector == null) {
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 != target && options.getValueByName("Ускорять ротацию при атаке").get()) {
clampedPitch = Math.max(Math.abs(pitchDelta), 1.0F);
clampedYaw = Math.max(Math.abs(yawDelta), 1.0F);
} else {
clampedPitch /= 3.0F;
}

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

yaw = rotateVector.x + (yawDelta > 0.0F ? clampedYaw : -clampedYaw);

pitch = MathHelper.clamp(rotateVector.y + (pitchDelta > 0.0F ? clampedPitch : -clampedPitch), -89.0F, 89.0F);

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

rotateVector = new Vector2f(yaw, pitch);
this.lastYaw = clampedYaw;
this.lastPitch = clampedPitch;
} else if (type.is("Резкая") || pearlVector != null) {
yaw = rotateVector.x + (float) roundedYaw;
pitch = MathHelper.clamp(rotateVector.y + pitchDelta, -90.0F, 90.0F);

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

rotateVector = new Vector2f(yaw, pitch);
} else yaw = mc.player.rotationYaw;

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

private boolean canSeeThroughWall(Entity entity) {
return mc.world.rayTraceBlocks(new RayTraceContext(
mc.player.getEyePosition(1.0F),
entity.getEyePosition(1.0F),
RayTraceContext.BlockMode.COLLIDER,
RayTraceContext.FluidMode.NONE, mc.player)
).getType() == RayTraceResult.Type.MISS;
}

private void updateAttack() {
if (this.noAttackIfEat.get() && mc.player.isHandActive()) return;

this.selected = MouseUtil.getMouseOver(target, rotateVector.x, rotateVector.y, this.attackDistance());

if ((selected == null || selected != target) && !mc.player.isElytraFlying()) return;
if (options.getValueByName("Ускорять ротацию при атаке").get()) {
this.updateRotation(true, 40.0F, 45.0F);
}

if (target.getDistance(mc.player) > attackDistance()) return;

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

if (target instanceof PlayerEntity player && player.isBlocking() && options.getValueByName("Ломать щит").get()) {
int hbSlot = InventoryUtil.getInstance().getAxeInInventory(true);
int invSlot = InventoryUtil.getInstance().getAxeInInventory(false);

int slot = breakShieldPlayer(player, hbSlot, invSlot);
if (slot > 8) mc.playerController.pickItem(slot);
}

this.stopWatch.setLastMS(550L);
mc.playerController.attackEntity(mc.player, target);
mc.player.swingArm(Hand.MAIN_HAND);
}

private double attackDistance() {
if (options.getValueByName("Оптимальная дистанция атаки").get() && !mc.player.isSwimming()) {
return 3.6f;
}
if (mc.player.isSwimming()) {
return 3.0f;
}
return attackRange.get();
}

private boolean shouldPlayerFalling() {
return AttackUtil.isPlayerFalling(true, this.onlySpace.get(), options.getValueByName("Синхронизация с TPS").get());
}

public static Vector3d getVector(LivingEntity target) {
double wHalf = target.getWidth() / 2.0F;

double yExpand = MathHelper.clamp(target.getPosYEye() - target.getPosY(), 0.0, target.getHeight());
double xExpand = MathHelper.clamp(mc.player.getPosX() - target.getPosX(), -wHalf, wHalf);
double zExpand = MathHelper.clamp(mc.player.getPosZ() - target.getPosZ(), -wHalf, wHalf);

return new Vector3d(target.getPosX() - mc.player.getPosX() + xExpand, target.getPosY() - mc.player.getPosYEye() + yExpand, target.getPosZ() - mc.player.getPosZ() + zExpand);
}

private double getDistance(LivingEntity entity) {
return getVector(entity).length();
}

private boolean isValid(LivingEntity entity) {
if (!this.wallCheck.get() && !this.canSeeThroughWall(entity)) return false;
if (entity instanceof ClientPlayerEntity) return false;

if (entity.ticksExisted < 3) return false;

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

if (entity instanceof PlayerEntity && !(Boolean) this.targets.getValueByName("Игроки").get())
return false;
if (entity instanceof PlayerEntity && entity.getTotalArmorValue() == 0 && !(Boolean) this.targets.getValueByName("Голые").get())
return false;
if (entity instanceof MonsterEntity && !(Boolean) this.targets.getValueByName("Мобы").get() || entity instanceof PhantomEntity && !(Boolean) this.targets.getValueByName("Мобы").get())
return false;
if (entity instanceof AnimalEntity && !(Boolean) this.targets.getValueByName("Животные").get())
return false;
if (entity instanceof VillagerEntity || entity instanceof ArmorStandEntity) return false;
if (entity.isInvulnerable() || !entity.isAlive()) return false;

double maxDistance = attackDistance() + rotationRange.get();
if (mc.player.isElytraFlying()) maxDistance += elytraRotation.get();

return this.getDistance(entity) <= maxDistance;
}

InventoryUtil.Hand handUtil = new InventoryUtil.Hand();

private int breakShieldPlayer(PlayerEntity entity, int hbSlot, int invSlot) {
if (hbSlot != -1) {
this.handUtil.setOriginalSlot(mc.player.inventory.currentItem);

mc.player.connection.sendPacket(new CHeldItemChangePacket(hbSlot));
mc.playerController.attackEntity(mc.player, entity);

mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
return hbSlot;
}

if (invSlot != -1) {
handUtil.setOriginalSlot(mc.player.inventory.currentItem);

mc.playerController.pickItem(invSlot);
mc.playerController.attackEntity(mc.player, entity);
if (InventoryUtil.findEmptySlot(true) != -1) mc.playerController.pickItem(invSlot);

mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
return invSlot;
}

return -1;
}

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

rotateVector = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
}

public void onEnable() {
super.onEnable();
this.reset();

target = null;
pearlVector = null;
}

public void onDisable() {
super.onDisable();
this.reset();
this.stopWatch.setLastMS(0L);

target = null;
}
}






И еще класс Calculator:

package im.expensive.utils.client;

import lombok.experimental.UtilityClass;
import net.minecraft.client.Minecraft;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;

@UtilityClass
public class Calculator {
private double armor(ItemStack stack) {
if (!stack.isEnchanted()) return 0.0;
if (!(stack.getItem() instanceof ArmorItem armor)) return 0.0;

return armor.getDamageReduceAmount() + ((double) EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25);
}

public double armor(LivingEntity entity) {
double armor = entity.getTotalArmorValue();

for (ItemStack item : entity.getArmorInventoryList()) {
armor += armor(item);
}

return armor;
}

public double health(LivingEntity entity) {
return entity.getHealth() + entity.getAbsorptionAmount();
}

public double buffs(LivingEntity entity) {
double buffs = 0.0;

for (EffectInstance effect : entity.getActivePotionEffects()) {
if (effect.getPotion() == Effects.ABSORPTION) {
buffs += 1.2 * (effect.getAmplifier() + 1);
} else if (effect.getPotion() == Effects.RESISTANCE) {
buffs += 1.0 * (effect.getAmplifier() + 1);
} else if (effect.getPotion() == Effects.REGENERATION) {
buffs += 1.1 * (effect.getAmplifier() + 1);
}
}

return buffs;
}

public double entity(LivingEntity entity, boolean health, boolean armor, boolean distance, double maxDistance, boolean buffs) {
double a = 1.0, b = 1.0, c = 1.0, d = 1.0;

if (health) a += health(entity);
if (armor) b += armor(entity);
if (distance) c += entity.getDistanceSq(Minecraft.getInstance().player) / maxDistance;
if (buffs) d += buffs(entity);

return (a * b * d) * c;
}
}
 
Начинающий
Статус
Оффлайн
Регистрация
12 Дек 2022
Сообщения
139
Реакции[?]
0
Поинты[?]
0
норм код:
package im.expensive.functions.impl.combat;

import com.google.common.eventbus.Subscribe;
import lombok.Getter;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.merchant.villager.VillagerEntity;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.monster.PhantomEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.play.client.CHeldItemChangePacket;
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.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import im.expensive.Expensive;
import im.expensive.command.friends.FriendStorage;
import im.expensive.events.EventInput;
import im.expensive.events.EventMotion;
import im.expensive.events.EventUpdate;
import im.expensive.functions.api.Category;
import im.expensive.functions.api.Function;
import im.expensive.functions.api.FunctionRegister;
import im.expensive.functions.settings.impl.BooleanSetting;
import im.expensive.functions.settings.impl.ModeListSetting;
import im.expensive.functions.settings.impl.ModeSetting;
import im.expensive.functions.settings.impl.SliderSetting;
import im.expensive.utils.client.Calculator;
import im.expensive.utils.math.SensUtils;
import im.expensive.utils.math.StopWatch;
import im.expensive.utils.player.AttackUtil;
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.List;

@FunctionRegister(name = "KillAura", type = Category.Combat)
public class KillAura extends Function {
    [USER=270918]@Getter[/USER]
    private final ModeSetting type = new ModeSetting("Ротация", "Плавная", "Плавная", "Резкая");

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

    public static final SliderSetting attackRange = new SliderSetting("Дистанция аттаки", 3.0F, 3.0F, 6.0F, 0.1F).setVisible(() -> !options.getValueByName("Оптимальная дистанция атаки").get());
    private final SliderSetting rotationRange = new SliderSetting("Дистанция ротации", 0.6F, 0.0F, 3.0F, 0.1F);
    private final SliderSetting elytraRotation = new SliderSetting("Элитра ротация", 20F, 0F, 30F, 0.5F);

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

    [USER=270918]@Getter[/USER]
    final ModeListSetting consider = new ModeListSetting("Учитывать",
            new BooleanSetting("Хп", true),
            new BooleanSetting("Броню", true),
            new BooleanSetting("Дистанцию", true),
            new BooleanSetting("Баффы", true)
    );

    public final ModeSetting correction = new ModeSetting("Тип коррекции", "Сфокусированная", "Незаметная", "Сфокусированная").setVisible(() -> options.getValueByName("Коррекция движения").get());

    public final BooleanSetting wallCheck = new BooleanSetting("Бить через стены", true);
    public final BooleanSetting noAttackIfEat = new BooleanSetting("Не бить если ешь", true);
    public final BooleanSetting onlySpace = new BooleanSetting("Умные криты", false).setVisible(() -> options.getValueByName("Только криты").get());

    public static Vector2f rotateVector = new Vector2f(0.0F, 0.0F);
    public static Vector2f pearlVector = null;
    float lastYaw;
    float lastPitch;

    [USER=270918]@Getter[/USER]
    private final StopWatch stopWatch = new StopWatch();
    [USER=270918]@Getter[/USER]
    private static LivingEntity target;
    private Entity selected;

    public int ticks = 0;
    public boolean isRotated;
    public final AutoPotion autoPotion;

    public KillAura(AutoPotion autoPotion) {
        this.autoPotion = autoPotion;
        this.addSettings(this.type, attackRange, this.rotationRange, this.elytraRotation, this.targets, this.consider, options, this.correction, this.wallCheck, this.noAttackIfEat, this.onlySpace);
    }

    @Subscribe
    private void onInput(EventInput e) {
        if (target != null && options.getValueByName("Коррекция движения").get() && this.correction.is("Незаметная")) {
            MoveUtils.fixMovement(e, Expensive.getInstance().getFunctionRegistry().getAutopotion().isActive() ? mc.player.rotationYaw : rotateVector.x);
        }
    }

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

        if (target == null) {
            this.stopWatch.setLastMS(0L);
            this.reset();
            return;
        }

        this.isRotated = false;

        if (this.shouldPlayerFalling() && this.stopWatch.hasTimeElapsed()) {
            this.updateAttack();
            this.ticks = 2;
        }

        if (this.type.is("Резкая")) {
            if (this.ticks > 0) {
                this.updateRotation(true, 180.0F, 90.0F);
                --this.ticks;
            } else {
                this.reset();
            }
        } else if (!this.isRotated) {
            this.updateRotation(false, 115.0F, 60.0F);
        }
    }

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

        float yaw = rotateVector.x;
        float pitch = rotateVector.y;

        e.setYaw(yaw);
        e.setPitch(pitch);

        mc.player.rotationYawHead = yaw;
        mc.player.renderYawOffset = yaw;
        mc.player.rotationPitchHead = pitch;
    }

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

        for (Entity entity : mc.world.getAllEntities()) {
            if (!(entity instanceof LivingEntity living)) continue;
            if (!this.isValid(living)) continue;

            targets.add(living);
        }

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

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

        targets.sort(Comparator.comparingDouble(entity ->
                Calculator.entity(
                        entity,
                        consider.getValueByName("Хп").get(),
                        consider.getValueByName("Броню").get(),
                        consider.getValueByName("Дистанцию").get(),
                        attackDistance() + rotationRange.get() + (mc.player.isElytraFlying() ? elytraRotation.get() : 0.0),
                        consider.getValueByName("Баффы").get()
                )));

        target = targets.get(0);
    }

    private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
        float yawToTarget;
        float pitchToTarget;

        if (pearlVector == null) {
            Vector3d vec = target.getPositionVec().add(0.0, MathHelper.clamp(mc.player.getPosYEye() - target.getPosY(), 0.0, (double) target.getHeight() * (mc.player.getDistanceEyePos(target) / attackDistance())), 0.0).subtract(mc.player.getEyePosition(1.0F));

            this.isRotated = true;
            yawToTarget = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90.0);
            pitchToTarget = (float) (-Math.toDegrees(Math.atan2(vec.y, Math.hypot(vec.x, vec.z))));
        } else {
            this.isRotated = true;
            yawToTarget = pearlVector.x;
            pitchToTarget = pearlVector.y;
        }

        float yawDelta = MathHelper.wrapDegrees(yawToTarget - rotateVector.x);
        float pitchDelta = MathHelper.wrapDegrees(pitchToTarget - rotateVector.y);

        int roundedYaw = (int) yawDelta;
        float gcd = SensUtils.getGCDValue();

        float clampedYaw;
        float clampedPitch;
        float yaw;
        float pitch;

        if (type.is("Плавная") && pearlVector == null) {
            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 != target && options.getValueByName("Ускорять ротацию при атаке").get()) {
                clampedPitch = Math.max(Math.abs(pitchDelta), 1.0F);
                clampedYaw = Math.max(Math.abs(yawDelta), 1.0F);
            } else {
                clampedPitch /= 3.0F;
            }

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

            yaw = rotateVector.x + (yawDelta > 0.0F ? clampedYaw : -clampedYaw);

            pitch = MathHelper.clamp(rotateVector.y + (pitchDelta > 0.0F ? clampedPitch : -clampedPitch), -89.0F, 89.0F);

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

            rotateVector = new Vector2f(yaw, pitch);
            this.lastYaw = clampedYaw;
            this.lastPitch = clampedPitch;
        } else if (type.is("Резкая") || pearlVector != null) {
            yaw = rotateVector.x + (float) roundedYaw;
            pitch = MathHelper.clamp(rotateVector.y + pitchDelta, -90.0F, 90.0F);

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

            rotateVector = new Vector2f(yaw, pitch);
        } else yaw = mc.player.rotationYaw;

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

    private boolean canSeeThroughWall(Entity entity) {
        return mc.world.rayTraceBlocks(new RayTraceContext(
                mc.player.getEyePosition(1.0F),
                entity.getEyePosition(1.0F),
                RayTraceContext.BlockMode.COLLIDER,
                RayTraceContext.FluidMode.NONE, mc.player)
        ).getType() == RayTraceResult.Type.MISS;
    }

    private void updateAttack() {
        if (this.noAttackIfEat.get() && mc.player.isHandActive()) return;

        this.selected = MouseUtil.getMouseOver(target, rotateVector.x, rotateVector.y, this.attackDistance());

        if ((selected == null || selected != target) && !mc.player.isElytraFlying()) return;
        if (options.getValueByName("Ускорять ротацию при атаке").get()) {
            this.updateRotation(true, 40.0F, 45.0F);
        }

        if (target.getDistance(mc.player) > attackDistance()) return;

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

        if (target instanceof PlayerEntity player && player.isBlocking() && options.getValueByName("Ломать щит").get()) {
            int hbSlot = InventoryUtil.getInstance().getAxeInInventory(true);
            int invSlot = InventoryUtil.getInstance().getAxeInInventory(false);

            int slot = breakShieldPlayer(player, hbSlot, invSlot);
            if (slot > 8) mc.playerController.pickItem(slot);
        }

        this.stopWatch.setLastMS(550L);
        mc.playerController.attackEntity(mc.player, target);
        mc.player.swingArm(Hand.MAIN_HAND);
    }

    private double attackDistance() {
        if (options.getValueByName("Оптимальная дистанция атаки").get() && !mc.player.isSwimming()) {
            return 3.6f;
        }
        if (mc.player.isSwimming()) {
            return 3.0f;
        }
        return attackRange.get();
    }

    private boolean shouldPlayerFalling() {
        return AttackUtil.isPlayerFalling(true, this.onlySpace.get(), options.getValueByName("Синхронизация с TPS").get());
    }

    public static Vector3d getVector(LivingEntity target) {
        double wHalf = target.getWidth() / 2.0F;

        double yExpand = MathHelper.clamp(target.getPosYEye() - target.getPosY(), 0.0, target.getHeight());
        double xExpand = MathHelper.clamp(mc.player.getPosX() - target.getPosX(), -wHalf, wHalf);
        double zExpand = MathHelper.clamp(mc.player.getPosZ() - target.getPosZ(), -wHalf, wHalf);

        return new Vector3d(target.getPosX() - mc.player.getPosX() + xExpand, target.getPosY() - mc.player.getPosYEye() + yExpand, target.getPosZ() - mc.player.getPosZ() + zExpand);
    }

    private double getDistance(LivingEntity entity) {
        return getVector(entity).length();
    }

    private boolean isValid(LivingEntity entity) {
        if (!this.wallCheck.get() && !this.canSeeThroughWall(entity)) return false;
        if (entity instanceof ClientPlayerEntity) return false;

        if (entity.ticksExisted < 3) return false;

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

        if (entity instanceof PlayerEntity && !(Boolean) this.targets.getValueByName("Игроки").get())
            return false;
        if (entity instanceof PlayerEntity && entity.getTotalArmorValue() == 0 && !(Boolean) this.targets.getValueByName("Голые").get())
            return false;
        if (entity instanceof MonsterEntity && !(Boolean) this.targets.getValueByName("Мобы").get() || entity instanceof PhantomEntity && !(Boolean) this.targets.getValueByName("Мобы").get())
            return false;
        if (entity instanceof AnimalEntity && !(Boolean) this.targets.getValueByName("Животные").get())
            return false;
        if (entity instanceof VillagerEntity || entity instanceof ArmorStandEntity) return false;
        if (entity.isInvulnerable() || !entity.isAlive()) return false;

        double maxDistance = attackDistance() + rotationRange.get();
        if (mc.player.isElytraFlying()) maxDistance += elytraRotation.get();

        return this.getDistance(entity) <= maxDistance;
    }

    InventoryUtil.Hand handUtil = new InventoryUtil.Hand();

    private int breakShieldPlayer(PlayerEntity entity, int hbSlot, int invSlot) {
        if (hbSlot != -1) {
            this.handUtil.setOriginalSlot(mc.player.inventory.currentItem);

            mc.player.connection.sendPacket(new CHeldItemChangePacket(hbSlot));
            mc.playerController.attackEntity(mc.player, entity);

            mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
            return hbSlot;
        }

        if (invSlot != -1) {
            handUtil.setOriginalSlot(mc.player.inventory.currentItem);

            mc.playerController.pickItem(invSlot);
            mc.playerController.attackEntity(mc.player, entity);
            if (InventoryUtil.findEmptySlot(true) != -1) mc.playerController.pickItem(invSlot);

            mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
            return invSlot;
        }

        return -1;
    }

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

        rotateVector = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
    }

    public void onEnable() {
        super.onEnable();
        this.reset();

        target = null;
        pearlVector = null;
    }

    public void onDisable() {
        super.onDisable();
        this.reset();
        this.stopWatch.setLastMS(0L);

        target = null;
    }
}
и ещё класс Calculator:
калькулятор.java:
package im.expensive.utils.client;

import lombok.experimental.UtilityClass;
import net.minecraft.client.Minecraft;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;

@UtilityClass
public class Calculator {
private double armor(ItemStack stack) {
if (!stack.isEnchanted()) return 0.0;
if (!(stack.getItem() instanceof ArmorItem armor)) return 0.0;

return armor.getDamageReduceAmount() + ((double) EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25);
}

public double armor(LivingEntity entity) {
double armor = entity.getTotalArmorValue();

for (ItemStack item : entity.getArmorInventoryList()) {
armor += armor(item);
}

return armor;
}

public double health(LivingEntity entity) {
return entity.getHealth() + entity.getAbsorptionAmount();
}

public double buffs(LivingEntity entity) {
double buffs = 0.0;

for (EffectInstance effect : entity.getActivePotionEffects()) {
if (effect.getPotion() == Effects.ABSORPTION) {
buffs += 1.2 * (effect.getAmplifier() + 1);
} else if (effect.getPotion() == Effects.RESISTANCE) {
buffs += 1.0 * (effect.getAmplifier() + 1);
} else if (effect.getPotion() == Effects.REGENERATION) {
buffs += 1.1 * (effect.getAmplifier() + 1);
}
}

return buffs;
}

public double entity(LivingEntity entity, boolean health, boolean armor, boolean distance, double maxDistance, boolean buffs) {
double a = 1.0, b = 1.0, c = 1.0, d = 1.0;

if (health) a += health(entity);
if (armor) b += armor(entity);
if (distance) c += entity.getDistanceSq(Minecraft.getInstance().player) / maxDistance;
if (buffs) d += buffs(entity);

return (a * b * d) * c;
}
}
 
Последнее редактирование:
Начинающий
Статус
Оффлайн
Регистрация
16 Мар 2024
Сообщения
164
Реакции[?]
0
Поинты[?]
1K
Всем ку сливаю вам киллауру и Rogalik Client на Expensive 3.1
Не судите строго это моя первая публикация

package im.expensive.functions.impl.combat;

import com.google.common.eventbus.Subscribe;
import lombok.Getter;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.merchant.villager.VillagerEntity;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.monster.PhantomEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.play.client.CHeldItemChangePacket;
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.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import im.expensive.Expensive;
import im.expensive.command.friends.FriendStorage;
import im.expensive.events.EventInput;
import im.expensive.events.EventMotion;
import im.expensive.events.EventUpdate;
import im.expensive.functions.api.Category;
import im.expensive.functions.api.Function;
import im.expensive.functions.api.FunctionRegister;
import im.expensive.functions.settings.impl.BooleanSetting;
import im.expensive.functions.settings.impl.ModeListSetting;
import im.expensive.functions.settings.impl.ModeSetting;
import im.expensive.functions.settings.impl.SliderSetting;
import im.expensive.utils.client.Calculator;
import im.expensive.utils.math.SensUtils;
import im.expensive.utils.math.StopWatch;
import im.expensive.utils.player.AttackUtil;
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.List;

@FunctionRegister(name = "KillAura", type = Category.Combat)
public class KillAura extends Function {
Getter
private final ModeSetting type = new ModeSetting("Ротация", "Плавная", "Плавная", "Резкая");

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

public static final SliderSetting attackRange = new SliderSetting("Дистанция аттаки", 3.0F, 3.0F, 6.0F, 0.1F).setVisible(() -> !options.getValueByName("Оптимальная дистанция атаки").get());
private final SliderSetting rotationRange = new SliderSetting("Дистанция ротации", 0.6F, 0.0F, 3.0F, 0.1F);
private final SliderSetting elytraRotation = new SliderSetting("Элитра ротация", 20F, 0F, 30F, 0.5F);

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

Getter
final ModeListSetting consider = new ModeListSetting("Учитывать",
new BooleanSetting("Хп", true),
new BooleanSetting("Броню", true),
new BooleanSetting("Дистанцию", true),
new BooleanSetting("Баффы", true)
);

public final ModeSetting correction = new ModeSetting("Тип коррекции", "Сфокусированная", "Незаметная", "Сфокусированная").setVisible(() -> options.getValueByName("Коррекция движения").get());

public final BooleanSetting wallCheck = new BooleanSetting("Бить через стены", true);
public final BooleanSetting noAttackIfEat = new BooleanSetting("Не бить если ешь", true);
public final BooleanSetting onlySpace = new BooleanSetting("Умные криты", false).setVisible(() -> options.getValueByName("Только криты").get());

public static Vector2f rotateVector = new Vector2f(0.0F, 0.0F);
public static Vector2f pearlVector = null;
float lastYaw;
float lastPitch;

Getter
private final StopWatch stopWatch = new StopWatch();
Getter
private static LivingEntity target;
private Entity selected;

public int ticks = 0;
public boolean isRotated;
public final AutoPotion autoPotion;

public KillAura(AutoPotion autoPotion) {
this.autoPotion = autoPotion;
this.addSettings(this.type, attackRange, this.rotationRange, this.elytraRotation, this.targets, this.consider, options, this.correction, this.wallCheck, this.noAttackIfEat, this.onlySpace);
}

@Subscribe
private void onInput(EventInput e) {
if (target != null && options.getValueByName("Коррекция движения").get() && this.correction.is("Незаметная")) {
MoveUtils.fixMovement(e, Expensive.getInstance().getFunctionRegistry().getAutopotion().isActive() ? mc.player.rotationYaw : rotateVector.x);
}
}

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

if (target == null) {
this.stopWatch.setLastMS(0L);
this.reset();
return;
}

this.isRotated = false;

if (this.shouldPlayerFalling() && this.stopWatch.hasTimeElapsed()) {
this.updateAttack();
this.ticks = 2;
}

if (this.type.is("Резкая")) {
if (this.ticks > 0) {
this.updateRotation(true, 180.0F, 90.0F);
--this.ticks;
} else {
this.reset();
}
} else if (!this.isRotated) {
this.updateRotation(false, 115.0F, 60.0F);
}
}

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

float yaw = rotateVector.x;
float pitch = rotateVector.y;

e.setYaw(yaw);
e.setPitch(pitch);

mc.player.rotationYawHead = yaw;
mc.player.renderYawOffset = yaw;
mc.player.rotationPitchHead = pitch;
}

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

for (Entity entity : mc.world.getAllEntities()) {
if (!(entity instanceof LivingEntity living)) continue;
if (!this.isValid(living)) continue;

targets.add(living);
}

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

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

targets.sort(Comparator.comparingDouble(entity ->
Calculator.entity(
entity,
consider.getValueByName("Хп").get(),
consider.getValueByName("Броню").get(),
consider.getValueByName("Дистанцию").get(),
attackDistance() + rotationRange.get() + (mc.player.isElytraFlying() ? elytraRotation.get() : 0.0),
consider.getValueByName("Баффы").get()
)));

target = targets.get(0);
}

private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
float yawToTarget;
float pitchToTarget;

if (pearlVector == null) {
Vector3d vec = target.getPositionVec().add(0.0, MathHelper.clamp(mc.player.getPosYEye() - target.getPosY(), 0.0, (double) target.getHeight() * (mc.player.getDistanceEyePos(target) / attackDistance())), 0.0).subtract(mc.player.getEyePosition(1.0F));

this.isRotated = true;
yawToTarget = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90.0);
pitchToTarget = (float) (-Math.toDegrees(Math.atan2(vec.y, Math.hypot(vec.x, vec.z))));
} else {
this.isRotated = true;
yawToTarget = pearlVector.x;
pitchToTarget = pearlVector.y;
}

float yawDelta = MathHelper.wrapDegrees(yawToTarget - rotateVector.x);
float pitchDelta = MathHelper.wrapDegrees(pitchToTarget - rotateVector.y);

int roundedYaw = (int) yawDelta;
float gcd = SensUtils.getGCDValue();

float clampedYaw;
float clampedPitch;
float yaw;
float pitch;

if (type.is("Плавная") && pearlVector == null) {
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 != target && options.getValueByName("Ускорять ротацию при атаке").get()) {
clampedPitch = Math.max(Math.abs(pitchDelta), 1.0F);
clampedYaw = Math.max(Math.abs(yawDelta), 1.0F);
} else {
clampedPitch /= 3.0F;
}

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

yaw = rotateVector.x + (yawDelta > 0.0F ? clampedYaw : -clampedYaw);

pitch = MathHelper.clamp(rotateVector.y + (pitchDelta > 0.0F ? clampedPitch : -clampedPitch), -89.0F, 89.0F);

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

rotateVector = new Vector2f(yaw, pitch);
this.lastYaw = clampedYaw;
this.lastPitch = clampedPitch;
} else if (type.is("Резкая") || pearlVector != null) {
yaw = rotateVector.x + (float) roundedYaw;
pitch = MathHelper.clamp(rotateVector.y + pitchDelta, -90.0F, 90.0F);

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

rotateVector = new Vector2f(yaw, pitch);
} else yaw = mc.player.rotationYaw;

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

private boolean canSeeThroughWall(Entity entity) {
return mc.world.rayTraceBlocks(new RayTraceContext(
mc.player.getEyePosition(1.0F),
entity.getEyePosition(1.0F),
RayTraceContext.BlockMode.COLLIDER,
RayTraceContext.FluidMode.NONE, mc.player)
).getType() == RayTraceResult.Type.MISS;
}

private void updateAttack() {
if (this.noAttackIfEat.get() && mc.player.isHandActive()) return;

this.selected = MouseUtil.getMouseOver(target, rotateVector.x, rotateVector.y, this.attackDistance());

if ((selected == null || selected != target) && !mc.player.isElytraFlying()) return;
if (options.getValueByName("Ускорять ротацию при атаке").get()) {
this.updateRotation(true, 40.0F, 45.0F);
}

if (target.getDistance(mc.player) > attackDistance()) return;

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

if (target instanceof PlayerEntity player && player.isBlocking() && options.getValueByName("Ломать щит").get()) {
int hbSlot = InventoryUtil.getInstance().getAxeInInventory(true);
int invSlot = InventoryUtil.getInstance().getAxeInInventory(false);

int slot = breakShieldPlayer(player, hbSlot, invSlot);
if (slot > 8) mc.playerController.pickItem(slot);
}

this.stopWatch.setLastMS(550L);
mc.playerController.attackEntity(mc.player, target);
mc.player.swingArm(Hand.MAIN_HAND);
}

private double attackDistance() {
if (options.getValueByName("Оптимальная дистанция атаки").get() && !mc.player.isSwimming()) {
return 3.6f;
}
if (mc.player.isSwimming()) {
return 3.0f;
}
return attackRange.get();
}

private boolean shouldPlayerFalling() {
return AttackUtil.isPlayerFalling(true, this.onlySpace.get(), options.getValueByName("Синхронизация с TPS").get());
}

public static Vector3d getVector(LivingEntity target) {
double wHalf = target.getWidth() / 2.0F;

double yExpand = MathHelper.clamp(target.getPosYEye() - target.getPosY(), 0.0, target.getHeight());
double xExpand = MathHelper.clamp(mc.player.getPosX() - target.getPosX(), -wHalf, wHalf);
double zExpand = MathHelper.clamp(mc.player.getPosZ() - target.getPosZ(), -wHalf, wHalf);

return new Vector3d(target.getPosX() - mc.player.getPosX() + xExpand, target.getPosY() - mc.player.getPosYEye() + yExpand, target.getPosZ() - mc.player.getPosZ() + zExpand);
}

private double getDistance(LivingEntity entity) {
return getVector(entity).length();
}

private boolean isValid(LivingEntity entity) {
if (!this.wallCheck.get() && !this.canSeeThroughWall(entity)) return false;
if (entity instanceof ClientPlayerEntity) return false;

if (entity.ticksExisted < 3) return false;

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

if (entity instanceof PlayerEntity && !(Boolean) this.targets.getValueByName("Игроки").get())
return false;
if (entity instanceof PlayerEntity && entity.getTotalArmorValue() == 0 && !(Boolean) this.targets.getValueByName("Голые").get())
return false;
if (entity instanceof MonsterEntity && !(Boolean) this.targets.getValueByName("Мобы").get() || entity instanceof PhantomEntity && !(Boolean) this.targets.getValueByName("Мобы").get())
return false;
if (entity instanceof AnimalEntity && !(Boolean) this.targets.getValueByName("Животные").get())
return false;
if (entity instanceof VillagerEntity || entity instanceof ArmorStandEntity) return false;
if (entity.isInvulnerable() || !entity.isAlive()) return false;

double maxDistance = attackDistance() + rotationRange.get();
if (mc.player.isElytraFlying()) maxDistance += elytraRotation.get();

return this.getDistance(entity) <= maxDistance;
}

InventoryUtil.Hand handUtil = new InventoryUtil.Hand();

private int breakShieldPlayer(PlayerEntity entity, int hbSlot, int invSlot) {
if (hbSlot != -1) {
this.handUtil.setOriginalSlot(mc.player.inventory.currentItem);

mc.player.connection.sendPacket(new CHeldItemChangePacket(hbSlot));
mc.playerController.attackEntity(mc.player, entity);

mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
return hbSlot;
}

if (invSlot != -1) {
handUtil.setOriginalSlot(mc.player.inventory.currentItem);

mc.playerController.pickItem(invSlot);
mc.playerController.attackEntity(mc.player, entity);
if (InventoryUtil.findEmptySlot(true) != -1) mc.playerController.pickItem(invSlot);

mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
return invSlot;
}

return -1;
}

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

rotateVector = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
}

public void onEnable() {
super.onEnable();
this.reset();

target = null;
pearlVector = null;
}

public void onDisable() {
super.onDisable();
this.reset();
this.stopWatch.setLastMS(0L);

target = null;
}
}






И еще класс Calculator:

package im.expensive.utils.client;

import lombok.experimental.UtilityClass;
import net.minecraft.client.Minecraft;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;

@UtilityClass
public class Calculator {
private double armor(ItemStack stack) {
if (!stack.isEnchanted()) return 0.0;
if (!(stack.getItem() instanceof ArmorItem armor)) return 0.0;

return armor.getDamageReduceAmount() + ((double) EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25);
}

public double armor(LivingEntity entity) {
double armor = entity.getTotalArmorValue();

for (ItemStack item : entity.getArmorInventoryList()) {
armor += armor(item);
}

return armor;
}

public double health(LivingEntity entity) {
return entity.getHealth() + entity.getAbsorptionAmount();
}

public double buffs(LivingEntity entity) {
double buffs = 0.0;

for (EffectInstance effect : entity.getActivePotionEffects()) {
if (effect.getPotion() == Effects.ABSORPTION) {
buffs += 1.2 * (effect.getAmplifier() + 1);
} else if (effect.getPotion() == Effects.RESISTANCE) {
buffs += 1.0 * (effect.getAmplifier() + 1);
} else if (effect.getPotion() == Effects.REGENERATION) {
buffs += 1.1 * (effect.getAmplifier() + 1);
}
}

return buffs;
}

public double entity(LivingEntity entity, boolean health, boolean armor, boolean distance, double maxDistance, boolean buffs) {
double a = 1.0, b = 1.0, c = 1.0, d = 1.0;

if (health) a += health(entity);
if (armor) b += armor(entity);
if (distance) c += entity.getDistanceSq(Minecraft.getInstance().player) / maxDistance;
if (buffs) d += buffs(entity);

return (a * b * d) * c;
}
}
/del сливали
 
Начинающий
Статус
Оффлайн
Регистрация
7 Окт 2023
Сообщения
230
Реакции[?]
3
Поинты[?]
4K
Всем ку сливаю вам киллауру и Rogalik Client на Expensive 3.1
Не судите строго это моя первая публикация

package im.expensive.functions.impl.combat;

import com.google.common.eventbus.Subscribe;
import lombok.Getter;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.merchant.villager.VillagerEntity;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.monster.PhantomEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.play.client.CHeldItemChangePacket;
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.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import im.expensive.Expensive;
import im.expensive.command.friends.FriendStorage;
import im.expensive.events.EventInput;
import im.expensive.events.EventMotion;
import im.expensive.events.EventUpdate;
import im.expensive.functions.api.Category;
import im.expensive.functions.api.Function;
import im.expensive.functions.api.FunctionRegister;
import im.expensive.functions.settings.impl.BooleanSetting;
import im.expensive.functions.settings.impl.ModeListSetting;
import im.expensive.functions.settings.impl.ModeSetting;
import im.expensive.functions.settings.impl.SliderSetting;
import im.expensive.utils.client.Calculator;
import im.expensive.utils.math.SensUtils;
import im.expensive.utils.math.StopWatch;
import im.expensive.utils.player.AttackUtil;
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.List;

@FunctionRegister(name = "KillAura", type = Category.Combat)
public class KillAura extends Function {
Getter
private final ModeSetting type = new ModeSetting("Ротация", "Плавная", "Плавная", "Резкая");

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

public static final SliderSetting attackRange = new SliderSetting("Дистанция аттаки", 3.0F, 3.0F, 6.0F, 0.1F).setVisible(() -> !options.getValueByName("Оптимальная дистанция атаки").get());
private final SliderSetting rotationRange = new SliderSetting("Дистанция ротации", 0.6F, 0.0F, 3.0F, 0.1F);
private final SliderSetting elytraRotation = new SliderSetting("Элитра ротация", 20F, 0F, 30F, 0.5F);

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

Getter
final ModeListSetting consider = new ModeListSetting("Учитывать",
new BooleanSetting("Хп", true),
new BooleanSetting("Броню", true),
new BooleanSetting("Дистанцию", true),
new BooleanSetting("Баффы", true)
);

public final ModeSetting correction = new ModeSetting("Тип коррекции", "Сфокусированная", "Незаметная", "Сфокусированная").setVisible(() -> options.getValueByName("Коррекция движения").get());

public final BooleanSetting wallCheck = new BooleanSetting("Бить через стены", true);
public final BooleanSetting noAttackIfEat = new BooleanSetting("Не бить если ешь", true);
public final BooleanSetting onlySpace = new BooleanSetting("Умные криты", false).setVisible(() -> options.getValueByName("Только криты").get());

public static Vector2f rotateVector = new Vector2f(0.0F, 0.0F);
public static Vector2f pearlVector = null;
float lastYaw;
float lastPitch;

Getter
private final StopWatch stopWatch = new StopWatch();
Getter
private static LivingEntity target;
private Entity selected;

public int ticks = 0;
public boolean isRotated;
public final AutoPotion autoPotion;

public KillAura(AutoPotion autoPotion) {
this.autoPotion = autoPotion;
this.addSettings(this.type, attackRange, this.rotationRange, this.elytraRotation, this.targets, this.consider, options, this.correction, this.wallCheck, this.noAttackIfEat, this.onlySpace);
}

@Subscribe
private void onInput(EventInput e) {
if (target != null && options.getValueByName("Коррекция движения").get() && this.correction.is("Незаметная")) {
MoveUtils.fixMovement(e, Expensive.getInstance().getFunctionRegistry().getAutopotion().isActive() ? mc.player.rotationYaw : rotateVector.x);
}
}

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

if (target == null) {
this.stopWatch.setLastMS(0L);
this.reset();
return;
}

this.isRotated = false;

if (this.shouldPlayerFalling() && this.stopWatch.hasTimeElapsed()) {
this.updateAttack();
this.ticks = 2;
}

if (this.type.is("Резкая")) {
if (this.ticks > 0) {
this.updateRotation(true, 180.0F, 90.0F);
--this.ticks;
} else {
this.reset();
}
} else if (!this.isRotated) {
this.updateRotation(false, 115.0F, 60.0F);
}
}

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

float yaw = rotateVector.x;
float pitch = rotateVector.y;

e.setYaw(yaw);
e.setPitch(pitch);

mc.player.rotationYawHead = yaw;
mc.player.renderYawOffset = yaw;
mc.player.rotationPitchHead = pitch;
}

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

for (Entity entity : mc.world.getAllEntities()) {
if (!(entity instanceof LivingEntity living)) continue;
if (!this.isValid(living)) continue;

targets.add(living);
}

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

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

targets.sort(Comparator.comparingDouble(entity ->
Calculator.entity(
entity,
consider.getValueByName("Хп").get(),
consider.getValueByName("Броню").get(),
consider.getValueByName("Дистанцию").get(),
attackDistance() + rotationRange.get() + (mc.player.isElytraFlying() ? elytraRotation.get() : 0.0),
consider.getValueByName("Баффы").get()
)));

target = targets.get(0);
}

private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
float yawToTarget;
float pitchToTarget;

if (pearlVector == null) {
Vector3d vec = target.getPositionVec().add(0.0, MathHelper.clamp(mc.player.getPosYEye() - target.getPosY(), 0.0, (double) target.getHeight() * (mc.player.getDistanceEyePos(target) / attackDistance())), 0.0).subtract(mc.player.getEyePosition(1.0F));

this.isRotated = true;
yawToTarget = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90.0);
pitchToTarget = (float) (-Math.toDegrees(Math.atan2(vec.y, Math.hypot(vec.x, vec.z))));
} else {
this.isRotated = true;
yawToTarget = pearlVector.x;
pitchToTarget = pearlVector.y;
}

float yawDelta = MathHelper.wrapDegrees(yawToTarget - rotateVector.x);
float pitchDelta = MathHelper.wrapDegrees(pitchToTarget - rotateVector.y);

int roundedYaw = (int) yawDelta;
float gcd = SensUtils.getGCDValue();

float clampedYaw;
float clampedPitch;
float yaw;
float pitch;

if (type.is("Плавная") && pearlVector == null) {
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 != target && options.getValueByName("Ускорять ротацию при атаке").get()) {
clampedPitch = Math.max(Math.abs(pitchDelta), 1.0F);
clampedYaw = Math.max(Math.abs(yawDelta), 1.0F);
} else {
clampedPitch /= 3.0F;
}

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

yaw = rotateVector.x + (yawDelta > 0.0F ? clampedYaw : -clampedYaw);

pitch = MathHelper.clamp(rotateVector.y + (pitchDelta > 0.0F ? clampedPitch : -clampedPitch), -89.0F, 89.0F);

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

rotateVector = new Vector2f(yaw, pitch);
this.lastYaw = clampedYaw;
this.lastPitch = clampedPitch;
} else if (type.is("Резкая") || pearlVector != null) {
yaw = rotateVector.x + (float) roundedYaw;
pitch = MathHelper.clamp(rotateVector.y + pitchDelta, -90.0F, 90.0F);

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

rotateVector = new Vector2f(yaw, pitch);
} else yaw = mc.player.rotationYaw;

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

private boolean canSeeThroughWall(Entity entity) {
return mc.world.rayTraceBlocks(new RayTraceContext(
mc.player.getEyePosition(1.0F),
entity.getEyePosition(1.0F),
RayTraceContext.BlockMode.COLLIDER,
RayTraceContext.FluidMode.NONE, mc.player)
).getType() == RayTraceResult.Type.MISS;
}

private void updateAttack() {
if (this.noAttackIfEat.get() && mc.player.isHandActive()) return;

this.selected = MouseUtil.getMouseOver(target, rotateVector.x, rotateVector.y, this.attackDistance());

if ((selected == null || selected != target) && !mc.player.isElytraFlying()) return;
if (options.getValueByName("Ускорять ротацию при атаке").get()) {
this.updateRotation(true, 40.0F, 45.0F);
}

if (target.getDistance(mc.player) > attackDistance()) return;

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

if (target instanceof PlayerEntity player && player.isBlocking() && options.getValueByName("Ломать щит").get()) {
int hbSlot = InventoryUtil.getInstance().getAxeInInventory(true);
int invSlot = InventoryUtil.getInstance().getAxeInInventory(false);

int slot = breakShieldPlayer(player, hbSlot, invSlot);
if (slot > 8) mc.playerController.pickItem(slot);
}

this.stopWatch.setLastMS(550L);
mc.playerController.attackEntity(mc.player, target);
mc.player.swingArm(Hand.MAIN_HAND);
}

private double attackDistance() {
if (options.getValueByName("Оптимальная дистанция атаки").get() && !mc.player.isSwimming()) {
return 3.6f;
}
if (mc.player.isSwimming()) {
return 3.0f;
}
return attackRange.get();
}

private boolean shouldPlayerFalling() {
return AttackUtil.isPlayerFalling(true, this.onlySpace.get(), options.getValueByName("Синхронизация с TPS").get());
}

public static Vector3d getVector(LivingEntity target) {
double wHalf = target.getWidth() / 2.0F;

double yExpand = MathHelper.clamp(target.getPosYEye() - target.getPosY(), 0.0, target.getHeight());
double xExpand = MathHelper.clamp(mc.player.getPosX() - target.getPosX(), -wHalf, wHalf);
double zExpand = MathHelper.clamp(mc.player.getPosZ() - target.getPosZ(), -wHalf, wHalf);

return new Vector3d(target.getPosX() - mc.player.getPosX() + xExpand, target.getPosY() - mc.player.getPosYEye() + yExpand, target.getPosZ() - mc.player.getPosZ() + zExpand);
}

private double getDistance(LivingEntity entity) {
return getVector(entity).length();
}

private boolean isValid(LivingEntity entity) {
if (!this.wallCheck.get() && !this.canSeeThroughWall(entity)) return false;
if (entity instanceof ClientPlayerEntity) return false;

if (entity.ticksExisted < 3) return false;

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

if (entity instanceof PlayerEntity && !(Boolean) this.targets.getValueByName("Игроки").get())
return false;
if (entity instanceof PlayerEntity && entity.getTotalArmorValue() == 0 && !(Boolean) this.targets.getValueByName("Голые").get())
return false;
if (entity instanceof MonsterEntity && !(Boolean) this.targets.getValueByName("Мобы").get() || entity instanceof PhantomEntity && !(Boolean) this.targets.getValueByName("Мобы").get())
return false;
if (entity instanceof AnimalEntity && !(Boolean) this.targets.getValueByName("Животные").get())
return false;
if (entity instanceof VillagerEntity || entity instanceof ArmorStandEntity) return false;
if (entity.isInvulnerable() || !entity.isAlive()) return false;

double maxDistance = attackDistance() + rotationRange.get();
if (mc.player.isElytraFlying()) maxDistance += elytraRotation.get();

return this.getDistance(entity) <= maxDistance;
}

InventoryUtil.Hand handUtil = new InventoryUtil.Hand();

private int breakShieldPlayer(PlayerEntity entity, int hbSlot, int invSlot) {
if (hbSlot != -1) {
this.handUtil.setOriginalSlot(mc.player.inventory.currentItem);

mc.player.connection.sendPacket(new CHeldItemChangePacket(hbSlot));
mc.playerController.attackEntity(mc.player, entity);

mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
return hbSlot;
}

if (invSlot != -1) {
handUtil.setOriginalSlot(mc.player.inventory.currentItem);

mc.playerController.pickItem(invSlot);
mc.playerController.attackEntity(mc.player, entity);
if (InventoryUtil.findEmptySlot(true) != -1) mc.playerController.pickItem(invSlot);

mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
return invSlot;
}

return -1;
}

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

rotateVector = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
}

public void onEnable() {
super.onEnable();
this.reset();

target = null;
pearlVector = null;
}

public void onDisable() {
super.onDisable();
this.reset();
this.stopWatch.setLastMS(0L);

target = null;
}
}






И еще класс Calculator:

package im.expensive.utils.client;

import lombok.experimental.UtilityClass;
import net.minecraft.client.Minecraft;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;

@UtilityClass
public class Calculator {
private double armor(ItemStack stack) {
if (!stack.isEnchanted()) return 0.0;
if (!(stack.getItem() instanceof ArmorItem armor)) return 0.0;

return armor.getDamageReduceAmount() + ((double) EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25);
}

public double armor(LivingEntity entity) {
double armor = entity.getTotalArmorValue();

for (ItemStack item : entity.getArmorInventoryList()) {
armor += armor(item);
}

return armor;
}

public double health(LivingEntity entity) {
return entity.getHealth() + entity.getAbsorptionAmount();
}

public double buffs(LivingEntity entity) {
double buffs = 0.0;

for (EffectInstance effect : entity.getActivePotionEffects()) {
if (effect.getPotion() == Effects.ABSORPTION) {
buffs += 1.2 * (effect.getAmplifier() + 1);
} else if (effect.getPotion() == Effects.RESISTANCE) {
buffs += 1.0 * (effect.getAmplifier() + 1);
} else if (effect.getPotion() == Effects.REGENERATION) {
buffs += 1.1 * (effect.getAmplifier() + 1);
}
}

return buffs;
}

public double entity(LivingEntity entity, boolean health, boolean armor, boolean distance, double maxDistance, boolean buffs) {
double a = 1.0, b = 1.0, c = 1.0, d = 1.0;

if (health) a += health(entity);
if (armor) b += armor(entity);
if (distance) c += entity.getDistanceSq(Minecraft.getInstance().player) / maxDistance;
if (buffs) d += buffs(entity);

return (a * b * d) * c;
}
}
...
 
Начинающий
Статус
Оффлайн
Регистрация
6 Дек 2023
Сообщения
308
Реакции[?]
1
Поинты[?]
1K
Всем ку сливаю вам киллауру и Rogalik Client на Expensive 3.1

Не судите строго это моя первая публикация



package im.expensive.functions.impl.combat;



import com.google.common.eventbus.Subscribe;

import lombok.Getter;

import net.minecraft.client.entity.player.ClientPlayerEntity;

import net.minecraft.entity.Entity;

import net.minecraft.entity.LivingEntity;

import net.minecraft.entity.item.ArmorStandEntity;

import net.minecraft.entity.merchant.villager.VillagerEntity;

import net.minecraft.entity.monster.MonsterEntity;

import net.minecraft.entity.monster.PhantomEntity;

import net.minecraft.entity.passive.AnimalEntity;

import net.minecraft.entity.player.PlayerEntity;

import net.minecraft.network.play.client.CHeldItemChangePacket;

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.vector.Vector2f;

import net.minecraft.util.math.vector.Vector3d;

import im.expensive.Expensive;

import im.expensive.command.friends.FriendStorage;

import im.expensive.events.EventInput;

import im.expensive.events.EventMotion;

import im.expensive.events.EventUpdate;

import im.expensive.functions.api.Category;

import im.expensive.functions.api.Function;

import im.expensive.functions.api.FunctionRegister;

import im.expensive.functions.settings.impl.BooleanSetting;

import im.expensive.functions.settings.impl.ModeListSetting;

import im.expensive.functions.settings.impl.ModeSetting;

import im.expensive.functions.settings.impl.SliderSetting;

import im.expensive.utils.client.Calculator;

import im.expensive.utils.math.SensUtils;

import im.expensive.utils.math.StopWatch;

import im.expensive.utils.player.AttackUtil;

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.List;



@FunctionRegister(name = "KillAura", type = Category.Combat)

public class KillAura extends Function {

Getter

private final ModeSetting type = new ModeSetting("Ротация", "Плавная", "Плавная", "Резкая");



Getter

static final ModeListSetting options = new ModeListSetting("Опции",

new BooleanSetting("Только криты", true),

new BooleanSetting("Оптимальная дистанция атаки", true),

new BooleanSetting("Ломать щит", true),

new BooleanSetting("Отжимать щит", true),

new BooleanSetting("Ускорять ротацию при атаке", false),

new BooleanSetting("Синхронизация с TPS", false),

new BooleanSetting("Фокусировать одну цель", true),

new BooleanSetting("Коррекция движения", true)

);



public static final SliderSetting attackRange = new SliderSetting("Дистанция аттаки", 3.0F, 3.0F, 6.0F, 0.1F).setVisible(() -> !options.getValueByName("Оптимальная дистанция атаки").get());

private final SliderSetting rotationRange = new SliderSetting("Дистанция ротации", 0.6F, 0.0F, 3.0F, 0.1F);

private final SliderSetting elytraRotation = new SliderSetting("Элитра ротация", 20F, 0F, 30F, 0.5F);



final ModeListSetting targets = new ModeListSetting("Таргеты",

new BooleanSetting("Игроки", true), new BooleanSetting("Голые", true),

new BooleanSetting("Мобы", false), new BooleanSetting("Животные", false),

new BooleanSetting("Друзья", false)

);



Getter

final ModeListSetting consider = new ModeListSetting("Учитывать",

new BooleanSetting("Хп", true),

new BooleanSetting("Броню", true),

new BooleanSetting("Дистанцию", true),

new BooleanSetting("Баффы", true)

);



public final ModeSetting correction = new ModeSetting("Тип коррекции", "Сфокусированная", "Незаметная", "Сфокусированная").setVisible(() -> options.getValueByName("Коррекция движения").get());



public final BooleanSetting wallCheck = new BooleanSetting("Бить через стены", true);

public final BooleanSetting noAttackIfEat = new BooleanSetting("Не бить если ешь", true);

public final BooleanSetting onlySpace = new BooleanSetting("Умные криты", false).setVisible(() -> options.getValueByName("Только криты").get());



public static Vector2f rotateVector = new Vector2f(0.0F, 0.0F);

public static Vector2f pearlVector = null;

float lastYaw;

float lastPitch;



Getter

private final StopWatch stopWatch = new StopWatch();

Getter

private static LivingEntity target;

private Entity selected;



public int ticks = 0;

public boolean isRotated;

public final AutoPotion autoPotion;



public KillAura(AutoPotion autoPotion) {

this.autoPotion = autoPotion;

this.addSettings(this.type, attackRange, this.rotationRange, this.elytraRotation, this.targets, this.consider, options, this.correction, this.wallCheck, this.noAttackIfEat, this.onlySpace);

}



@Subscribe

private void onInput(EventInput e) {

if (target != null && options.getValueByName("Коррекция движения").get() && this.correction.is("Незаметная")) {

MoveUtils.fixMovement(e, Expensive.getInstance().getFunctionRegistry().getAutopotion().isActive() ? mc.player.rotationYaw : rotateVector.x);

}

}



@Subscribe

public void onUpdate(EventUpdate e) {

if (options.getValueByName("Фокусировать одну цель").get() && (target == null || !this.isValid(target)) || !(Boolean) options.getValueByName("Фокусировать одну цель").get()) {

this.updateTarget();

}



if (target == null) {

this.stopWatch.setLastMS(0L);

this.reset();

return;

}



this.isRotated = false;



if (this.shouldPlayerFalling() && this.stopWatch.hasTimeElapsed()) {

this.updateAttack();

this.ticks = 2;

}



if (this.type.is("Резкая")) {

if (this.ticks > 0) {

this.updateRotation(true, 180.0F, 90.0F);

--this.ticks;

} else {

this.reset();

}

} else if (!this.isRotated) {

this.updateRotation(false, 115.0F, 60.0F);

}

}



@Subscribe

private void onWalking(EventMotion e) {

if (target == null || (this.autoPotion.isState() && this.autoPotion.isActive())) return;



float yaw = rotateVector.x;

float pitch = rotateVector.y;



e.setYaw(yaw);

e.setPitch(pitch);



mc.player.rotationYawHead = yaw;

mc.player.renderYawOffset = yaw;

mc.player.rotationPitchHead = pitch;

}



private void updateTarget() {

List<LivingEntity> targets = new ArrayList<>();



for (Entity entity : mc.world.getAllEntities()) {

if (!(entity instanceof LivingEntity living)) continue;

if (!this.isValid(living)) continue;



targets.add(living);

}



if (targets.isEmpty()) {

target = null;

return;

}



if (targets.size() == 1) {

target = targets.get(0);

return;

}



targets.sort(Comparator.comparingDouble(entity ->

Calculator.entity(

entity,

consider.getValueByName("Хп").get(),

consider.getValueByName("Броню").get(),

consider.getValueByName("Дистанцию").get(),

attackDistance() + rotationRange.get() + (mc.player.isElytraFlying() ? elytraRotation.get() : 0.0),

consider.getValueByName("Баффы").get()

)));



target = targets.get(0);

}



private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {

float yawToTarget;

float pitchToTarget;



if (pearlVector == null) {

Vector3d vec = target.getPositionVec().add(0.0, MathHelper.clamp(mc.player.getPosYEye() - target.getPosY(), 0.0, (double) target.getHeight() * (mc.player.getDistanceEyePos(target) / attackDistance())), 0.0).subtract(mc.player.getEyePosition(1.0F));



this.isRotated = true;

yawToTarget = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90.0);

pitchToTarget = (float) (-Math.toDegrees(Math.atan2(vec.y, Math.hypot(vec.x, vec.z))));

} else {

this.isRotated = true;

yawToTarget = pearlVector.x;

pitchToTarget = pearlVector.y;

}



float yawDelta = MathHelper.wrapDegrees(yawToTarget - rotateVector.x);

float pitchDelta = MathHelper.wrapDegrees(pitchToTarget - rotateVector.y);



int roundedYaw = (int) yawDelta;

float gcd = SensUtils.getGCDValue();



float clampedYaw;

float clampedPitch;

float yaw;

float pitch;



if (type.is("Плавная") && pearlVector == null) {

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 != target && options.getValueByName("Ускорять ротацию при атаке").get()) {

clampedPitch = Math.max(Math.abs(pitchDelta), 1.0F);

clampedYaw = Math.max(Math.abs(yawDelta), 1.0F);

} else {

clampedPitch /= 3.0F;

}



if (Math.abs(clampedYaw - this.lastYaw) <= 3.0F) {

clampedYaw = this.lastYaw + 3.3F;

}



yaw = rotateVector.x + (yawDelta > 0.0F ? clampedYaw : -clampedYaw);



pitch = MathHelper.clamp(rotateVector.y + (pitchDelta > 0.0F ? clampedPitch : -clampedPitch), -89.0F, 89.0F);



yaw -= (yaw - rotateVector.x) % gcd;

pitch -= (pitch - rotateVector.y) % gcd;



rotateVector = new Vector2f(yaw, pitch);

this.lastYaw = clampedYaw;

this.lastPitch = clampedPitch;

} else if (type.is("Резкая") || pearlVector != null) {

yaw = rotateVector.x + (float) roundedYaw;

pitch = MathHelper.clamp(rotateVector.y + pitchDelta, -90.0F, 90.0F);



yaw -= (yaw - rotateVector.x) % gcd;

pitch -= (pitch - rotateVector.y) % gcd;



rotateVector = new Vector2f(yaw, pitch);

} else yaw = mc.player.rotationYaw;



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

}



private boolean canSeeThroughWall(Entity entity) {

return mc.world.rayTraceBlocks(new RayTraceContext(

mc.player.getEyePosition(1.0F),

entity.getEyePosition(1.0F),

RayTraceContext.BlockMode.COLLIDER,

RayTraceContext.FluidMode.NONE, mc.player)

).getType() == RayTraceResult.Type.MISS;

}



private void updateAttack() {

if (this.noAttackIfEat.get() && mc.player.isHandActive()) return;



this.selected = MouseUtil.getMouseOver(target, rotateVector.x, rotateVector.y, this.attackDistance());



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

if (options.getValueByName("Ускорять ротацию при атаке").get()) {

this.updateRotation(true, 40.0F, 45.0F);

}



if (target.getDistance(mc.player) > attackDistance()) return;



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

mc.playerController.onStoppedUsingItem(mc.player);



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

int hbSlot = InventoryUtil.getInstance().getAxeInInventory(true);

int invSlot = InventoryUtil.getInstance().getAxeInInventory(false);



int slot = breakShieldPlayer(player, hbSlot, invSlot);

if (slot > 8) mc.playerController.pickItem(slot);

}



this.stopWatch.setLastMS(550L);

mc.playerController.attackEntity(mc.player, target);

mc.player.swingArm(Hand.MAIN_HAND);

}



private double attackDistance() {

if (options.getValueByName("Оптимальная дистанция атаки").get() && !mc.player.isSwimming()) {

return 3.6f;

}

if (mc.player.isSwimming()) {

return 3.0f;

}

return attackRange.get();

}



private boolean shouldPlayerFalling() {

return AttackUtil.isPlayerFalling(true, this.onlySpace.get(), options.getValueByName("Синхронизация с TPS").get());

}



public static Vector3d getVector(LivingEntity target) {

double wHalf = target.getWidth() / 2.0F;



double yExpand = MathHelper.clamp(target.getPosYEye() - target.getPosY(), 0.0, target.getHeight());

double xExpand = MathHelper.clamp(mc.player.getPosX() - target.getPosX(), -wHalf, wHalf);

double zExpand = MathHelper.clamp(mc.player.getPosZ() - target.getPosZ(), -wHalf, wHalf);



return new Vector3d(target.getPosX() - mc.player.getPosX() + xExpand, target.getPosY() - mc.player.getPosYEye() + yExpand, target.getPosZ() - mc.player.getPosZ() + zExpand);

}



private double getDistance(LivingEntity entity) {

return getVector(entity).length();

}



private boolean isValid(LivingEntity entity) {

if (!this.wallCheck.get() && !this.canSeeThroughWall(entity)) return false;

if (entity instanceof ClientPlayerEntity) return false;



if (entity.ticksExisted < 3) return false;



if (entity instanceof PlayerEntity p) {

if (AntiBot.checkBot(entity)) return false;

if (!this.targets.getValueByName("Друзья").get() && FriendStorage.isFriend(p.getName().getString()))

return false;

if (p.getName().getString().equalsIgnoreCase(mc.player.getName().getString())) return false;

}



if (entity instanceof PlayerEntity && !(Boolean) this.targets.getValueByName("Игроки").get())

return false;

if (entity instanceof PlayerEntity && entity.getTotalArmorValue() == 0 && !(Boolean) this.targets.getValueByName("Голые").get())

return false;

if (entity instanceof MonsterEntity && !(Boolean) this.targets.getValueByName("Мобы").get() || entity instanceof PhantomEntity && !(Boolean) this.targets.getValueByName("Мобы").get())

return false;

if (entity instanceof AnimalEntity && !(Boolean) this.targets.getValueByName("Животные").get())

return false;

if (entity instanceof VillagerEntity || entity instanceof ArmorStandEntity) return false;

if (entity.isInvulnerable() || !entity.isAlive()) return false;



double maxDistance = attackDistance() + rotationRange.get();

if (mc.player.isElytraFlying()) maxDistance += elytraRotation.get();



return this.getDistance(entity) <= maxDistance;

}



InventoryUtil.Hand handUtil = new InventoryUtil.Hand();



private int breakShieldPlayer(PlayerEntity entity, int hbSlot, int invSlot) {

if (hbSlot != -1) {

this.handUtil.setOriginalSlot(mc.player.inventory.currentItem);



mc.player.connection.sendPacket(new CHeldItemChangePacket(hbSlot));

mc.playerController.attackEntity(mc.player, entity);



mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));

return hbSlot;

}



if (invSlot != -1) {

handUtil.setOriginalSlot(mc.player.inventory.currentItem);



mc.playerController.pickItem(invSlot);

mc.playerController.attackEntity(mc.player, entity);

if (InventoryUtil.findEmptySlot(true) != -1) mc.playerController.pickItem(invSlot);



mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));

return invSlot;

}



return -1;

}



private void reset() {

if (options.getValueByName("Коррекция движения").get()) {

mc.player.rotationYawOffset = -2.14748365E9F;

}



rotateVector = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);

}



public void onEnable() {

super.onEnable();

this.reset();



target = null;

pearlVector = null;

}



public void onDisable() {

super.onDisable();

this.reset();

this.stopWatch.setLastMS(0L);



target = null;

}

}











И еще класс Calculator:



package im.expensive.utils.client;



import lombok.experimental.UtilityClass;

import net.minecraft.client.Minecraft;

import net.minecraft.enchantment.EnchantmentHelper;

import net.minecraft.enchantment.Enchantments;

import net.minecraft.entity.LivingEntity;

import net.minecraft.entity.player.PlayerEntity;

import net.minecraft.item.ArmorItem;

import net.minecraft.item.ItemStack;

import net.minecraft.potion.Effect;

import net.minecraft.potion.EffectInstance;

import net.minecraft.potion.Effects;



@UtilityClass

public class Calculator {

private double armor(ItemStack stack) {

if (!stack.isEnchanted()) return 0.0;

if (!(stack.getItem() instanceof ArmorItem armor)) return 0.0;



return armor.getDamageReduceAmount() + ((double) EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25);

}



public double armor(LivingEntity entity) {

double armor = entity.getTotalArmorValue();



for (ItemStack item : entity.getArmorInventoryList()) {

armor += armor(item);

}



return armor;

}



public double health(LivingEntity entity) {

return entity.getHealth() + entity.getAbsorptionAmount();

}



public double buffs(LivingEntity entity) {

double buffs = 0.0;



for (EffectInstance effect : entity.getActivePotionEffects()) {

if (effect.getPotion() == Effects.ABSORPTION) {

buffs += 1.2 * (effect.getAmplifier() + 1);

} else if (effect.getPotion() == Effects.RESISTANCE) {

buffs += 1.0 * (effect.getAmplifier() + 1);

} else if (effect.getPotion() == Effects.REGENERATION) {

buffs += 1.1 * (effect.getAmplifier() + 1);

}

}



return buffs;

}



public double entity(LivingEntity entity, boolean health, boolean armor, boolean distance, double maxDistance, boolean buffs) {

double a = 1.0, b = 1.0, c = 1.0, d = 1.0;



if (health) a += health(entity);

if (armor) b += armor(entity);

if (distance) c += entity.getDistanceSq(Minecraft.getInstance().player) / maxDistance;

if (buffs) d += buffs(entity);



return (a * b * d) * c;

}

}
Это не киллка рогалика xd
 
Read Only
Статус
Оффлайн
Регистрация
18 Мар 2023
Сообщения
52
Реакции[?]
0
Поинты[?]
0
рогалик вообще-то смешанная 2.0 и 3.1
дарова, не знаешь как перенести киллауру + элитра таргет рогалика к себе? Просто у меня ошибками сыпит когда киллауру пастил с сурсов рогалика, а элитра таргета я даже и не увидел где его брать дс мой ты знаешь))
 
Начинающий
Статус
Оффлайн
Регистрация
11 Сен 2024
Сообщения
9
Реакции[?]
0
Поинты[?]
0
дарова, не знаешь как перенести киллауру + элитра таргет рогалика к себе? Просто у меня ошибками сыпит когда киллауру пастил с сурсов рогалика, а элитра таргета я даже и не увидел где его брать дс мой ты знаешь))
tupoi
 
Начинающий
Статус
Оффлайн
Регистрация
21 Сен 2024
Сообщения
17
Реакции[?]
0
Поинты[?]
0
норм код:
package im.expensive.functions.impl.combat;

import com.google.common.eventbus.Subscribe;
import lombok.Getter;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.merchant.villager.VillagerEntity;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.monster.PhantomEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.play.client.CHeldItemChangePacket;
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.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import im.expensive.Expensive;
import im.expensive.command.friends.FriendStorage;
import im.expensive.events.EventInput;
import im.expensive.events.EventMotion;
import im.expensive.events.EventUpdate;
import im.expensive.functions.api.Category;
import im.expensive.functions.api.Function;
import im.expensive.functions.api.FunctionRegister;
import im.expensive.functions.settings.impl.BooleanSetting;
import im.expensive.functions.settings.impl.ModeListSetting;
import im.expensive.functions.settings.impl.ModeSetting;
import im.expensive.functions.settings.impl.SliderSetting;
import im.expensive.utils.client.Calculator;
import im.expensive.utils.math.SensUtils;
import im.expensive.utils.math.StopWatch;
import im.expensive.utils.player.AttackUtil;
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.List;

@FunctionRegister(name = "KillAura", type = Category.Combat)
public class KillAura extends Function {
    [USER=270918]@Getter[/USER]
    private final ModeSetting type = new ModeSetting("Ротация", "Плавная", "Плавная", "Резкая");

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

    public static final SliderSetting attackRange = new SliderSetting("Дистанция аттаки", 3.0F, 3.0F, 6.0F, 0.1F).setVisible(() -> !options.getValueByName("Оптимальная дистанция атаки").get());
    private final SliderSetting rotationRange = new SliderSetting("Дистанция ротации", 0.6F, 0.0F, 3.0F, 0.1F);
    private final SliderSetting elytraRotation = new SliderSetting("Элитра ротация", 20F, 0F, 30F, 0.5F);

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

    [USER=270918]@Getter[/USER]
    final ModeListSetting consider = new ModeListSetting("Учитывать",
            new BooleanSetting("Хп", true),
            new BooleanSetting("Броню", true),
            new BooleanSetting("Дистанцию", true),
            new BooleanSetting("Баффы", true)
    );

    public final ModeSetting correction = new ModeSetting("Тип коррекции", "Сфокусированная", "Незаметная", "Сфокусированная").setVisible(() -> options.getValueByName("Коррекция движения").get());

    public final BooleanSetting wallCheck = new BooleanSetting("Бить через стены", true);
    public final BooleanSetting noAttackIfEat = new BooleanSetting("Не бить если ешь", true);
    public final BooleanSetting onlySpace = new BooleanSetting("Умные криты", false).setVisible(() -> options.getValueByName("Только криты").get());

    public static Vector2f rotateVector = new Vector2f(0.0F, 0.0F);
    public static Vector2f pearlVector = null;
    float lastYaw;
    float lastPitch;

    [USER=270918]@Getter[/USER]
    private final StopWatch stopWatch = new StopWatch();
    [USER=270918]@Getter[/USER]
    private static LivingEntity target;
    private Entity selected;

    public int ticks = 0;
    public boolean isRotated;
    public final AutoPotion autoPotion;

    public KillAura(AutoPotion autoPotion) {
        this.autoPotion = autoPotion;
        this.addSettings(this.type, attackRange, this.rotationRange, this.elytraRotation, this.targets, this.consider, options, this.correction, this.wallCheck, this.noAttackIfEat, this.onlySpace);
    }

    @Subscribe
    private void onInput(EventInput e) {
        if (target != null && options.getValueByName("Коррекция движения").get() && this.correction.is("Незаметная")) {
            MoveUtils.fixMovement(e, Expensive.getInstance().getFunctionRegistry().getAutopotion().isActive() ? mc.player.rotationYaw : rotateVector.x);
        }
    }

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

        if (target == null) {
            this.stopWatch.setLastMS(0L);
            this.reset();
            return;
        }

        this.isRotated = false;

        if (this.shouldPlayerFalling() && this.stopWatch.hasTimeElapsed()) {
            this.updateAttack();
            this.ticks = 2;
        }

        if (this.type.is("Резкая")) {
            if (this.ticks > 0) {
                this.updateRotation(true, 180.0F, 90.0F);
                --this.ticks;
            } else {
                this.reset();
            }
        } else if (!this.isRotated) {
            this.updateRotation(false, 115.0F, 60.0F);
        }
    }

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

        float yaw = rotateVector.x;
        float pitch = rotateVector.y;

        e.setYaw(yaw);
        e.setPitch(pitch);

        mc.player.rotationYawHead = yaw;
        mc.player.renderYawOffset = yaw;
        mc.player.rotationPitchHead = pitch;
    }

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

        for (Entity entity : mc.world.getAllEntities()) {
            if (!(entity instanceof LivingEntity living)) continue;
            if (!this.isValid(living)) continue;

            targets.add(living);
        }

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

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

        targets.sort(Comparator.comparingDouble(entity ->
                Calculator.entity(
                        entity,
                        consider.getValueByName("Хп").get(),
                        consider.getValueByName("Броню").get(),
                        consider.getValueByName("Дистанцию").get(),
                        attackDistance() + rotationRange.get() + (mc.player.isElytraFlying() ? elytraRotation.get() : 0.0),
                        consider.getValueByName("Баффы").get()
                )));

        target = targets.get(0);
    }

    private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
        float yawToTarget;
        float pitchToTarget;

        if (pearlVector == null) {
            Vector3d vec = target.getPositionVec().add(0.0, MathHelper.clamp(mc.player.getPosYEye() - target.getPosY(), 0.0, (double) target.getHeight() * (mc.player.getDistanceEyePos(target) / attackDistance())), 0.0).subtract(mc.player.getEyePosition(1.0F));

            this.isRotated = true;
            yawToTarget = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90.0);
            pitchToTarget = (float) (-Math.toDegrees(Math.atan2(vec.y, Math.hypot(vec.x, vec.z))));
        } else {
            this.isRotated = true;
            yawToTarget = pearlVector.x;
            pitchToTarget = pearlVector.y;
        }

        float yawDelta = MathHelper.wrapDegrees(yawToTarget - rotateVector.x);
        float pitchDelta = MathHelper.wrapDegrees(pitchToTarget - rotateVector.y);

        int roundedYaw = (int) yawDelta;
        float gcd = SensUtils.getGCDValue();

        float clampedYaw;
        float clampedPitch;
        float yaw;
        float pitch;

        if (type.is("Плавная") && pearlVector == null) {
            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 != target && options.getValueByName("Ускорять ротацию при атаке").get()) {
                clampedPitch = Math.max(Math.abs(pitchDelta), 1.0F);
                clampedYaw = Math.max(Math.abs(yawDelta), 1.0F);
            } else {
                clampedPitch /= 3.0F;
            }

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

            yaw = rotateVector.x + (yawDelta > 0.0F ? clampedYaw : -clampedYaw);

            pitch = MathHelper.clamp(rotateVector.y + (pitchDelta > 0.0F ? clampedPitch : -clampedPitch), -89.0F, 89.0F);

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

            rotateVector = new Vector2f(yaw, pitch);
            this.lastYaw = clampedYaw;
            this.lastPitch = clampedPitch;
        } else if (type.is("Резкая") || pearlVector != null) {
            yaw = rotateVector.x + (float) roundedYaw;
            pitch = MathHelper.clamp(rotateVector.y + pitchDelta, -90.0F, 90.0F);

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

            rotateVector = new Vector2f(yaw, pitch);
        } else yaw = mc.player.rotationYaw;

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

    private boolean canSeeThroughWall(Entity entity) {
        return mc.world.rayTraceBlocks(new RayTraceContext(
                mc.player.getEyePosition(1.0F),
                entity.getEyePosition(1.0F),
                RayTraceContext.BlockMode.COLLIDER,
                RayTraceContext.FluidMode.NONE, mc.player)
        ).getType() == RayTraceResult.Type.MISS;
    }

    private void updateAttack() {
        if (this.noAttackIfEat.get() && mc.player.isHandActive()) return;

        this.selected = MouseUtil.getMouseOver(target, rotateVector.x, rotateVector.y, this.attackDistance());

        if ((selected == null || selected != target) && !mc.player.isElytraFlying()) return;
        if (options.getValueByName("Ускорять ротацию при атаке").get()) {
            this.updateRotation(true, 40.0F, 45.0F);
        }

        if (target.getDistance(mc.player) > attackDistance()) return;

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

        if (target instanceof PlayerEntity player && player.isBlocking() && options.getValueByName("Ломать щит").get()) {
            int hbSlot = InventoryUtil.getInstance().getAxeInInventory(true);
            int invSlot = InventoryUtil.getInstance().getAxeInInventory(false);

            int slot = breakShieldPlayer(player, hbSlot, invSlot);
            if (slot > 8) mc.playerController.pickItem(slot);
        }

        this.stopWatch.setLastMS(550L);
        mc.playerController.attackEntity(mc.player, target);
        mc.player.swingArm(Hand.MAIN_HAND);
    }

    private double attackDistance() {
        if (options.getValueByName("Оптимальная дистанция атаки").get() && !mc.player.isSwimming()) {
            return 3.6f;
        }
        if (mc.player.isSwimming()) {
            return 3.0f;
        }
        return attackRange.get();
    }

    private boolean shouldPlayerFalling() {
        return AttackUtil.isPlayerFalling(true, this.onlySpace.get(), options.getValueByName("Синхронизация с TPS").get());
    }

    public static Vector3d getVector(LivingEntity target) {
        double wHalf = target.getWidth() / 2.0F;

        double yExpand = MathHelper.clamp(target.getPosYEye() - target.getPosY(), 0.0, target.getHeight());
        double xExpand = MathHelper.clamp(mc.player.getPosX() - target.getPosX(), -wHalf, wHalf);
        double zExpand = MathHelper.clamp(mc.player.getPosZ() - target.getPosZ(), -wHalf, wHalf);

        return new Vector3d(target.getPosX() - mc.player.getPosX() + xExpand, target.getPosY() - mc.player.getPosYEye() + yExpand, target.getPosZ() - mc.player.getPosZ() + zExpand);
    }

    private double getDistance(LivingEntity entity) {
        return getVector(entity).length();
    }

    private boolean isValid(LivingEntity entity) {
        if (!this.wallCheck.get() && !this.canSeeThroughWall(entity)) return false;
        if (entity instanceof ClientPlayerEntity) return false;

        if (entity.ticksExisted < 3) return false;

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

        if (entity instanceof PlayerEntity && !(Boolean) this.targets.getValueByName("Игроки").get())
            return false;
        if (entity instanceof PlayerEntity && entity.getTotalArmorValue() == 0 && !(Boolean) this.targets.getValueByName("Голые").get())
            return false;
        if (entity instanceof MonsterEntity && !(Boolean) this.targets.getValueByName("Мобы").get() || entity instanceof PhantomEntity && !(Boolean) this.targets.getValueByName("Мобы").get())
            return false;
        if (entity instanceof AnimalEntity && !(Boolean) this.targets.getValueByName("Животные").get())
            return false;
        if (entity instanceof VillagerEntity || entity instanceof ArmorStandEntity) return false;
        if (entity.isInvulnerable() || !entity.isAlive()) return false;

        double maxDistance = attackDistance() + rotationRange.get();
        if (mc.player.isElytraFlying()) maxDistance += elytraRotation.get();

        return this.getDistance(entity) <= maxDistance;
    }

    InventoryUtil.Hand handUtil = new InventoryUtil.Hand();

    private int breakShieldPlayer(PlayerEntity entity, int hbSlot, int invSlot) {
        if (hbSlot != -1) {
            this.handUtil.setOriginalSlot(mc.player.inventory.currentItem);

            mc.player.connection.sendPacket(new CHeldItemChangePacket(hbSlot));
            mc.playerController.attackEntity(mc.player, entity);

            mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
            return hbSlot;
        }

        if (invSlot != -1) {
            handUtil.setOriginalSlot(mc.player.inventory.currentItem);

            mc.playerController.pickItem(invSlot);
            mc.playerController.attackEntity(mc.player, entity);
            if (InventoryUtil.findEmptySlot(true) != -1) mc.playerController.pickItem(invSlot);

            mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
            return invSlot;
        }

        return -1;
    }

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

        rotateVector = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
    }

    public void onEnable() {
        super.onEnable();
        this.reset();

        target = null;
        pearlVector = null;
    }

    public void onDisable() {
        super.onDisable();
        this.reset();
        this.stopWatch.setLastMS(0L);

        target = null;
    }
}
и ещё класс Calculator:
калькулятор.java:
package im.expensive.utils.client;

import lombok.experimental.UtilityClass;
import net.minecraft.client.Minecraft;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;

@UtilityClass
public class Calculator {
private double armor(ItemStack stack) {
if (!stack.isEnchanted()) return 0.0;
if (!(stack.getItem() instanceof ArmorItem armor)) return 0.0;

return armor.getDamageReduceAmount() + ((double) EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25);
}

public double armor(LivingEntity entity) {
double armor = entity.getTotalArmorValue();

for (ItemStack item : entity.getArmorInventoryList()) {
armor += armor(item);
}

return armor;
}

public double health(LivingEntity entity) {
return entity.getHealth() + entity.getAbsorptionAmount();
}

public double buffs(LivingEntity entity) {
double buffs = 0.0;

for (EffectInstance effect : entity.getActivePotionEffects()) {
if (effect.getPotion() == Effects.ABSORPTION) {
buffs += 1.2 * (effect.getAmplifier() + 1);
} else if (effect.getPotion() == Effects.RESISTANCE) {
buffs += 1.0 * (effect.getAmplifier() + 1);
} else if (effect.getPotion() == Effects.REGENERATION) {
buffs += 1.1 * (effect.getAmplifier() + 1);
}
}

return buffs;
}

public double entity(LivingEntity entity, boolean health, boolean armor, boolean distance, double maxDistance, boolean buffs) {
double a = 1.0, b = 1.0, c = 1.0, d = 1.0;

if (health) a += health(entity);
if (armor) b += armor(entity);
if (distance) c += entity.getDistanceSq(Minecraft.getInstance().player) / maxDistance;
if (buffs) d += buffs(entity);

return (a * b * d) * c;
}
}
что деолать?????
 

Вложения

Начинающий
Статус
Оффлайн
Регистрация
6 Дек 2023
Сообщения
308
Реакции[?]
1
Поинты[?]
1K
что деолать?????
Ливнуть с форума, раз ты не знаешь что такое геттер и как он выглядит
дарова, не знаешь как перенести киллауру + элитра таргет рогалика к себе? Просто у меня ошибками сыпит когда киллауру пастил с сурсов рогалика, а элитра таргета я даже и не увидел где его брать дс мой ты знаешь))
В livingentity элитра таргет в рыгалике
xd он во всех пастах на 2.0 пишется в ауре гений
В рыгалике его отключить нельзя даже, он по дефолту включён
 
Начинающий
Статус
Оффлайн
Регистрация
29 Сен 2023
Сообщения
14
Реакции[?]
0
Поинты[?]
0
дак в обрыгалике дефолтная 3.1 с ненужными допами ( кроме чекбоксовс некоторыми хуйнями ), и там ротацию впринципе не меняли... :roflanEbalo:
 
Начинающий
Статус
Оффлайн
Регистрация
6 Дек 2023
Сообщения
308
Реакции[?]
1
Поинты[?]
1K
дак в обрыгалике дефолтная 3.1 с ненужными допами ( кроме чекбоксовс некоторыми хуйнями ), и там ротацию впринципе не меняли... :roflanEbalo:
Там умные криты и что то ещё есть
 
Сверху Снизу