- Выберите загрузчик игры
- Vanilla
killaura:
package fun.vesence.modules.impl.combat;
import com.google.common.eventbus.Subscribe;
import fun.vesence.Vesence;
import fun.vesence.modules.api.Module;
import fun.vesence.modules.api.impl.ServerCategory;
import fun.vesence.modules.api.impl.settings.impl.BooleanSetting;
import fun.vesence.modules.api.impl.settings.impl.ModeListSetting;
import fun.vesence.modules.api.impl.settings.impl.ModeSetting;
import fun.vesence.modules.api.impl.settings.impl.SliderSetting;
import fun.vesence.modules.api.system.Category;
import fun.vesence.modules.api.system.ModuleSystem;
import fun.vesence.modules.impl.combat.AntiBot;
import fun.vesence.modules.impl.combat.AutoPotion;
import fun.vesence.system.events.EventInput;
import fun.vesence.system.events.EventMotion;
import fun.vesence.system.events.EventUpdate;
import fun.vesence.system.friends.FriendStorage;
import fun.vesence.system.target.TargetStorage;
import fun.vesence.utils.math.SensUtils;
import fun.vesence.utils.math.StopWatch;
import fun.vesence.utils.player.InventoryUtil;
import fun.vesence.utils.player.MouseUtil;
import fun.vesence.utils.player.MoveUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.CHeldItemChangePacket;
import net.minecraft.tags.FluidTags;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockRayTraceResult;
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 java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.ThreadLocalRandom;
@ModuleSystem(name = "AttackAura", type = Category.Combat, description = "Автоматически атакует сущности", server = ServerCategory.FT)
public class KillAura extends Module {
// Настройки режимов атаки
private final ModeSetting attackMode = new ModeSetting("Режим", "Smooth", "Smooth", "FunTime", "SpookyTime");
public static Vector2f rotationVector = new Vector2f(0.0f, 0.0f);
// Основные настройки
private final SliderSetting attackRange = new SliderSetting("Дистанция атаки", 3.0f, 2.5f, 6.0f, 0.1f);
private final BooleanSetting leadTarget = new BooleanSetting("Предугадывание", false);
private final BooleanSetting disableSprint = new BooleanSetting("Сбрасывать спринт", false);
private final SliderSetting noiseStrength = new SliderSetting("Сила шума", 1.0f, 0.1f, 20.0f, 0.1f).setVisible(() -> this.attackMode.is("SpookyTime"));
private final BooleanSetting drawPredictedPosition;
private final SliderSetting leadValue;
// Настройки для элитры
private final SliderSetting elytraAttackRange = new SliderSetting("Дист атаки на элитре", 3.0f, 1.0f, 5.0f, 0.1f);
private final SliderSetting elytraDistance = new SliderSetting("Дистанция на элитре", 0.0f, 0.0f, 50.0f, 1.0f);
// Настройки ротации
private final BooleanSetting speedRotation = new BooleanSetting("Ускорить ротацию", false).setVisible(() -> this.attackMode.is("GrimNew"));
private final BooleanSetting smoothShake = new BooleanSetting("Smooth тряска", false).setVisible(() -> this.attackMode.is("GrimNew"));
private final BooleanSetting bodyShake = new BooleanSetting("Тряска Тела", false).setVisible(() -> this.attackMode.is("HolyWorld"));
// Настройки целей
private final ModeListSetting targetSettings = new ModeListSetting("Цели",
new BooleanSetting("Игроки", true),
new BooleanSetting("Голые", true),
new BooleanSetting("Мобы", false),
new BooleanSetting("Животные", false),
new BooleanSetting("Люди из списка целей", true),
new BooleanSetting("Друзья", false),
new BooleanSetting("Голые невидимки", true),
new BooleanSetting("Невидимки", true)
);
// Дополнительные опции
public static ModeListSetting advancedOptions = new ModeListSetting("Параметры",
new BooleanSetting("Только криты", true),
new BooleanSetting("Ломать щит", true),
new BooleanSetting("Отжимать щит", true),
new BooleanSetting("Ускорение ротации", false),
new BooleanSetting("Синхроз с TPS", false),
new BooleanSetting("Таргетить одну цель", true),
new BooleanSetting("Коррекция движения", true)
);
private final ModeSetting correctionType;
private final BooleanSetting checkWallObstruction;
// Временные переменные
private boolean sprintMessageSent = false;
private final StopWatch attackTimer;
public static Vector2f currentRotation = new Vector2f(0.0f, 0.0f);
public static LivingEntity currentTarget;
private Entity selectedEntity;
private int attackTicks;
private boolean isRotating;
private final AutoPotion autoPotion;
private float lastYawSpeed;
private float lastPitchSpeed;
private float rotationSpeedX;
private float rotationSpeedY;
private StopWatch yawUpdateTimer;
private StopWatch pitchUpdateTimer;
private boolean disableForwardMovement;
private final StopWatch forwardTimer;
private boolean sprintReset = false;
public KillAura(AutoPotion autoPotion) {
this.drawPredictedPosition = new BooleanSetting("Рисовать позицию", false).setVisible(this.leadTarget::get);
this.leadValue = new SliderSetting("Значение обгона", 75.0f, 0.0f, 100.0f, 1.0f).setVisible(this.leadTarget::get);
this.correctionType = new ModeSetting("Тип коррекции", "Незаметный", "Незаметный", "Сфокусированный").setVisible(() ->
((Boolean)advancedOptions.getValueByName("Коррекция движения").get()).booleanValue()
);
this.checkWallObstruction = new BooleanSetting("Не бить через стену", false);
this.attackTimer = new StopWatch();
this.attackTicks = 0;
this.rotationSpeedX = 0.0f;
this.rotationSpeedY = 0.0f;
this.yawUpdateTimer = new StopWatch();
this.pitchUpdateTimer = new StopWatch();
this.forwardTimer = new StopWatch();
this.autoPotion = autoPotion;
// Добавление всех настроек
this.addSettings(
this.attackMode, this.drawPredictedPosition, this.leadTarget,
this.noiseStrength, this.disableSprint, this.leadValue, this.attackRange,
this.elytraAttackRange, this.elytraDistance, this.smoothShake,
this.speedRotation, this.bodyShake, this.targetSettings, advancedOptions,
this.correctionType, this.checkWallObstruction
);
}
@Subscribe
public void onInput(EventInput event) {
if (((Boolean)advancedOptions.getValueByName("Коррекция движения").get()).booleanValue() &&
this.correctionType.is("Незаметный") && currentTarget != null) {
if (Minecraft.player != null) {
float targetYaw;
if (this.autoPotion.isActive()) {
targetYaw = Minecraft.player.rotationYaw;
} else {
targetYaw = KillAura.currentRotation.x;
}
MoveUtils.fixMovement(event, targetYaw);
}
}
}
@Subscribe
public void onUpdate(EventUpdate event) {
// Обновление цели если нужно
if (((Boolean)advancedOptions.getValueByName("Таргетить одну цель").get()).booleanValue() &&
(currentTarget == null || !this.isValidTarget(currentTarget)) ||
!((Boolean)advancedOptions.getValueByName("Таргетить одну цель").get()).booleanValue()) {
this.updateTarget();
}
// Обработка специального режима
if (this.attackMode.is("123")) {
if (!this.sprintMessageSent) {
this.sprintMessageSent = true;
}
if (currentTarget == null) return;
if (Minecraft.player.isSprinting()) {
Minecraft.player.setSprinting(false);
} else if (this.sprintMessageSent && (currentTarget == null || !this.isValidTarget(currentTarget))) {
this.sprintMessageSent = false;
}
}
// Основная логика атаки
if (currentTarget == null || (this.autoPotion.isState() && this.autoPotion.isActive())) {
this.attackTimer.setLastMS(0L);
this.resetRotation();
return;
}
this.isRotating = false;
if (this.canAttack() && this.attackTimer.hasTimeElapsed()) {
this.performAttack();
this.attackTicks = 2;
}
// Обработка разных режимов атаки
switch (this.attackMode.get()) {
case "FunTime":
if (this.attackTicks > 1) {
this.updateRotation(true, 50.0f, 25.0f);
this.attackTicks--;
} else {
this.resetRotation();
}
break;
case "Легит-Снап":
if (this.attackTicks > 0) {
if (Minecraft.player.isElytraFlying()) {
this.attackTicks--;
}
} else {
this.resetRotation();
}
break;
default:
if (!this.isRotating) {
this.updateRotation(false, 30.0f, 25.0f);
}
break;
}
if (this.canAttack() && this.attackTimer.hasTimeElapsed()) {
this.performAttack();
this.attackTicks = 2;
}
}
@Subscribe
private void onWalking(EventMotion event) {
if (currentTarget != null && !(this.autoPotion.isState() && this.autoPotion.isActive())) {
float yaw = KillAura.currentRotation.x;
float pitch = KillAura.currentRotation.y;
event.setYaw(yaw);
event.setPitch(pitch);
Minecraft.player.rotationYawHead = yaw;
Minecraft.player.renderYawOffset = yaw;
Minecraft.player.rotationPitchHead = pitch;
}
}
private void updateTarget() {
ArrayList<LivingEntity> validTargets = new ArrayList<>();
for (Entity entity : Minecraft.world.getAllEntities()) {
if (entity instanceof LivingEntity) {
LivingEntity livingEntity = (LivingEntity) entity;
if (this.isValidTarget(livingEntity)) {
validTargets.add(livingEntity);
}
}
}
if (validTargets.isEmpty()) {
currentTarget = null;
} else if (validTargets.size() == 1) {
currentTarget = validTargets.get(0);
} else {
// Сортировка целей по приоритету
validTargets.sort(Comparator
.comparingDouble(target -> {
if (target instanceof PlayerEntity) {
return -this.getEntityArmor((PlayerEntity) target);
}
return -target.getTotalArmorValue();
})
.thenComparing((target1, target2) ->
Double.compare(this.getEntityHealth(target1), this.getEntityHealth(target2))
)
.thenComparing((target1, target2) ->
Double.compare(Minecraft.player.getDistance(target1), Minecraft.player.getDistance(target2))
)
);
currentTarget = validTargets.get(0);
}
}
private void updateRotation(boolean shouldAttack, float yawSpeed, float pitchSpeed) {
Vector3d targetPos = currentTarget.getPositionVec().add(0.0,
MathHelper.clamp(1.1, 0.3, currentTarget.getHeight()), 0.0);
Vector3d direction = targetPos.subtract(Minecraft.player.getEyePosition(1.0f));
this.isRotating = true;
float targetYaw = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(direction.z, direction.x)) - 90.0);
float targetPitch = (float) (-Math.toDegrees(Math.atan2(direction.y, Math.hypot(direction.x, direction.z))));
float yawDifference = MathHelper.wrapDegrees(targetYaw - KillAura.currentRotation.x);
float pitchDifference = MathHelper.wrapDegrees(targetPitch - KillAura.currentRotation.y);
switch (this.attackMode.get()) {
case "Smooth":
this.handleSmoothRotation(shouldAttack, yawSpeed, pitchSpeed, yawDifference, pitchDifference, direction);
break;
case "FunTime":
this.handleFunTimeRotation(yawDifference, pitchDifference);
break;
case "SpookyTime":
this.handleSpookyTimeRotation(yawDifference, pitchDifference);
break;
default:
this.handleDefaultRotation(yawDifference, pitchDifference, yawSpeed, pitchSpeed);
break;
}
}
private void handleSmoothRotation(boolean shouldAttack, float yawSpeed, float pitchSpeed,
float yawDiff, float pitchDiff, Vector3d direction) {
float clampedYaw = Math.min(Math.max(Math.abs(yawDiff), 3.0f), yawSpeed * 25000.0f);
float clampedPitch = Math.min(Math.max(Math.abs(pitchDiff), 3.0f), pitchSpeed * 2.5f);
if (shouldAttack && this.selectedEntity != currentTarget &&
((Boolean)advancedOptions.getValueByName("Ускорение ротации").get()).booleanValue()) {
clampedYaw = Math.max(clampedYaw, 7.0f);
clampedPitch = Math.max(Math.abs(pitchDiff), 6.0f);
} else {
clampedPitch /= 1.8f;
}
// Расчет конечных углов поворота
float finalYaw = KillAura.currentRotation.x + (yawDiff > 0.0f ? clampedYaw : -clampedYaw);
float finalPitch = MathHelper.clamp(
KillAura.currentRotation.y + (pitchDiff > 0.0f ? clampedPitch : -clampedPitch),
-89.0f, 89.0f
);
// Применение GCD коррекции
double distance = Minecraft.player.getDistance(currentTarget);
float gcd = SensUtils.getGCDValue() * (distance < 3.5f ? 0.6f : 0.8f);
finalYaw -= (finalYaw - KillAura.currentRotation.x) % gcd;
finalPitch -= (finalPitch - KillAura.currentRotation.y) % gcd;
KillAura.currentRotation = new Vector2f(finalYaw, finalPitch);
this.lastYawSpeed = clampedYaw;
this.lastPitchSpeed = clampedPitch;
if (((Boolean)advancedOptions.getValueByName("Коррекция движения").get()).booleanValue()) {
Minecraft.player.rotationYawOffset = finalYaw;
}
}
private void handleFunTimeRotation(float yawDiff, float pitchDiff) {
float clampedYaw = Math.min(Math.max(Math.abs(yawDiff), 1.0f), 90.0f);
float clampedPitch = Math.min(Math.max(Math.abs(pitchDiff), 1.0f), 90.0f);
float finalYaw = KillAura.currentRotation.x + (yawDiff > 0.0f ? clampedYaw : -clampedYaw) * 1.2f +
ThreadLocalRandom.current().nextFloat(-3.0f, 3.0f);
float finalPitch = MathHelper.clamp(
KillAura.currentRotation.y + (pitchDiff > 0.0f ? clampedPitch : -clampedPitch) * 1.2f,
-70.0f, 70.0f
) + ThreadLocalRandom.current().nextFloat(-3.0f, 3.0f);
if (!this.canAttack()) {
finalYaw = KillAura.currentRotation.x + (Minecraft.player.rotationYaw - KillAura.currentRotation.x) / 4.0f +
ThreadLocalRandom.current().nextFloat(-1.5f, 1.5f);
finalPitch = MathHelper.clamp(
KillAura.currentRotation.y + (Minecraft.player.rotationPitch - KillAura.currentRotation.y) / 4.0f,
-70.0f, 70.0f
) + ThreadLocalRandom.current().nextFloat(-1.5f, 1.5f);
}
float gcd = SensUtils.getGCDValue();
finalYaw -= (finalYaw - KillAura.currentRotation.x) % gcd;
finalPitch -= (finalPitch - KillAura.currentRotation.y) % gcd;
KillAura.currentRotation = new Vector2f(finalYaw, finalPitch);
if (((Boolean)advancedOptions.getValueByName("Коррекция движения").get()).booleanValue()) {
Minecraft.player.rotationYawOffset = finalYaw;
}
}
private void handleSpookyTimeRotation(float yawDiff, float pitchDiff) {
Vector3d playerPos = Minecraft.player.getPositionVec();
Vector3d targetPos = currentTarget.getPositionVec();
float yawDifference = this.getYawDifference(playerPos, targetPos, Minecraft.player.rotationYaw);
float pitchDifference = this.getPitchDifference(playerPos, targetPos, Minecraft.player.rotationPitch);
if (Math.abs(yawDifference) <= 100.0f && Math.abs(pitchDifference) <= 40.0f) {
float clampedYaw = Math.min(Math.max(Math.abs(yawDiff), 0.0f), 90.0f);
float clampedPitch = Math.min(Math.max(Math.abs(pitchDiff), 0.0f), 90.0f);
float finalYaw = KillAura.currentRotation.x + (yawDiff > 0.0f ? clampedYaw : -clampedYaw);
float finalPitch = MathHelper.clamp(
KillAura.currentRotation.y + (pitchDiff > 0.0f ? clampedPitch : -clampedPitch),
-70.0f, 70.0f
);
float gcd = SensUtils.getGCDValue();
finalYaw -= (finalYaw - KillAura.currentRotation.x) % gcd;
finalPitch -= (finalPitch - KillAura.currentRotation.y) % gcd;
KillAura.currentRotation = new Vector2f(finalYaw, finalPitch);
if (((Boolean)advancedOptions.getValueByName("Коррекция движения").get()).booleanValue()) {
Minecraft.player.rotationYawOffset = finalYaw;
}
} else {
KillAura.currentRotation = new Vector2f(Minecraft.player.rotationYaw, Minecraft.player.rotationPitch);
if (((Boolean)advancedOptions.getValueByName("Коррекция движения").get()).booleanValue()) {
Minecraft.player.rotationYawOffset = Minecraft.player.rotationYaw;
}
}
}
private void handleDefaultRotation(float yawDiff, float pitchDiff, float yawSpeed, float pitchSpeed) {
// Базовая реализация ротации для других режимов
float clampedYaw = Math.min(Math.max(Math.abs(yawDiff), 0.0f), yawSpeed);
float clampedPitch = Math.min(Math.max(Math.abs(pitchDiff), 0.0f), pitchSpeed);
float finalYaw = KillAura.currentRotation.x + (yawDiff > 0.0f ? clampedYaw : -clampedYaw);
float finalPitch = MathHelper.clamp(
KillAura.currentRotation.y + (pitchDiff > 0.0f ? clampedPitch : -clampedPitch),
-89.0f, 89.0f
);
float gcd = SensUtils.getGCDValue();
finalYaw -= (finalYaw - KillAura.currentRotation.x) % gcd;
finalPitch -= (finalPitch - KillAura.currentRotation.y) % gcd;
KillAura.currentRotation = new Vector2f(finalYaw, finalPitch);
this.lastYawSpeed = clampedYaw;
this.lastPitchSpeed = clampedPitch;
}
private float getYawDifference(Vector3d from, Vector3d to, float currentYaw) {
double deltaX = to.x - from.x;
double deltaZ = to.z - from.z;
float targetYaw = (float) (Math.toDegrees(Math.atan2(deltaZ, deltaX)) - 90.0);
float difference = targetYaw - currentYaw;
return MathHelper.wrapDegrees(difference);
}
private float getPitchDifference(Vector3d from, Vector3d to, float currentPitch) {
double deltaX = to.x - from.x;
double deltaY = to.y + (currentTarget.getHeight() / 2.0f) - (from.y + Minecraft.player.getEyeHeight());
double deltaZ = to.z - from.z;
double horizontalDistance = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ);
float targetPitch = (float) (-Math.toDegrees(Math.atan2(deltaY, horizontalDistance)));
return MathHelper.wrapDegrees(targetPitch - currentPitch);
}
private void performAttack() {
if (!((Boolean)this.checkWallObstruction.get()).booleanValue() || this.canSeeTarget(currentTarget)) {
this.selectedEntity = MouseUtil.getMouseOver(currentTarget, KillAura.currentRotation.x,
KillAura.currentRotation.y, this.attackRange.get().floatValue());
if (((Boolean)advancedOptions.getValueByName("Ускорение ротации").get()).booleanValue()) {
this.updateRotation(true, 60.0f, 35.0f);
}
if (this.selectedEntity != null && this.selectedEntity == currentTarget || Minecraft.player.isElytraFlying()) {
if (Minecraft.player.isBlocking() && ((Boolean)advancedOptions.getValueByName("Отжимать щит").get()).booleanValue()) {
Minecraft.playerController.onStoppedUsingItem(Minecraft.player);
}
this.attackTimer.setLastMS(500L);
Minecraft.playerController.attackEntity(Minecraft.player, currentTarget);
Minecraft.player.swingArm(Hand.MAIN_HAND);
if (currentTarget instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) currentTarget;
if (((Boolean)advancedOptions.getValueByName("Ломать щит").get()).booleanValue()) {
this.breakPlayerShield(player);
}
}
}
}
}
private boolean canSeeTarget(Entity entity) {
ClientWorld world = Minecraft.world;
Vector3d eyePos = Minecraft.player.getEyePosition(1.0f);
Vector3d targetEyePos = entity.getEyePosition(1.0f);
BlockRayTraceResult result = world.rayTraceBlocks(
new RayTraceContext(eyePos, targetEyePos,
RayTraceContext.BlockMode.COLLIDER,
RayTraceContext.FluidMode.NONE,
Minecraft.player)
);
return result == null || result.getType() == RayTraceResult.Type.MISS;
}
private boolean canAttack() {
// Проверка условий для атаки
if (Minecraft.player.isInWater() && Minecraft.player.areEyesInFluid(FluidTags.WATER) ||
Minecraft.player.isInLava() ||
Minecraft.player.isOnLadder() ||
Minecraft.player.isPassenger() ||
Minecraft.player.abilities.isFlying) {
return false;
}
float attackStrength = Minecraft.player.getCooledAttackStrength(
((Boolean)advancedOptions.getValueByName("Синхроз с TPS").get()).booleanValue() ?
Vesence.getInstance().getTpsCalc().getAdjustTicks() : 1.5f
);
if (attackStrength < 0.92f) {
return false;
}
if (((Boolean)advancedOptions.getValueByName("Только криты").get()).booleanValue()) {
return !Minecraft.player.isOnGround() && Minecraft.player.fallDistance > 0.0f;
}
return true;
}
private boolean isValidTarget(LivingEntity entity) {
// Проверка на валидность цели
if (entity instanceof ClientPlayerEntity) {
return false;
}
float extraDistance = 0.0f;
float attackDistance = this.attackRange.get().floatValue();
// Корректировка дистанции для элитры
if (Minecraft.player.isElytraFlying() && !Minecraft.player.isInWater()) {
extraDistance = this.elytraDistance.get().floatValue();
attackDistance = this.elytraAttackRange.get().floatValue();
}
if (entity.ticksExisted < 3) {
return false;
}
if (Minecraft.player.getDistanceEyePos(entity) > (extraDistance + attackDistance) ||
Minecraft.player.getDistance(entity) > extraDistance + attackDistance) {
return false;
}
// Проверка типа entity
if (entity instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) entity;
if (AntiBot.isBot(entity)) {
return false;
}
if (!((Boolean)this.targetSettings.getValueByName("Друзья").get()).booleanValue() &&
FriendStorage.isFriend(player.getName().getString())) {
return false;
}
if (((Boolean)this.targetSettings.getValueByName("Люди из списка целей").get()).booleanValue() &&
!TargetStorage.isTarget(player.getName().getString())) {
return false;
}
if (player.getName().getString().equalsIgnoreCase(Minecraft.player.getName().getString())) {
return false;
}
}
// Проверка настроек целей
if (entity instanceof PlayerEntity && !((Boolean)this.targetSettings.getValueByName("Игроки").get()).booleanValue()) {
return false;
}
if (entity instanceof PlayerEntity && entity.getTotalArmorValue() == 0 &&
!((Boolean)this.targetSettings.getValueByName("Голые").get()).booleanValue()) {
return false;
}
if (entity instanceof PlayerEntity && entity.isInvisible() && entity.getTotalArmorValue() == 0 &&
!((Boolean)this.targetSettings.getValueByName("Голые невидимки").get()).booleanValue()) {
return false;
}
if (entity instanceof PlayerEntity && entity.isInvisible() &&
!((Boolean)this.targetSettings.getValueByName("Невидимки").get()).booleanValue()) {
return false;
}
if (entity instanceof MonsterEntity && !((Boolean)this.targetSettings.getValueByName("Мобы").get()).booleanValue()) {
return false;
}
if (entity instanceof AnimalEntity && !((Boolean)this.targetSettings.getValueByName("Животные").get()).booleanValue()) {
return false;
}
return !entity.isInvulnerable() && entity.isAlive() && !(entity instanceof ArmorStandEntity);
}
private void breakPlayerShield(PlayerEntity player) {
if (player.isBlocking()) {
int inventoryAxeSlot = InventoryUtil.getAxeInInventory(false);
int hotbarAxeSlot = InventoryUtil.getAxeInInventory(true);
if (hotbarAxeSlot == -1 && inventoryAxeSlot != -1) {
int bestSlot = InventoryUtil.findBestSlotInHotBar();
// Перемещение топора в горячую панель
Minecraft.playerController.windowClick(0, inventoryAxeSlot, 0, ClickType.PICKUP, Minecraft.player);
Minecraft.playerController.windowClick(0, bestSlot + 36, 0, ClickType.PICKUP, Minecraft.player);
Minecraft.player.connection.sendPacket(new CHeldItemChangePacket(bestSlot));
// Атака
Minecraft.playerController.attackEntity(Minecraft.player, player);
Minecraft.player.swingArm(Hand.MAIN_HAND);
// Возврат предметов
Minecraft.player.connection.sendPacket(new CHeldItemChangePacket(Minecraft.player.inventory.currentItem));
Minecraft.playerController.windowClick(0, bestSlot + 36, 0, ClickType.PICKUP, Minecraft.player);
Minecraft.playerController.windowClick(0, inventoryAxeSlot, 0, ClickType.PICKUP, Minecraft.player);
}
if (hotbarAxeSlot != -1) {
Minecraft.player.connection.sendPacket(new CHeldItemChangePacket(hotbarAxeSlot));
Minecraft.playerController.attackEntity(Minecraft.player, player);
Minecraft.player.swingArm(Hand.MAIN_HAND);
Minecraft.player.connection.sendPacket(new CHeldItemChangePacket(Minecraft.player.inventory.currentItem));
}
}
}
private void resetRotation() {
if (((Boolean)advancedOptions.getValueByName("Коррекция движения").get()).booleanValue()) {
Minecraft.player.rotationYawOffset = -2.1474836E9f;
}
KillAura.currentRotation = new Vector2f(Minecraft.player.rotationYaw, Minecraft.player.rotationPitch);
}
@Override
public boolean onEnable() {
super.onEnable();
this.resetRotation();
currentTarget = null;
return true;
}
@Override
public boolean onDisable() {
super.onDisable();
this.resetRotation();
this.attackTimer.setLastMS(0L);
currentTarget = null;
return true;
}
private double getEntityArmor(PlayerEntity player) {
double armorValue = 0.0;
for (int i = 0; i < 4; i++) {
ItemStack armorStack = player.inventory.armorInventory.get(i);
if (armorStack.getItem() instanceof ArmorItem) {
armorValue += this.getArmorProtectionLevel(armorStack);
}
}
return armorValue;
}
private double getArmorProtectionLevel(ItemStack stack) {
if (stack.getItem() instanceof ArmorItem) {
ArmorItem armor = (ArmorItem) stack.getItem();
double protection = armor.getDamageReduceAmount();
if (stack.isEnchanted()) {
protection += EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25;
}
return protection;
}
return 0.0;
}
private double getEntityHealth(LivingEntity entity) {
if (entity instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) entity;
return (player.getHealth() + player.getAbsorptionAmount()) * (this.getEntityArmor(player) / 20.0);
}
return entity.getHealth() + entity.getAbsorptionAmount();
}
// Геттеры для внешнего доступа
public ModeSetting getAttackMode() {
return this.attackMode;
}
public ModeListSetting getAdvancedOptions() {
return advancedOptions;
}
public StopWatch getAttackTimer() {
return this.attackTimer;
}
public static Vector2f getCurrentRotation() {
return currentRotation;
}
public static LivingEntity getCurrentTarget() {
return currentTarget;
}
}