Я делал киллку под ач Polar на сервер raidmine, по итогу, когда навожусь на игрока или близко смотрю на него, удары проходят и не режет урон. А когда задом бью, удары не проходят, но потом режете урон и БАН.
Код:
package ru.levin.modules.combat;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.entity.*;
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.*;
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.*;
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 static net.minecraft.util.Hand.MAIN_HAND;
@SuppressWarnings("All")
@FunctionAnnotation(name = "AttackAura", keywords = {"Пиздить","Хуячить","KillAura"}, desc = "Ебашит бошки всем вокруг", 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 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;
public AttackAura() {
addSettings(mode, targets, setting, distance, rotateDistance, snapSpeed, raidmineDelay, raidmineSmoothness, raidminePredict, sprintreset, onlySpaceCritical, noAttackIfEat, raycast, rotationSpeed, correction, correctionType);
}
@Override
public void onEvent(Event event) {
ClientPlayerEntity player = mc.player;
if (player == null || player.isDead()) {
target = null;
raidmineAttackReady = true;
raidmineWasRotating = false;
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) {
Manager.ROTATION.set(player.getYaw(), player.getPitch());
cpsLimit = System.currentTimeMillis();
raidmineAttackReady = true;
raidmineWasRotating = false;
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());
}
}
}
@Override
protected void onEnable() {
super.onEnable();
raidmineAttackReady = true;
raidmineWasRotating = false;
raidmineLastYaw = mc.player.getYaw();
raidmineLastPitch = mc.player.getPitch();
}
@Override
protected void onDisable() {
target = null;
raidmineAttackReady = true;
raidmineWasRotating = false;
cpsLimit = System.currentTimeMillis();
super.onDisable();
}
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 canAttackNow = shouldAttack(t);
boolean passRay = !raycast.get() || RayTraceUtil.getMouseOver(t, Manager.ROTATION.getYaw(), Manager.ROTATION.getPitch(), distance.get().floatValue()) == t;
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 handleRaidmineSnap(LivingEntity t, boolean canAttackNow, boolean passRay) {
if (System.currentTimeMillis() - raidmineLastRotate > 50) {
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) {
float angleToTarget = getAngleToTarget(t);
if (setting.get("Атаковать задом") || angleToTarget < 90.0f) {
attackEntityDirectly(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 attackEntityDirectly(LivingEntity entity) {
if (entity == null || mc.player == null) return;
if (sprintreset.is("Rage") || sprintreset.is("Legit") && 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);
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);
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") && (mc.player.isSprinting() || canAttack()) && mc.player.isSprinting()) return;
if (sprintreset.is("Rage") && ((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 && ((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;
}
}