Подписывайтесь на наш Telegram и не пропускайте важные новости! Перейти

Вопрос Помогите с Polar

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
22 Май 2025
Сообщения
34
Реакции
0
Сделал snap киллку когда вижу чела от первого лица удары идут а как только чел зади удары не проходят и режет урон помогите пж скажите как это фиксить
 
Сделал snap киллку когда вижу чела от первого лица удары идут а как только чел зади удары не проходят и режет урон помогите пж скажите как это фиксить
Снапы не бупас
 
Ты как ротацию сделал? Какие методы использовал? Если то о чем я думаю то скажу щас
ща 1 сек
Ты как ротацию сделал? Какие методы использовал? Если то о чем я думаю то скажу щас
polarSilentAttack()
polarSmoothRotation()
isTargetVisible()
handlePolarBehindAttack()
а чт
Снапы не бупас
о бустит
 
Последнее редактирование:
ща 1 сек

polarSilentAttack()
polarSmoothRotation()
isTargetVisible()
handlePolarBehindAttack()
а чт

о бустит
Ну ты гений сука... Я просил методы майна которые ты юзал... Которые через MinecraftClient.getInstance().
 
Ну ты гений сука... Я просил методы майна которые ты юзал... Которые через MinecraftClient.getInstance().
MinecraftClient.getInstance().player.setYaw()/setPitch()
MinecraftClient.getInstance().player.getYaw()/getPitch()
MinecraftClient.getInstance().player.networkHandler.sendPacket(new PlayerMoveC2SPacket.Full())
MinecraftClient.getInstance().player.getEyePos()
Math.toDegrees(Math.atan2())
MathHelper.clamp()/wrapDegrees() это?
дай кусок кода хотябы
ща
 
MinecraftClient.getInstance().player.setYaw()/setPitch()
MinecraftClient.getInstance().player.getYaw()/getPitch()
MinecraftClient.getInstance().player.networkHandler.sendPacket(new PlayerMoveC2SPacket.Full())
MinecraftClient.getInstance().player.getEyePos()
Math.toDegrees(Math.atan2())
MathHelper.clamp()/wrapDegrees() это?
Пакеты нельзя отправлять, нужно подменять, про setYaw setPitch странно вообще, никогда не видел чтобы их юзал кто то(они крутят камеру тоже). Если у тебя камеру не крутит, но голова от f5 крутится, то это визуальная ротация и сервер ее не видит. Чтобы сделать бупас фт тебе надо при повороте на какое то время задержаться на игроке, снапы сложно делать по фантайм, лучше плавную делай
 
Пакеты нельзя отправлять, нужно подменять, про setYaw setPitch странно вообще, никогда не видел чтобы их юзал кто то(они крутят камеру тоже). Если у тебя камеру не крутит, но голова от f5 крутится, то это визуальная ротация и сервер ее не видит. Чтобы сделать бупас фт тебе надо при повороте на какое то время задержаться на игроке, снапы сложно делать по фантайм, лучше плавную делай
да мне не на фт надо мне под raidmine а плавная кикается
 
дай кусок кода хотябы
сюда код скинуть или на диск
Так с фига ли polar тогда
polar кикнул
написалось polar.top/discord кажись
дай кусок кода хотябы

дай кусок кода хотябы
ну что?
 
Последнее редактирование:
сюда код скинуть или на диск

polar кикнул
написалось polar.top/discord кажись

package ru.levin.modules.combat;

import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.decoration.ArmorStandEntity;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.mob.Monster;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Items;
import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket;
import net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import net.minecraft.network.packet.c2s.play.UpdateSelectedSlotC2SPacket;
import net.minecraft.screen.slot.SlotActionType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import ru.levin.events.Event;
import ru.levin.events.impl.EventUpdate;
import ru.levin.events.impl.input.EventKeyBoard;
import ru.levin.events.impl.move.EventMotion;
import ru.levin.events.impl.player.EventSprint;
import ru.levin.manager.Manager;
import ru.levin.mixin.iface.ClientPlayerEntityAccessor;
import ru.levin.modules.Function;
import ru.levin.modules.FunctionAnnotation;
import ru.levin.modules.Type;
import ru.levin.modules.render.littlePet.GhostWolfEntity;
import ru.levin.modules.setting.BindBooleanSetting;
import ru.levin.modules.setting.BooleanSetting;
import ru.levin.modules.setting.ModeSetting;
import ru.levin.modules.setting.MultiSetting;
import ru.levin.modules.setting.SliderSetting;
import ru.levin.util.math.RayTraceUtil;
import ru.levin.util.move.MoveUtil;
import ru.levin.util.player.InventoryUtil;
import ru.levin.util.SensUtils;

import java.util.*;
import java.util.concurrent.ThreadLocalRandom;

import static net.minecraft.util.Hand.MAIN_HAND;

@SuppressWarnings("All")
@FunctionAnnotation(name = "AttackAura", type = Type.Combat)
public class AttackAura extends Function {

private final ModeSetting mode = new ModeSetting("Мод", "Raidmine Snap",
"ReallyWorld", "HollyWorld", "Snap", "Raidmine Snap", "KoopinAc", "1.8.8");

private final MultiSetting targets = new MultiSetting("Цели",
Arrays.asList("Игроки", "Мобы", "Монстры"),
new String[]{"Игроки", "Друзья", "Мобы", "Монстры", "Жители"});

private final MultiSetting setting = new MultiSetting("Настройки",
Arrays.asList("Ломать щит", "Отжим щита"),
new String[]{"Только критами", "Ломать щит", "Отжим щита", "Атаковать задом"});

private final SliderSetting distance = new SliderSetting("Радиус атаки", 4.0f, 1.8f, 6f, 0.1f);
private final SliderSetting rotateDistance = new SliderSetting("Радиус обнаружения", 6f, 0.0f, 10f, 0.1f);
private final SliderSetting snapSpeed = new SliderSetting("Скорость снапов", 150, 50, 300, 50f, () -> mode.is("Snap"));
private final SliderSetting raidmineDelay = new SliderSetting("Задержка атаки", 50, 0, 500, 10, () -> mode.is("Raidmine Snap"));
private final SliderSetting raidmineSmoothness = new SliderSetting("Плавность", 0.3f, 0.1f, 1.0f, 0.1f, () -> mode.is("Raidmine Snap"));
private final BooleanSetting raidminePredict = new BooleanSetting("Предсказывать движение", true, () -> mode.is("Raidmine Snap"));

private final BooleanSetting bypassRotation = new BooleanSetting("Обходная ротация", true);
private final SliderSetting minRotationSpeed = new SliderSetting("Мин скорость", 50f, 10f, 150f, 5f, () -> bypassRotation.get());
private final SliderSetting maxRotationSpeed = new SliderSetting("Макс скорость", 250f, 100f, 360f, 10f, () -> bypassRotation.get());
private final SliderSetting accuracyOffset = new SliderSetting("Смещение от цели", 5f, 0f, 20f, 0.5f, () -> bypassRotation.get());
private final SliderSetting pullBackAmount = new SliderSetting("Отвод прицела", 10f, 5f, 30f, 1f, () -> bypassRotation.get());

private final BooleanSetting polarBypass = new BooleanSetting("Обход Polar", true);
private final SliderSetting polarMaxAngle = new SliderSetting("Макс угол Polar", 60f, 30f, 90f, 5f, () -> polarBypass.get());
private final BooleanSetting polarSilentAim = new BooleanSetting("Silent Aim", true, () -> polarBypass.get());

// НОВОЕ: синхронизация движения и поворота
private final BooleanSetting syncMovement = new BooleanSetting("Синхронизация движения", true);
private final SliderSetting syncThreshold = new SliderSetting("Порог синхронизации", 45f, 10f, 90f, 5f, () -> syncMovement.get());

private final BindBooleanSetting onlySpaceCritical = new BindBooleanSetting("Только с пробелом", false, () -> setting.get("Только критами"));
private final BooleanSetting noAttackIfEat = new BooleanSetting("Не бить если ешь", true);
private final BooleanSetting raycast = new BooleanSetting("Проверять наведение", false);
private final ModeSetting sprintreset = new ModeSetting("Тип спринта", "Legit", "Rage", "Legit", "None");
private final SliderSetting rotationSpeed = new SliderSetting("Скорость поворота", 250f, 30f, 360f, 10f);
public final BooleanSetting correction = new BooleanSetting("Коррекция", true);
public final ModeSetting correctionType = new ModeSetting(() -> correction.get(), "Тип коррекции", "Free", "Free", "Focus");

public LivingEntity target = null;
private long cpsLimit = 0L;
private long lastHitMs = 0L;
private long raidmineLastAttack = 0L;
private long raidmineLastRotate = 0L;
private boolean raidmineAttackReady = true;
private boolean raidmineWasRotating = false;
private float raidmineLastYaw = 0f;
private float raidmineLastPitch = 0f;
private float currentRotationSpeed = 180f;
private int speedChangeTicks = 0;
private int speedChangeInterval = 0;
private float rotationDirection = 1f;
private float lastAttackYaw = 0f;
private float lastAttackPitch = 0f;
private boolean wasAttacking = false;
private int pullBackTicks = 0;
private float pullBackYaw = 0f;
private float pullBackPitch = 0f;
private boolean polarWasBehind = false;
private float polarVisualYaw = 0f;
private float polarVisualPitch = 0f;

// НОВОЕ: переменные для синхронизации
private float lastMovementYaw = 0f;
private boolean wasMoving = false;

public AttackAura() {
addSettings(mode, targets, setting, distance, rotateDistance, snapSpeed, raidmineDelay, raidmineSmoothness,
raidminePredict, bypassRotation, minRotationSpeed, maxRotationSpeed, accuracyOffset, pullBackAmount,
polarBypass, polarMaxAngle, polarSilentAim, syncMovement, syncThreshold, sprintreset, onlySpaceCritical,
noAttackIfEat, raycast, rotationSpeed, correction, correctionType);
}

@override
public void onEvent(Event event) {
ClientPlayerEntity player = mc.player;
if (player == null || player.isDead()) {
target = null;
resetState();
return;
}

if (event instanceof EventKeyBoard e && correction.get() && correctionType.is("Free")) {
MoveUtil.fixMovement(e, Manager.ROTATION.getYaw());
}

if (event instanceof EventSprint sprint && sprintreset.is("Legit") && canAttack() && target != null && player.isSprinting()) {
sprint.setSprinting(false);
}

if (event instanceof EventUpdate) {
if (bypassRotation.get()) updateRandomSpeed();

if (target == null || !isValidTarget(target) || target.isDead() || !target.isAlive()) {
target = findTarget();
}

if (target == null) {
Manager.ROTATION.set(player.getYaw(), player.getPitch());
cpsLimit = System.currentTimeMillis();
resetState();
return;
}

handleAttackAndRotation(target);
}

if (event instanceof EventMotion motion) {
if (mode.is("Raidmine Snap") && raidmineWasRotating && System.currentTimeMillis() - raidmineLastAttack > 200) {
motion.setYaw(player.getYaw());
motion.setPitch(player.getPitch());
raidmineWasRotating = false;
} else {
motion.setYaw(Manager.ROTATION.getYaw());
motion.setPitch(Manager.ROTATION.getPitch());
}
}
}

private void resetState() {
raidmineAttackReady = true;
raidmineWasRotating = false;
wasAttacking = false;
pullBackTicks = 0;
polarWasBehind = false;
}

private void updateRandomSpeed() {
speedChangeTicks++;
if (speedChangeInterval == 0) speedChangeInterval = ThreadLocalRandom.current().nextInt(3, 6);

if (speedChangeTicks >= speedChangeInterval) {
currentRotationSpeed = ThreadLocalRandom.current().nextFloat() *
(maxRotationSpeed.get().floatValue() - minRotationSpeed.get().floatValue()) + minRotationSpeed.get().floatValue();

if (ThreadLocalRandom.current().nextFloat() < 0.3f) rotationDirection *= -1f;
speedChangeTicks = 0;
speedChangeInterval = ThreadLocalRandom.current().nextInt(3, 6);
}
}

@override
protected void onEnable() {
super.onEnable();
raidmineAttackReady = true;
raidmineLastYaw = mc.player.getYaw();
raidmineLastPitch = mc.player.getPitch();
currentRotationSpeed = rotationSpeed.get().floatValue();
polarVisualYaw = mc.player.getYaw();
polarVisualPitch = mc.player.getPitch();
}

@override
protected void onDisable() {
target = null;
cpsLimit = System.currentTimeMillis();
resetState();
super.onDisable();
}

// НОВЫЙ МЕТОД: проверка синхронизации движения
private boolean checkMovementSync(float targetYaw) {
if (!syncMovement.get() || mc.player == null) return true;

float currentYaw = Manager.ROTATION.getYaw();
float movementAngle = getMovementAngle();

// Если игрок движется
if (movementAngle >= 0) {
float yawDiff = Math.abs(MathHelper.wrapDegrees(targetYaw - movementAngle));

// Если разница между целевым поворотом и направлением движения слишком большая
if (yawDiff > syncThreshold.get().floatValue()) {
// Корректируем целевой поворот ближе к направлению движения
float correctedYaw = movementAngle + (yawDiff > 180 ? -syncThreshold.get().floatValue()/2 : syncThreshold.get().floatValue()/2);
Manager.ROTATION.set(correctedYaw, Manager.ROTATION.getPitch());
return false;
}
}
return true;
}

private float getMovementAngle() {
if (mc.player == null) return -1f;

float forward = mc.player.input.movementForward;
float sideways = mc.player.input.movementSideways;

if (Math.abs(forward) < 0.1f && Math.abs(sideways) < 0.1f) return -1f;

float baseYaw = mc.player.getYaw();
if (forward > 0) {
if (sideways > 0) return baseYaw - 45f; // Вперед-вправо
else if (sideways < 0) return baseYaw + 45f; // Вперед-влево
else return baseYaw; // Прямо
} else if (forward < 0) {
if (sideways > 0) return baseYaw - 135f; // Назад-вправо
else if (sideways < 0) return baseYaw + 135f; // Назад-влево
else return baseYaw + 180f; // Назад
} else {
if (sideways > 0) return baseYaw - 90f; // Вправо
else return baseYaw + 90f; // Влево
}
}

private boolean isTargetVisible(LivingEntity entity) {
if (entity == null) return false;
float angle = getAngleToTarget(entity);
if (polarBypass.get()) return angle <= polarMaxAngle.get().floatValue();
return angle <= 120f;
}

private boolean isValidTarget(LivingEntity entity) {
if (entity == null || entity.isDead() || !entity.isAlive() || entity == mc.player) return false;
double dist = mc.player.distanceTo(entity);
double attackRange = distance.get().doubleValue();
double detectRange = rotateDistance.get().doubleValue();
if (dist > attackRange && (detectRange <= 0 || dist > detectRange)) return false;
if (Manager.FUNCTION_MANAGER.antiBot.check(entity)) return false;

if (entity instanceof PlayerEntity) {
if (!targets.get("Игроки")) return false;
if (!targets.get("Друзья") && Manager.FRIEND_MANAGER.isFriend(entity.getName().getString())) return false;
} else if (entity instanceof VillagerEntity && !targets.get("Жители")) return false;
else if (entity instanceof MobEntity || entity instanceof AnimalEntity) {
if (!targets.get("Мобы")) return false;
} else if (entity instanceof Monster && !targets.get("Монстры")) return false;

if (entity instanceof ArmorStandEntity) return false;
if (Manager.FUNCTION_MANAGER.littleSnickers.state && (entity instanceof GhostWolfEntity)) return false;
return true;
}

private LivingEntity findTarget() {
LivingEntity closest = null;
double closestDist = Double.MAX_VALUE;
for (Entity e : mc.world.getEntities()) {
if (e instanceof LivingEntity le && isValidTarget(le)) {
double dist = mc.player.distanceTo(le);
if (dist < closestDist) {
closestDist = dist;
closest = le;
}
}
}
return closest;
}

private void handleAttackAndRotation(LivingEntity t) {
if (t == null) return;
boolean isVisible = isTargetVisible(t);
boolean canAttackNow = shouldAttack(t);
boolean passRay = !raycast.get() || RayTraceUtil.getMouseOver(t, Manager.ROTATION.getYaw(), Manager.ROTATION.getPitch(), distance.get().floatValue()) == t;

if (polarBypass.get() && !isVisible && canAttackNow) {
handlePolarBehindAttack(t);
return;
}

if (mode.is("KoopinAc") || mode.is("1.8.8")) {
koopinVector(t, true);
if (canAttackNow) attackTarget(mc.player);
return;
}

if (mode.is("Snap")) {
if (canAttackNow && canAttack()) {
attackTarget(mc.player);
lastHitMs = System.currentTimeMillis();
}
if (System.currentTimeMillis() - lastHitMs < (long) snapSpeed.get().floatValue()) {
setRotation(t, true);
} else {
Manager.ROTATION.set(mc.player.getYaw(), mc.player.getPitch());
}
return;
}

if (mode.is("Raidmine Snap")) {
handleRaidmineSnap(t, canAttackNow, passRay);
return;
}

if (mode.is("HollyWorld")) {
if (canAttackNow && canAttack()) {
hollyworld(t, true);
attackTarget(mc.player);
} else {
hollyworld(t, false);
}
return;
}

if (canAttackNow) attackTarget(mc.player);
setRotation(t, true);
}

private void handlePolarBehindAttack(LivingEntity t) {
boolean canAttackNow = shouldAttack(t);
if (System.currentTimeMillis() - raidmineLastRotate > 50) {
polarSmoothRotation(t);
raidmineLastRotate = System.currentTimeMillis();
}

boolean attackDelayPassed = System.currentTimeMillis() - raidmineLastAttack >= raidmineDelay.get().longValue();
boolean inAttackRange = mc.player.distanceTo(t) <= distance.get().floatValue();
boolean attackReady = canAttack() && inAttackRange;
float angle = getAngleToTarget(t);
boolean canAttackFromBehind = angle <= polarMaxAngle.get().floatValue() * 1.5f;

if (canAttackNow && attackDelayPassed && raidmineAttackReady && attackReady && canAttackFromBehind) {
if (polarSilentAim.get()) {
polarSilentAttack(t);
} else {
attackEntityDirectly(t);
}
raidmineLastAttack = System.currentTimeMillis();
raidmineAttackReady = false;
raidmineWasRotating = true;
polarWasBehind = true;
} else {
raidmineAttackReady = true;
}
}

private void polarSmoothRotation(LivingEntity entity) {
if (entity == null) return;
Vec3d targetPos = entity.getBoundingBox().getCenter();
Vec3d eyes = mc.player.getEyePos();
double diffX = targetPos.x - eyes.x;
double diffY = targetPos.y - eyes.y;
double diffZ = targetPos.z - eyes.z;
double dist = Math.sqrt(diffX * diffX + diffZ * diffZ);
float targetYaw = (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F;
float targetPitch = (float) -Math.toDegrees(Math.atan2(diffY, dist));
targetPitch = MathHelper.clamp(targetPitch, -89.9f, 89.9f);

// ПРОВЕРКА СИНХРОНИЗАЦИИ ДВИЖЕНИЯ
if (!checkMovementSync(targetYaw)) return;

float currentYaw = Manager.ROTATION.getYaw();
float currentPitch = Manager.ROTATION.getPitch();
float yawDelta = MathHelper.wrapDegrees(targetYaw - currentYaw);
float pitchDelta = targetPitch - currentPitch;
float speedMultiplier = 0.3f;
float effectiveSpeed = rotationSpeed.get().floatValue() * speedMultiplier;
float tickDelta = mc.getRenderTickCounter().getTickDelta(true);
float maxDelta = effectiveSpeed * tickDelta / 20f;
float yawChange = MathHelper.clamp(yawDelta, -maxDelta, maxDelta);
float pitchChange = MathHelper.clamp(pitchDelta, -maxDelta/2, maxDelta/2);
float newYaw = currentYaw + yawChange;
float newPitch = currentPitch + pitchChange;
newPitch = MathHelper.clamp(newPitch, -89.9f, 89.9f);
Manager.ROTATION.set(newYaw, newPitch);
}

private void polarSilentAttack(LivingEntity entity) {
if (entity == null || mc.player == null) return;
if (sprintreset.is("Rage") || sprintreset.is("Legit")) {
if (mc.player.isSprinting()) {
mc.player.networkHandler.sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.STOP_SPRINTING));
mc.player.setSprinting(false);
}
}

Vec3d targetPos = entity.getBoundingBox().getCenter();
Vec3d eyes = mc.player.getEyePos();
double diffX = targetPos.x - eyes.x;
double diffY = targetPos.y - eyes.y;
double diffZ = targetPos.z - eyes.z;
double dist = Math.sqrt(diffX * diffX + diffZ * diffZ);
float targetYaw = (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F;
float targetPitch = (float) -Math.toDegrees(Math.atan2(diffY, dist));
targetPitch = MathHelper.clamp(targetPitch, -89.9f, 89.9f);

float visualYaw = mc.player.getYaw();
float visualPitch = mc.player.getPitch();

mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.Full(
mc.player.getX(), mc.player.getY(), mc.player.getZ(),
targetYaw, targetPitch, mc.player.isOnGround(), true));

mc.interactionManager.attackEntity(mc.player, entity);
mc.player.swingHand(MAIN_HAND);
if (setting.get("Ломать щит")) shieldBreaker(false);
if (setting.get("Отжим щита") && mc.player.isBlocking()) {
mc.interactionManager.stopUsingItem(mc.player);
}

mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.Full(
mc.player.getX(), mc.player.getY(), mc.player.getZ(),
visualYaw, visualPitch, mc.player.isOnGround(), true));
}

private void handleRaidmineSnap(LivingEntity t, boolean canAttackNow, boolean passRay) {
boolean isVisible = isTargetVisible(t);
if (polarBypass.get() && !isVisible && canAttackNow) {
handlePolarBehindAttack(t);
return;
}

if (System.currentTimeMillis() - raidmineLastRotate > 50) {
if (bypassRotation.get()) {
bypassRotation(t, canAttackNow && isVisible);
} else {
raidmineSmoothRotation(t);
}
raidmineLastRotate = System.currentTimeMillis();
}

boolean attackDelayPassed = System.currentTimeMillis() - raidmineLastAttack >= raidmineDelay.get().longValue();
boolean inAttackRange = mc.player.distanceTo(t) <= distance.get().floatValue();
boolean attackReady = canAttack() && inAttackRange;

if (canAttackNow && attackDelayPassed && raidmineAttackReady && attackReady && isVisible) {
float angleToTarget = getAngleToTarget(t);
if (setting.get("Атаковать задом") || angleToTarget < 90.0f) {
if (bypassRotation.get()) saveRotationForPullBack();
attackEntityDirectly(t);
raidmineLastAttack = System.currentTimeMillis();
raidmineAttackReady = false;
raidmineWasRotating = true;
if (bypassRotation.get()) {
startPullBack();
wasAttacking = true;
}
}
} else {
raidmineAttackReady = true;
wasAttacking = false;
}

if (!canAttackNow && mc.player.input.movementForward > 0 && !mc.player.isUsingItem() && !mc.player.isSprinting()) {
if (sprintreset.is("Rage") || sprintreset.is("Legit")) {
mc.player.networkHandler.sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.START_SPRINTING));
mc.player.setSprinting(true);
}
}
}

private void bypassRotation(LivingEntity entity, boolean canAttackNow) {
if (entity == null) return;
if (pullBackTicks > 0) {
handlePullBack();
return;
}

Vec3d targetPos = entity.getBoundingBox().getCenter();
Vec3d eyes = mc.player.getEyePos();
double diffX = targetPos.x - eyes.x;
double diffY = targetPos.y - eyes.y;
double diffZ = targetPos.z - eyes.z;
double dist = Math.sqrt(diffX * diffX + diffZ * diffZ);
float targetYaw = (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F;
float targetPitch = (float) -Math.toDegrees(Math.atan2(diffY, dist));
targetPitch = MathHelper.clamp(targetPitch, -89.9f, 89.9f);

// ПРОВЕРКА СИНХРОНИЗАЦИИ ДВИЖЕНИЯ
if (!checkMovementSync(targetYaw)) return;

float currentYaw = Manager.ROTATION.getYaw();
float currentPitch = Manager.ROTATION.getPitch();
float yawDelta = MathHelper.wrapDegrees(targetYaw - currentYaw);
float pitchDelta = targetPitch - currentPitch;
float direction = yawDelta > 0 ? 1f : -1f;
if (wasAttacking) {
direction = rotationDirection;
wasAttacking = false;
}

float speedMultiplier = canAttackNow ? 2.0f : 0.5f;
float effectiveSpeed = currentRotationSpeed * speedMultiplier;
float offsetMultiplier = canAttackNow ? 0f : accuracyOffset.get().floatValue() / 100f;
float randomOffset = (ThreadLocalRandom.current().nextFloat() * 2f - 1f) * offsetMultiplier * 30f;
float tickDelta = mc.getRenderTickCounter().getTickDelta(true);
float maxDelta = effectiveSpeed * tickDelta / 20f;
float yawChange = direction * maxDelta + randomOffset;
float pitchChange = pitchDelta * 0.3f;
float newYaw = currentYaw + yawChange;
float newPitch = currentPitch + pitchChange;
newPitch = MathHelper.clamp(newPitch, -89.9f, 89.9f);
rotationDirection = direction;
Manager.ROTATION.set(newYaw, newPitch);
}

private void saveRotationForPullBack() {
lastAttackYaw = Manager.ROTATION.getYaw();
lastAttackPitch = Manager.ROTATION.getPitch();
}

private void startPullBack() {
pullBackTicks = 10;
float pullBack = ThreadLocalRandom.current().nextFloat() * pullBackAmount.get().floatValue();
pullBackYaw = lastAttackYaw + (rotationDirection * pullBack);
pullBackPitch = lastAttackPitch + (ThreadLocalRandom.current().nextFloat() * 10f - 5f);
pullBackPitch = MathHelper.clamp(pullBackPitch, -89.9f, 89.9f);
}

private void handlePullBack() {
float currentYaw = Manager.ROTATION.getYaw();
float currentPitch = Manager.ROTATION.getPitch();
float progress = 1f - (pullBackTicks / 10f);
float newYaw = currentYaw + (pullBackYaw - currentYaw) * progress;
float newPitch = currentPitch + (pullBackPitch - currentPitch) * progress;
newPitch = MathHelper.clamp(newPitch, -89.9f, 89.9f);
Manager.ROTATION.set(newYaw, newPitch);
pullBackTicks--;
if (pullBackTicks <= 0) pullBackTicks = 0;
}

private void attackEntityDirectly(LivingEntity entity) {
if (entity == null || mc.player == null) return;
if (sprintreset.is("Rage") || sprintreset.is("Legit")) {
if (mc.player.isSprinting()) {
mc.player.networkHandler.sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.STOP_SPRINTING));
mc.player.setSprinting(false);
}
}

float originalYaw = mc.player.getYaw();
float originalPitch = mc.player.getPitch();
float originalRotYaw = Manager.ROTATION.getYaw();
float originalRotPitch = Manager.ROTATION.getPitch();

Vec3d targetPos = entity.getBoundingBox().getCenter();
Vec3d eyes = mc.player.getEyePos();
double diffX = targetPos.x - eyes.x;
double diffY = targetPos.y - eyes.y;
double diffZ = targetPos.z - eyes.z;
double dist = Math.sqrt(diffX * diffX + diffZ * diffZ);
float targetYaw = (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F;
float targetPitch = (float) -Math.toDegrees(Math.atan2(diffY, dist));
targetPitch = MathHelper.clamp(targetPitch, -89.9f, 89.9f);

mc.player.setYaw(targetYaw);
mc.player.setPitch(targetPitch);
Manager.ROTATION.set(targetYaw, targetPitch);

mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.Full(
mc.player.getX(), mc.player.getY(), mc.player.getZ(),
targetYaw, targetPitch, mc.player.isOnGround(), true));

mc.interactionManager.attackEntity(mc.player, entity);
mc.player.swingHand(MAIN_HAND);
if (setting.get("Ломать щит")) shieldBreaker(false);
if (setting.get("Отжим щита") && mc.player.isBlocking()) {
mc.interactionManager.stopUsingItem(mc.player);
}

mc.player.setYaw(originalYaw);
mc.player.setPitch(originalPitch);
Manager.ROTATION.set(originalRotYaw, originalRotPitch);

mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.Full(
mc.player.getX(), mc.player.getY(), mc.player.getZ(),
originalYaw, originalPitch, mc.player.isOnGround(), true));
}

private float getAngleToTarget(LivingEntity target) {
if (mc.player == null || target == null) return 180f;
Vec3d eyes = mc.player.getEyePos();
Vec3d targetPos = target.getBoundingBox().getCenter();
Vec3d lookVec = mc.player.getRotationVec(1.0F);
Vec3d targetVec = targetPos.subtract(eyes).normalize();
double dot = lookVec.dotProduct(targetVec);
return (float) Math.toDegrees(Math.acos(Math.min(1.0, Math.max(-1.0, dot))));
}

private void raidmineSmoothRotation(LivingEntity entity) {
if (entity == null) return;
Vec3d targetPos = entity.getBoundingBox().getCenter();
Vec3d eyes = mc.player.getEyePos();
double diffX = targetPos.x - eyes.x;
double diffY = targetPos.y - eyes.y;
double diffZ = targetPos.z - eyes.z;
double dist = Math.sqrt(diffX * diffX + diffZ * diffZ);
float targetYaw = (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F;
float targetPitch = (float) -Math.toDegrees(Math.atan2(diffY, dist));
targetPitch = MathHelper.clamp(targetPitch, -89.9f, 89.9f);

// ПРОВЕРКА СИНХРОНИЗАЦИИ ДВИЖЕНИЯ
if (!checkMovementSync(targetYaw)) return;

float smoothing = raidmineSmoothness.get().floatValue();
float currentYaw = Manager.ROTATION.getYaw();
float currentPitch = Manager.ROTATION.getPitch();
float yawDelta = MathHelper.wrapDegrees(targetYaw - currentYaw);
float pitchDelta = targetPitch - currentPitch;
float maxRotationSpeed = rotationSpeed.get().floatValue();
float tickDelta = mc.getRenderTickCounter().getTickDelta(true);
float maxDeltaPerTick = maxRotationSpeed * tickDelta / 20f;
yawDelta = MathHelper.clamp(yawDelta, -maxDeltaPerTick, maxDeltaPerTick);
pitchDelta = MathHelper.clamp(pitchDelta, -maxDeltaPerTick / 2, maxDeltaPerTick / 2);
float newYaw = currentYaw + yawDelta * (1.0f - smoothing);
float newPitch = currentPitch + pitchDelta * (1.0f - smoothing);
newPitch = MathHelper.clamp(newPitch, -89.9f, 89.9f);
raidmineLastYaw = newYaw;
raidmineLastPitch = newPitch;
Manager.ROTATION.set(newYaw, newPitch);
}

private void setRotation(LivingEntity entity, boolean applyGcd) {
if (entity == null) return;
Vec3d targetPos = entity.getBoundingBox().getCenter();
Vec3d eyes = mc.player.getEyePos();
double diffX = targetPos.x - eyes.x;
double diffY = targetPos.y - eyes.y;
double diffZ = targetPos.z - eyes.z;
double dist = Math.sqrt(diffX * diffX + diffZ * diffZ);
float targetYaw = (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F;
float targetPitch = (float) -Math.toDegrees(Math.atan2(diffY, dist));
targetPitch = MathHelper.clamp(targetPitch, -89.9f, 89.9f);

// ПРОВЕРКА СИНХРОНИЗАЦИИ ДВИЖЕНИЯ
if (!checkMovementSync(targetYaw)) return;

float currentYaw = Manager.ROTATION.getYaw();
float currentPitch = Manager.ROTATION.getPitch();
float maxSpeed = rotationSpeed.get().floatValue();
float tickDelta = mc.getRenderTickCounter().getTickDelta(true);
float maxDelta = maxSpeed * tickDelta / 20f;
float yawDiff = MathHelper.wrapDegrees(targetYaw - currentYaw);
float pitchDiff = targetPitch - currentPitch;
float yawChange = MathHelper.clamp(yawDiff, -maxDelta, maxDelta);
float pitchChange = MathHelper.clamp(pitchDiff, -maxDelta/2, maxDelta/2);
if (mc.player.distanceTo(entity) < 3.0f) {
yawChange = yawDiff * 0.8f;
pitchChange = pitchDiff * 0.8f;
}
float newYaw = currentYaw + yawChange;
float newPitch = currentPitch + pitchChange;
if (applyGcd) {
float gcd = SensUtils.getGCDValue();
newYaw -= (newYaw - currentYaw) % gcd;
newPitch -= (newPitch - currentPitch) % gcd;
}
newPitch = MathHelper.clamp(newPitch, -89.9f, 89.9f);
Manager.ROTATION.set(newYaw, newPitch);
}

private void koopinVector(LivingEntity entity, boolean attackContext) {
if (entity == null) return;
Vec3d targetPos = entity.getBoundingBox().getCenter();
Vec3d eyes = mc.player.getEyePos();
double diffX = targetPos.x - eyes.x;
double diffY = targetPos.y - eyes.y;
double diffZ = targetPos.z - eyes.z;
double dist = Math.sqrt(diffX * diffX + diffZ * diffZ);
float targetYaw = (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F;
float targetPitch = (float) -Math.toDegrees(Math.atan2(diffY, dist));
float currentYaw = Manager.ROTATION.getYaw();
float currentPitch = Manager.ROTATION.getPitch();
float yawDelta = MathHelper.wrapDegrees(targetYaw - currentYaw);
float pitchDelta = targetPitch - currentPitch;
float addYaw = Math.min(Math.max(Math.abs(yawDelta), 1), 80);
if (Math.abs(addYaw) <= 3.0f) addYaw = 3.1f;
float addPitch = Math.max(attackContext ? Math.abs(pitchDelta) : 1.0f, 2.0f);
float ny = currentYaw + (yawDelta > 0 ? addYaw : -addYaw);
float np = MathHelper.clamp(currentPitch + (pitchDelta > 0 ? addPitch : -addPitch), -90.0f, 90.0f);
Manager.ROTATION.set(ny, np);
}

private void hollyworld(LivingEntity entity, boolean force) {
if (entity == null) return;
Vec3d targetPos = entity.getBoundingBox().getCenter();
Vec3d eyes = mc.player.getEyePos();
double diffX = targetPos.x - eyes.x;
double diffY = targetPos.y - eyes.y;
double diffZ = targetPos.z - eyes.z;
double dist = Math.sqrt(diffX * diffX + diffZ * diffZ);
float targetYaw = (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F;
float targetPitch = (float) -Math.toDegrees(Math.atan2(diffY, dist));
if (force) {
Manager.ROTATION.set(targetYaw, MathHelper.clamp(targetPitch, -89.9f, 89.9f));
} else {
Manager.ROTATION.setSmooth(targetYaw, targetPitch, 0.25f, 45f, 12f, true);
}
}

public void attackTarget(PlayerEntity player) {
if (target == null) return;
boolean sprintStop = false;
boolean canStartSprint = mc.player.input.movementForward > 0
&& !mc.player.hasStatusEffect(StatusEffects.BLINDNESS)
&& !mc.player.isGliding()
&& !mc.player.isUsingItem()
&& !mc.player.horizontalCollision
&& mc.player.getHungerManager().getFoodLevel() > 6
&& !mc.player.isSneaking();

if (setting.get("Отжим щита") && mc.player.isBlocking()) {
mc.interactionManager.stopUsingItem(mc.player);
}

if (sprintreset.is("Legit")) {
if (mc.player.isSprinting() || canAttack()) {
if (mc.player.isSprinting()) return;
}
}

if (sprintreset.is("Rage")) {
if (((ClientPlayerEntityAccessor) mc.player).getLastSprinting()) {
mc.player.networkHandler.sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.STOP_SPRINTING));
mc.player.setSprinting(false);
sprintStop = true;
}
}

cpsLimit = System.currentTimeMillis() + 500L;
mc.interactionManager.attackEntity(player, target);
mc.player.swingHand(MAIN_HAND);
if (setting.get("Ломать щит")) shieldBreaker(false);
if (sprintreset.is("Rage") && sprintStop && canStartSprint) {
if (((ClientPlayerEntityAccessor) mc.player).getLastSprinting()) {
mc.player.networkHandler.sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.START_SPRINTING));
mc.player.setSprinting(true);
}
}
}

private boolean shouldAttack(LivingEntity e) {
if (e == null || cpsLimit > System.currentTimeMillis()) return false;
double dist = mc.player.distanceTo(e);
if (dist > distance.get().doubleValue()) return false;
return canAttack();
}

private boolean canAttack() {
if (noAttackIfEat.get() && mc.player.isUsingItem() && !mc.player.getActiveItem().isOf(Items.SHIELD)) return false;
float attackCooldown = mc.player.getAttackCooldownProgress(mc.getRenderTickCounter().getTickDelta(true));
if (!(mc.player.getMainHandStack().isOf(Items.MACE)) && attackCooldown < 0.85F) return false;
boolean restrict = mc.player.hasStatusEffect(StatusEffects.BLINDNESS)
|| mc.player.hasStatusEffect(StatusEffects.LEVITATION)
|| mc.player.hasStatusEffect(StatusEffects.SLOW_FALLING)
|| mc.player.isInLava()
|| mc.player.inPowderSnow
|| mc.player.isClimbing()
|| mc.player.hasVehicle()
|| mc.player.getAbilities().flying
|| (mc.player.isInFluid() && !mc.options.jumpKey.isPressed())
|| MoveUtil.isInWeb();
boolean needSpace = onlySpaceCritical.get()
&& mc.player.isOnGround()
&& !mc.options.jumpKey.isPressed();
if (setting.get("Только критами") && !restrict) {
return needSpace || (!mc.player.isOnGround() && mc.player.fallDistance > 0.0f);
}
return true;
}

private boolean shieldBreaker(boolean instant) {
int axeSlot = InventoryUtil.getAxe().slot();
if (axeSlot == -1) return false;
if (!(target instanceof PlayerEntity)) return false;
if (!((PlayerEntity) target).isUsingItem() && !instant) return false;
if (((PlayerEntity) target).getOffHandStack().getItem() != Items.SHIELD
&& ((PlayerEntity) target).getMainHandStack().getItem() != Items.SHIELD) return false;

if (axeSlot >= 9) {
mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, axeSlot, mc.player.getInventory().selectedSlot, SlotActionType.SWAP, mc.player);
mc.getNetworkHandler().sendPacket(new CloseHandledScreenC2SPacket(mc.player.currentScreenHandler.syncId));
mc.interactionManager.attackEntity(mc.player, target);
mc.player.swingHand(Hand.MAIN_HAND);
mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, axeSlot, mc.player.getInventory().selectedSlot, SlotActionType.SWAP, mc.player);
mc.getNetworkHandler().sendPacket(new CloseHandledScreenC2SPacket(mc.player.currentScreenHandler.syncId));
} else {
mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(axeSlot));
mc.interactionManager.attackEntity(mc.player, target);
mc.player.swingHand(Hand.MAIN_HAND);
mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(mc.player.getInventory().selectedSlot));
}
return true;
}
}

ну что?
1770291412982.png

замечательная кнопка есть, многие её игнорируют почему-то
 
вот код:
Expand Collapse Copy
package ru.levin.modules.combat;

import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.decoration.ArmorStandEntity;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.mob.Monster;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Items;
import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket;
import net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import net.minecraft.network.packet.c2s.play.UpdateSelectedSlotC2SPacket;
import net.minecraft.screen.slot.SlotActionType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import ru.levin.events.Event;
import ru.levin.events.impl.EventUpdate;
import ru.levin.events.impl.input.EventKeyBoard;
import ru.levin.events.impl.move.EventMotion;
import ru.levin.events.impl.player.EventSprint;
import ru.levin.manager.Manager;
import ru.levin.mixin.iface.ClientPlayerEntityAccessor;
import ru.levin.modules.Function;
import ru.levin.modules.FunctionAnnotation;
import ru.levin.modules.Type;
import ru.levin.modules.render.littlePet.GhostWolfEntity;
import ru.levin.modules.setting.BindBooleanSetting;
import ru.levin.modules.setting.BooleanSetting;
import ru.levin.modules.setting.ModeSetting;
import ru.levin.modules.setting.MultiSetting;
import ru.levin.modules.setting.SliderSetting;
import ru.levin.util.math.RayTraceUtil;
import ru.levin.util.move.MoveUtil;
import ru.levin.util.player.InventoryUtil;
import ru.levin.util.SensUtils;

import java.util.Arrays;
import java.util.concurrent.ThreadLocalRandom;

import static net.minecraft.util.Hand.MAIN_HAND;

@SuppressWarnings("All")
@FunctionAnnotation(name = "AttackAura", type = Type.Combat)
public class AttackAura extends Function {

    private final ModeSetting mode = new ModeSetting("Мод", "Raidmine Snap", "Raidmine Snap");
    private final MultiSetting targets = new MultiSetting("Цели",
            Arrays.asList("Игроки", "Мобы", "Монстры"),
            new String[]{"Игроки", "Друзья", "Мобы", "Монстры", "Жители"});
    private final MultiSetting setting = new MultiSetting("Настройки",
            Arrays.asList("Ломать щит", "Отжим щита"),
            new String[]{"Только критами", "Ломать щит", "Отжим щита", "Атаковать задом"});
    private final SliderSetting distance = new SliderSetting("Радиус атаки", 4.0f, 1.8f, 6f, 0.1f);
    private final SliderSetting rotateDistance = new SliderSetting("Радиус обнаружения", 6f, 0.0f, 10f, 0.1f);
    private final SliderSetting raidmineDelay = new SliderSetting("Задержка атаки", 50, 0, 500, 10);
    private final SliderSetting rotationSpeed = new SliderSetting("Скорость поворота", 180f, 30f, 360f, 10f);
    private final SliderSetting holdTime = new SliderSetting("Удержание на цели", 100, 0, 500, 10);
    private final BooleanSetting polarBypass = new BooleanSetting("Обход Polar", true);
    private final SliderSetting polarMaxAngle = new SliderSetting("Макс угол", 60f, 30f, 90f, 5f, () -> polarBypass.get());
    private final BindBooleanSetting onlySpaceCritical = new BindBooleanSetting("Только с пробелом", false, () -> setting.get("Только критами"));
    private final BooleanSetting noAttackIfEat = new BooleanSetting("Не бить если ешь", true);
    private final BooleanSetting raycast = new BooleanSetting("Проверять наведение", false);
    private final ModeSetting sprintreset = new ModeSetting("Тип спринта", "Legit", "Rage", "Legit", "None");
    public final BooleanSetting correction = new BooleanSetting("Коррекция", true);
    public final ModeSetting correctionType = new ModeSetting(() -> correction.get(), "Тип коррекции", "Free", "Free", "Focus");

    public LivingEntity target = null;
    private long cpsLimit = 0L;
    private long raidmineLastAttack = 0L;
    private long raidmineLastRotate = 0L;
    private boolean raidmineAttackReady = true;
    private boolean raidmineWasRotating = false;
    private float serverYaw = 0f;
    private float serverPitch = 0f;
    private long holdStartTime = 0L;
    private boolean isHolding = false;
    private float snapYaw = 0f;
    private float snapPitch = 0f;
    private boolean snapAttackReady = false;

    public AttackAura() {
        addSettings(mode, targets, setting, distance, rotateDistance, raidmineDelay,
                rotationSpeed, holdTime, polarBypass, polarMaxAngle, onlySpaceCritical,
                noAttackIfEat, raycast, sprintreset, correction, correctionType);
    }

    @Override
    public void onEvent(Event event) {
        ClientPlayerEntity player = mc.player;
        if (player == null || player.isDead()) {
            target = null;
            resetState();
            return;
        }

        if (event instanceof EventKeyBoard e && correction.get() && correctionType.is("Free")) {
            MoveUtil.fixMovement(e, Manager.ROTATION.getYaw());
        }

        if (event instanceof EventSprint sprint && sprintreset.is("Legit") && canAttack() && target != null && player.isSprinting()) {
            sprint.setSprinting(false);
        }

        if (event instanceof EventUpdate) {
            if (target == null || !isValidTarget(target) || target.isDead() || !target.isAlive()) {
                target = findTarget();
            }

            if (target == null) {
                serverYaw = player.getYaw();
                serverPitch = player.getPitch();
                cpsLimit = System.currentTimeMillis();
                resetState();
                return;
            }

            handleAttackAndRotation(target);
        }

        if (event instanceof EventMotion motion) {
            if (raidmineWasRotating && System.currentTimeMillis() - raidmineLastAttack > 200) {
                motion.setYaw(player.getYaw());
                motion.setPitch(player.getPitch());
                raidmineWasRotating = false;
            } else {
                motion.setYaw(Manager.ROTATION.getYaw());
                motion.setPitch(Manager.ROTATION.getPitch());
            }
        }
    }

    private void resetState() {
        raidmineAttackReady = true;
        raidmineWasRotating = false;
        isHolding = false;
        snapAttackReady = false;
    }

    @Override
    protected void onEnable() {
        super.onEnable();
        raidmineAttackReady = true;
        serverYaw = mc.player.getYaw();
        serverPitch = mc.player.getPitch();
    }

    @Override
    protected void onDisable() {
        target = null;
        cpsLimit = System.currentTimeMillis();
        resetState();
        super.onDisable();
    }

    private boolean isTargetVisible(LivingEntity entity) {
        if (entity == null) return false;
        float angle = getAngleToTarget(entity);
        if (polarBypass.get()) return angle <= polarMaxAngle.get().floatValue();
        return angle <= 120f;
    }

    private boolean isValidTarget(LivingEntity entity) {
        if (entity == null || entity.isDead() || !entity.isAlive() || entity == mc.player) return false;
        double dist = mc.player.distanceTo(entity);
        double attackRange = distance.get().doubleValue();
        double detectRange = rotateDistance.get().doubleValue();
        if (dist > attackRange && (detectRange <= 0 || dist > detectRange)) return false;
        if (Manager.FUNCTION_MANAGER.antiBot.check(entity)) return false;

        if (entity instanceof PlayerEntity) {
            if (!targets.get("Игроки")) return false;
            if (!targets.get("Друзья") && Manager.FRIEND_MANAGER.isFriend(entity.getName().getString())) return false;
        } else if (entity instanceof VillagerEntity && !targets.get("Жители")) return false;
        else if (entity instanceof MobEntity || entity instanceof AnimalEntity) {
            if (!targets.get("Мобы")) return false;
        } else if (entity instanceof Monster && !targets.get("Монстры")) return false;

        if (entity instanceof ArmorStandEntity) return false;
        if (Manager.FUNCTION_MANAGER.littleSnickers.state && (entity instanceof GhostWolfEntity)) return false;
        return true;
    }

    private LivingEntity findTarget() {
        LivingEntity closest = null;
        double closestDist = Double.MAX_VALUE;
        for (Entity e : mc.world.getEntities()) {
            if (e instanceof LivingEntity le && isValidTarget(le)) {
                double dist = mc.player.distanceTo(le);
                if (dist < closestDist) {
                    closestDist = dist;
                    closest = le;
                }
            }
        }
        return closest;
    }

    private void handleAttackAndRotation(LivingEntity t) {
        if (t == null) return;
        boolean isVisible = isTargetVisible(t);
        boolean canAttackNow = shouldAttack(t);
        boolean passRay = !raycast.get() || RayTraceUtil.getMouseOver(t, Manager.ROTATION.getYaw(), Manager.ROTATION.getPitch(), distance.get().floatValue()) == t;

        if (polarBypass.get() && !isVisible && canAttackNow) {
            handlePolarBehindAttack(t, canAttackNow);
            return;
        }

        handleRaidmineSnap(t, canAttackNow, passRay);
    }

    private void handlePolarBehindAttack(LivingEntity t, boolean canAttackNow) {
        if (System.currentTimeMillis() - raidmineLastRotate > 50) {
            polarSmoothRotation(t);
            raidmineLastRotate = System.currentTimeMillis();
        }
        
        boolean attackDelayPassed = System.currentTimeMillis() - raidmineLastAttack >= raidmineDelay.get().longValue();
        boolean inAttackRange = mc.player.distanceTo(t) <= distance.get().floatValue();
        boolean attackReady = canAttack() && inAttackRange;
        float angle = getAngleToTarget(t);
        boolean canAttackFromBehind = angle <= polarMaxAngle.get().floatValue() * 1.5f;
        
        if (canAttackNow && attackDelayPassed && raidmineAttackReady && attackReady && canAttackFromBehind) {
            silentAttack(t);
            raidmineLastAttack = System.currentTimeMillis();
            raidmineAttackReady = false;
            raidmineWasRotating = true;
        } else {
            raidmineAttackReady = true;
        }
    }

    private void handleRaidmineSnap(LivingEntity t, boolean canAttackNow, boolean passRay) {
        boolean isVisible = isTargetVisible(t);
        if (polarBypass.get() && !isVisible && canAttackNow) {
            handlePolarBehindAttack(t, canAttackNow);
            return;
        }

        if (System.currentTimeMillis() - raidmineLastRotate > 50) {
            raidmineSmoothRotation(t, canAttackNow && isVisible);
            raidmineLastRotate = System.currentTimeMillis();
        }

        boolean attackDelayPassed = System.currentTimeMillis() - raidmineLastAttack >= raidmineDelay.get().longValue();
        boolean inAttackRange = mc.player.distanceTo(t) <= distance.get().floatValue();
        boolean attackReady = canAttack() && inAttackRange;

        if (canAttackNow && attackDelayPassed && raidmineAttackReady && attackReady && isVisible) {
            float angleToTarget = getAngleToTarget(t);
            if (setting.get("Атаковать задом") || angleToTarget < 90.0f) {
                silentAttack(t);
                raidmineLastAttack = System.currentTimeMillis();
                raidmineAttackReady = false;
                raidmineWasRotating = true;
            }
        } else {
            raidmineAttackReady = true;
        }

        if (!canAttackNow && mc.player.input.movementForward > 0 && !mc.player.isUsingItem() && !mc.player.isSprinting()) {
            if (sprintreset.is("Rage") || sprintreset.is("Legit")) {
                mc.player.networkHandler.sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.START_SPRINTING));
                mc.player.setSprinting(true);
            }
        }
    }

    private void raidmineSmoothRotation(LivingEntity entity, boolean canAttackNow) {
        if (entity == null) return;
        
        Vec3d targetPos = entity.getBoundingBox().getCenter();
        Vec3d eyes = mc.player.getEyePos();
        double diffX = targetPos.x - eyes.x;
        double diffY = targetPos.y - eyes.y;
        double diffZ = targetPos.z - eyes.z;
        double dist = Math.sqrt(diffX * diffX + diffZ * diffZ);
        float targetYaw = (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F;
        float targetPitch = (float) -Math.toDegrees(Math.atan2(diffY, dist));
        targetPitch = MathHelper.clamp(targetPitch, -89.9f, 89.9f);

        float currentYaw = Manager.ROTATION.getYaw();
        float currentPitch = Manager.ROTATION.getPitch();

        float yawDelta = MathHelper.wrapDegrees(targetYaw - currentYaw);
        float pitchDelta = targetPitch - currentPitch;

        float tickDelta = mc.getRenderTickCounter().getTickDelta(true);
        float maxDelta = rotationSpeed.get().floatValue() * tickDelta / 20f;

        if (canAttackNow && !isHolding && Math.abs(yawDelta) < 10f) {
            isHolding = true;
            holdStartTime = System.currentTimeMillis();
        }
        
        if (isHolding && System.currentTimeMillis() - holdStartTime < holdTime.get().longValue()) {
            yawDelta = 0;
            pitchDelta = 0;
        } else {
            isHolding = false;
        }

        float yawChange = MathHelper.clamp(yawDelta, -maxDelta, maxDelta);
        float pitchChange = MathHelper.clamp(pitchDelta, -maxDelta/2, maxDelta/2);

        float newYaw = currentYaw + yawChange;
        float newPitch = currentPitch + pitchChange;
        newPitch = MathHelper.clamp(newPitch, -89.9f, 89.9f);

        Manager.ROTATION.set(newYaw, newPitch);
    }

    private void polarSmoothRotation(LivingEntity entity) {
        if (entity == null) return;
        
        Vec3d targetPos = entity.getBoundingBox().getCenter();
        Vec3d eyes = mc.player.getEyePos();
        double diffX = targetPos.x - eyes.x;
        double diffY = targetPos.y - eyes.y;
        double diffZ = targetPos.z - eyes.z;
        double dist = Math.sqrt(diffX * diffX + diffZ * diffZ);
        float targetYaw = (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F;
        float targetPitch = (float) -Math.toDegrees(Math.atan2(diffY, dist));
        targetPitch = MathHelper.clamp(targetPitch, -89.9f, 89.9f);

        float currentYaw = Manager.ROTATION.getYaw();
        float currentPitch = Manager.ROTATION.getPitch();

        float yawDelta = MathHelper.wrapDegrees(targetYaw - currentYaw);
        float pitchDelta = targetPitch - currentPitch;

        float speedMultiplier = 0.3f;
        float effectiveSpeed = rotationSpeed.get().floatValue() * speedMultiplier;
        float tickDelta = mc.getRenderTickCounter().getTickDelta(true);
        float maxDelta = effectiveSpeed * tickDelta / 20f;
        
        float yawChange = MathHelper.clamp(yawDelta, -maxDelta, maxDelta);
        float pitchChange = MathHelper.clamp(pitchDelta, -maxDelta/2, maxDelta/2);

        float newYaw = currentYaw + yawChange;
        float newPitch = currentPitch + pitchChange;
        newPitch = MathHelper.clamp(newPitch, -89.9f, 89.9f);

        Manager.ROTATION.set(newYaw, newPitch);
    }

    private void silentAttack(LivingEntity entity) {
        if (entity == null || mc.player == null) return;

        if (sprintreset.is("Rage") || sprintreset.is("Legit")) {
            if (mc.player.isSprinting()) {
                mc.player.networkHandler.sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.STOP_SPRINTING));
                mc.player.setSprinting(false);
            }
        }

        float originalYaw = Manager.ROTATION.getYaw();
        float originalPitch = Manager.ROTATION.getPitch();

        Vec3d targetPos = entity.getBoundingBox().getCenter();
        Vec3d eyes = mc.player.getEyePos();
        double diffX = targetPos.x - eyes.x;
        double diffY = targetPos.y - eyes.y;
        double diffZ = targetPos.z - eyes.z;
        double dist = Math.sqrt(diffX * diffX + diffZ * diffZ);
        float attackYaw = (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90.0F;
        float attackPitch = (float) -Math.toDegrees(Math.atan2(diffY, dist));
        attackPitch = MathHelper.clamp(attackPitch, -89.9f, 89.9f);

        Manager.ROTATION.set(attackYaw, attackPitch);
        mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.Full(
                mc.player.getX(), mc.player.getY(), mc.player.getZ(),
                attackYaw, attackPitch, mc.player.isOnGround(), true));

        mc.interactionManager.attackEntity(mc.player, entity);
        mc.player.swingHand(MAIN_HAND);

        Manager.ROTATION.set(originalYaw, originalPitch);
        mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.Full(
                mc.player.getX(), mc.player.getY(), mc.player.getZ(),
                originalYaw, originalPitch, mc.player.isOnGround(), true));

        if (setting.get("Ломать щит")) shieldBreaker(false);
        if (setting.get("Отжим щита") && mc.player.isBlocking()) {
            mc.interactionManager.stopUsingItem(mc.player);
        }
    }

    private float getAngleToTarget(LivingEntity target) {
        if (mc.player == null || target == null) return 180f;
        Vec3d eyes = mc.player.getEyePos();
        Vec3d targetPos = target.getBoundingBox().getCenter();
        Vec3d lookVec = mc.player.getRotationVec(1.0F);
        Vec3d targetVec = targetPos.subtract(eyes).normalize();
        double dot = lookVec.dotProduct(targetVec);
        return (float) Math.toDegrees(Math.acos(Math.min(1.0, Math.max(-1.0, dot))));
    }

    public void attackTarget(PlayerEntity player) {
        if (target == null) return;
        boolean sprintStop = false;
        boolean canStartSprint = mc.player.input.movementForward > 0
                && !mc.player.hasStatusEffect(StatusEffects.BLINDNESS)
                && !mc.player.isGliding()
                && !mc.player.isUsingItem()
                && !mc.player.horizontalCollision
                && mc.player.getHungerManager().getFoodLevel() > 6
                && !mc.player.isSneaking();

        if (setting.get("Отжим щита") && mc.player.isBlocking()) {
            mc.interactionManager.stopUsingItem(mc.player);
        }

        if (sprintreset.is("Legit")) {
            if (mc.player.isSprinting() || canAttack()) {
                if (mc.player.isSprinting()) return;
            }
        }

        if (sprintreset.is("Rage")) {
            if (((ClientPlayerEntityAccessor) mc.player).getLastSprinting()) {
                mc.player.networkHandler.sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.STOP_SPRINTING));
                mc.player.setSprinting(false);
                sprintStop = true;
            }
        }

        cpsLimit = System.currentTimeMillis() + 500L;
        mc.interactionManager.attackEntity(player, target);
        mc.player.swingHand(MAIN_HAND);
        if (setting.get("Ломать щит")) shieldBreaker(false);
        if (sprintreset.is("Rage") && sprintStop && canStartSprint) {
            if (((ClientPlayerEntityAccessor) mc.player).getLastSprinting()) {
                mc.player.networkHandler.sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.START_SPRINTING));
                mc.player.setSprinting(true);
            }
        }
    }

    private boolean shouldAttack(LivingEntity e) {
        if (e == null || cpsLimit > System.currentTimeMillis()) return false;
        double dist = mc.player.distanceTo(e);
        if (dist > distance.get().doubleValue()) return false;
        return canAttack();
    }

    private boolean canAttack() {
        if (noAttackIfEat.get() && mc.player.isUsingItem() && !mc.player.getActiveItem().isOf(Items.SHIELD)) return false;
        float attackCooldown = mc.player.getAttackCooldownProgress(mc.getRenderTickCounter().getTickDelta(true));
        if (!(mc.player.getMainHandStack().isOf(Items.MACE)) && attackCooldown < 0.85F) return false;
        boolean restrict = mc.player.hasStatusEffect(StatusEffects.BLINDNESS)
                || mc.player.hasStatusEffect(StatusEffects.LEVITATION)
                || mc.player.hasStatusEffect(StatusEffects.SLOW_FALLING)
                || mc.player.isInLava()
                || mc.player.inPowderSnow
                || mc.player.isClimbing()
                || mc.player.hasVehicle()
                || mc.player.getAbilities().flying
                || (mc.player.isInFluid() && !mc.options.jumpKey.isPressed())
                || MoveUtil.isInWeb();
        boolean needSpace = onlySpaceCritical.get()
                && mc.player.isOnGround()
                && !mc.options.jumpKey.isPressed();
        if (setting.get("Только критами") && !restrict) {
            return needSpace || (!mc.player.isOnGround() && mc.player.fallDistance > 0.0f);
        }
        return true;
    }

    private boolean shieldBreaker(boolean instant) {
        int axeSlot = InventoryUtil.getAxe().slot();
        if (axeSlot == -1) return false;
        if (!(target instanceof PlayerEntity)) return false;
        if (!((PlayerEntity) target).isUsingItem() && !instant) return false;
        if (((PlayerEntity) target).getOffHandStack().getItem() != Items.SHIELD
                && ((PlayerEntity) target).getMainHandStack().getItem() != Items.SHIELD) return false;

        if (axeSlot >= 9) {
            mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, axeSlot, mc.player.getInventory().selectedSlot, SlotActionType.SWAP, mc.player);
            mc.getNetworkHandler().sendPacket(new CloseHandledScreenC2SPacket(mc.player.currentScreenHandler.syncId));
            mc.interactionManager.attackEntity(mc.player, target);
            mc.player.swingHand(Hand.MAIN_HAND);
            mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, axeSlot, mc.player.getInventory().selectedSlot, SlotActionType.SWAP, mc.player);
            mc.getNetworkHandler().sendPacket(new CloseHandledScreenC2SPacket(mc.player.currentScreenHandler.syncId));
        } else {
            mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(axeSlot));
            mc.interactionManager.attackEntity(mc.player, target);
            mc.player.swingHand(Hand.MAIN_HAND);
            mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(mc.player.getInventory().selectedSlot));
        }
        return true;
    }
}
 
Последнее редактирование:
Назад
Сверху Снизу