Начинающий
- Статус
- Оффлайн
- Регистрация
- 17 Фев 2025
- Сообщения
- 156
- Реакции
- 1
типо аимом хз как обьяснить курсор тянет к цели а должно быть свободно
сорян я просто не оч шарю в аурах
аура:
package pub.aesthetic.module.combat;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.mob.HostileEntity;
import net.minecraft.entity.mob.Monster;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import org.joml.Vector2f;
import pub.aesthetic.event.EventBus;
import pub.aesthetic.event.Events;
import pub.aesthetic.event.lifecycle.ClientTickEvent;
import pub.aesthetic.module.KeyBinding;
import pub.aesthetic.module.Module;
import pub.aesthetic.module.ModuleCategory;
import pub.aesthetic.module.setting.BooleanSetting;
import pub.aesthetic.module.setting.ComboSetting;
import pub.aesthetic.module.setting.ModeListSetting;
import pub.aesthetic.module.setting.SliderSetting;
import pub.aesthetic.util.StopWatch;
import java.util.Comparator;
public final class KillauraModule extends Module {
private final SliderSetting attackRange = new SliderSetting("Attack Range", 3.0d, 6.5d, 4.5d, 0.1d);
private final ComboSetting rotationMode = new ComboSetting("Rotation Mode", java.util.List.of("Snap"), "Snap");
private final ModeListSetting attack = new ModeListSetting(
"Attack",
new BooleanSetting("Reset Sprint", true),
new BooleanSetting("Only Crits", true),
new BooleanSetting("Hit Through Blocks", false)
);
private LivingEntity target;
private Vector2f headVector = new Vector2f(0f, 0f);
private StopWatch stopWatch = new StopWatch();
private boolean isRotated = false;
private boolean readyToRotate = false;
private float ticks = 0;
private EventBus.EventSubscription tickSubscription;
public KillauraModule() {
super(
"Killaura",
"aesthetic:icons/module/killaura",
"Automatically attacks nearby entities within range.",
ModuleCategory.COMBAT,
new KeyBinding()
);
addSetting(attackRange);
addSetting(rotationMode);
addSetting(attack);
}
@Override
protected void onEnable() {
unsubscribe();
target = null;
MinecraftClient client = MinecraftClient.getInstance();
if (client.player != null) {
headVector.set(client.player.getPitch(), client.player.getYaw());
}
stopWatch.setLastMS(0);
tickSubscription = Events.CLIENT_TICK.subscribe(this::handleClientTick);
}
@Override
protected void onDisable() {
unsubscribe();
target = null;
MinecraftClient client = MinecraftClient.getInstance();
if (client.player != null) {
headVector.set(client.player.getPitch(), client.player.getYaw());
}
stopWatch.setLastMS(0);
}
private void unsubscribe() {
if (tickSubscription != null) {
tickSubscription.unsubscribe();
tickSubscription = null;
}
}
private void handleClientTick(ClientTickEvent event) {
MinecraftClient client = event.client();
if (client.player == null || client.world == null) {
return;
}
updateTarget(client);
if (target == null) {
reset(client);
return;
}
isRotated = false;
if (stopWatch.hasTimeElapsed()) {
readyToRotate = true;
ticks = 2.0f;
stopWatch.reset();
}
if (rotationMode.getValue().equals("Snap") && ticks > 0) {
rotationSnap(client);
ticks--;
} else {
reset(client);
}
updateAttack(client);
}
private void updateTarget(MinecraftClient client) {
target = client.world.getEntitiesByClass(
LivingEntity.class,
client.player.getBoundingBox().expand(attackRange.getValue()),
e -> isValid(client, e)
).stream()
.min(Comparator.comparingDouble(e -> client.player.distanceTo(e)))
.orElse(null);
}
private boolean isValid(MinecraftClient client, LivingEntity e) {
if (e == client.player || !e.isAlive() || e.isInvulnerable() || e.age < 3) {
return false;
}
double d = client.player.distanceTo(e);
if (d > attackRange.getValue()) {
return false;
}
if (e instanceof PlayerEntity || e instanceof Monster || e instanceof HostileEntity) {
BooleanSetting hitThroughBlocks = (BooleanSetting) attack.getByName("Hit Through Blocks");
if (e instanceof PlayerEntity && !hitThroughBlocks.getValue() && !canSee(client, e)) {
return false;
}
return true;
}
return false;
}
private boolean canSee(MinecraftClient client, Entity e) {
Vec3d start = client.player.getEyePos();
Vec3d end = e.getEyePos();
Vec3d direction = end.subtract(start);
double distance = direction.length();
if (distance == 0) return true;
Vec3d normalized = direction.normalize();
for (double i = 0; i < distance; i += 0.5) {
Vec3d checkPos = start.add(normalized.multiply(i));
BlockPos blockPos = BlockPos.ofFloored(checkPos);
if (!client.world.getBlockState(blockPos).isAir()) {
return false;
}
}
return true;
}
private void rotationSnap(MinecraftClient client) {
if (target == null) {
return;
}
Vec3d vec = target.getEyePos().subtract(client.player.getEyePos());
float yaw = (float) (Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90f);
float pitch = (float) (-Math.toDegrees(Math.atan2(vec.y, Math.sqrt(vec.x * vec.x + vec.z * vec.z))));
headVector.set(
MathHelper.clamp(pitch, -89.5f, 89.5f),
MathHelper.wrapDegrees(yaw)
);
client.player.setPitch(headVector.x);
client.player.setYaw(headVector.y);
}
private void updateAttack(MinecraftClient client) {
if (target == null) {
return;
}
if (client.player.getAttackCooldownProgress(0f) < 0.95f) {
return;
}
double dist = client.player.distanceTo(target);
if (dist > attackRange.getValue()) {
return;
}
BooleanSetting onlyCrits = (BooleanSetting) attack.getByName("Only Crits");
if (onlyCrits.getValue() && !isFalling(client)) {
return;
}
BooleanSetting resetSprint = (BooleanSetting) attack.getByName("Reset Sprint");
if (resetSprint.getValue()) {
client.player.setSprinting(false);
}
client.interactionManager.attackEntity(client.player, target);
client.player.swingHand(Hand.MAIN_HAND);
stopWatch.setLastMS(500);
}
private boolean isFalling(MinecraftClient client) {
return client.player.getVelocity().y < 0;
}
private void reset(MinecraftClient client) {
if (client.player != null) {
headVector.set(client.player.getPitch(), client.player.getYaw());
}
}
public LivingEntity getTarget() {
return target;
}
public double getAttackRange() {
return attackRange.getValue();
}
public String getRotationMode() {
return rotationMode.getValue();
}
}
Код: