Начинающий
Начинающий
- Статус
- Оффлайн
- Регистрация
- 2 Мар 2025
- Сообщения
- 6
- Реакции
- 0
Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:
- бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
- маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
- приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
- обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.
Спасибо!
в drainwalk сурсах я сделал вот такую килку но она работает только в 1 блок в чем проблема?
(powered by chatgpt)
(powered by chatgpt)
Код:
package tech.drainwalk.client.modules.combat;
import com.darkmagician6.eventapi.EventTarget;
import lombok.Getter;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Item;
import net.minecraft.item.SwordItem;
import net.minecraft.util.Hand;
import net.minecraft.util.LazyValue;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.vector.Vector2f;
import org.lwjgl.glfw.GLFW;
import tech.drainwalk.api.impl.events.UpdateEvent;
import tech.drainwalk.api.impl.events.input.MoveInputEvent;
import tech.drainwalk.api.impl.events.movement.JumpEvent;
import tech.drainwalk.api.impl.events.movement.StrafeEvent;
import tech.drainwalk.api.impl.events.player.EventEntitySync;
import tech.drainwalk.api.impl.models.module.Module;
import tech.drainwalk.api.impl.models.module.category.Category;
import tech.drainwalk.client.option.options.*;
import tech.drainwalk.services.modules.AuraService;
import java.util.Random;
public class Aura extends Module {
// Main Settings
private final FloatOption distance = new FloatOption("Distance", 4.5f, 1.0f, 6.0f).addIncrementValue(0.100f);
private final FloatOption preDistance = new FloatOption("PreDistance", 0.20f, 0.0f, 5.8f).addIncrementValue(0.010f);
private final FloatOption lerpSpeed = new FloatOption("Lerp Speed", 7, 1, 20).addIncrementValue(0.5f);
private final FloatOption attackSpeed = new FloatOption("Attack Speed", 12, 1.0f, 20.0f).addIncrementValue(0.5f); // CPS!
private final MultiOption targets =
new MultiOption("Targets",
new MultiOptionValue("Players", true),
new MultiOptionValue("Friends", false),
new MultiOptionValue("Mobs", true),
new MultiOptionValue("Animals", false)
);
// Additional Settings
private final FloatOption rotationSpeed = new FloatOption("Rotation Speed", 10, 1, 30).addIncrementValue(0.5f);
private final BooleanOption criticals = new BooleanOption("Criticals", true);
private final BooleanOption ignoreNaked = new BooleanOption("Ignore Naked", false);
private final BooleanOption moveFix = new BooleanOption("Movement Fix", true);
private final BooleanOption autoBlock = new BooleanOption("Auto Block", true);
private final BooleanOption smartRotation = new BooleanOption("SmartRotation", true);
private final BooleanOption randomizeRotations = new BooleanOption("RandomizeRotations", true);
// Advanced
private final BooleanOption prediction = new BooleanOption("Prediction", false); // По умолчанию выключена
private final FloatOption adaptiveRotationMultiplier = new FloatOption("Adaptive Rotation", 1.0f, 0.1f, 3.0f).addIncrementValue(0.1f);
private Vector2f currentRotation, targetRotation;
private final AuraService auraService = new AuraService();
private final Random random = new Random();
@Getter
private LivingEntity target = null;
private boolean isBlocking = false;
public Aura() {
super("Aura", Category.COMBAT);
register(
distance,
preDistance,
lerpSpeed,
attackSpeed,
targets,
rotationSpeed,
criticals,
ignoreNaked,
moveFix,
autoBlock,
smartRotation,
randomizeRotations,
prediction,
adaptiveRotationMultiplier
);
setCurrentKey(GLFW.GLFW_KEY_R);
addDescription("Automatically attacks nearby entities with advanced rotation, prediction, and targeting.");
}
@EventTarget
public void onUpdate(UpdateEvent event) {
updateTarget();
if (target == null) {
currentRotation = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
stopBlocking();
return;
}
updateRotation();
lerpRotation();
if (smartRotation.getValue()) {
attackTarget();
}
}
@EventTarget
public void onSync(EventEntitySync event) {
if (!smartRotation.getValue() || target == null) return;
float yaw = currentRotation.x;
float pitch = currentRotation.y;
if (randomizeRotations.getValue()) {
float rotationMultiplier = rotationSpeed.getValue() / 10.0F;
yaw += (random.nextFloat() * 2.0F - 1.0F) * (0.075F * rotationMultiplier);
pitch += (random.nextFloat() * 2.0F - 1.0F) * (0.05F * rotationMultiplier);
pitch = MathHelper.clamp(pitch, -90.0f, 90.0f);
}
mc.player.rotationYawHead = yaw;
mc.player.renderYawOffset = yaw;
mc.player.rotationPitchHead = pitch;
event.setYaw(yaw);
event.setPitch(pitch);
}
@EventTarget
public void onInput(MoveInputEvent event) {
if (moveFix.getValue() && currentRotation != null && target != null) {
auraService.fixMovement(event, currentRotation.x);
}
}
@EventTarget
public void onStrafe(StrafeEvent event) {
if (moveFix.getValue() && currentRotation != null && target != null) {
event.setYaw(currentRotation.x);
}
}
@EventTarget
public void onJump(JumpEvent event) {
if (moveFix.getValue() && currentRotation != null && target != null) {
event.setYaw(currentRotation.x);
}
}
private void updateTarget() {
this.target = smartTargetSelection(distance.getValue(), targets, ignoreNaked.getValue());
}
private void updateRotation() {
targetRotation = calculateTargetRotation(target);
}
private void lerpRotation() {
float currentRotationSpeed = rotationSpeed.getValue();
// Adaptive Rotation
if (adaptiveRotationMultiplier.getValue() > 0) {
float distanceToTarget = mc.player.getDistance(target);
currentRotationSpeed *= MathHelper.clamp(adaptiveRotationMultiplier.getValue() / distanceToTarget, 0.1f, adaptiveRotationMultiplier.getValue());
}
currentRotation = auraService.applyRotationPatch(
auraService.smoothRotation(currentRotation, targetRotation, currentRotationSpeed) //Use adaptive rotation speed
);
}
private void attackTarget() {
if (mc.player.getCooledAttackStrength(0.0f) < 1) {
stopBlocking();
return; // Attack not ready
}
// **ОЧЕНЬ ВАЖНО**: Проверяем attackCondition И ДИСТАНЦИЮ тут!
boolean canAttack = auraService.attackCondition(currentRotation, target, criticals.getValue());
float actualDistance = mc.player.getDistance(target); //Получаем дистанцию
System.out.println("attackTarget: canAttack = " + canAttack + ", actualDistance = " + actualDistance + ", distance.getValue() = " + distance.getValue());
if (canAttack && actualDistance <= distance.getValue()) {
//AutoBlock logic
if (autoBlock.getValue()) {
Item heldItem = mc.player.getHeldItemMainhand().getItem();
if (heldItem instanceof SwordItem) { //Only swords can block
if (!isBlocking && mc.player.isHandActive() == false) { //Stop spamming block
startBlocking();
}
} else {
stopBlocking(); // If not a sword, stop blocking
}
}
// Criticals
if (criticals.getValue() && mc.player.isOnGround()) {
mc.player.jump(); // Small jump for critical
}
mc.playerController.attackEntity(mc.player, target);
mc.player.swingArm(Hand.MAIN_HAND);
mc.player.resetCooldown();
//Reset random values for rotation
auraService.randValX.generate();
auraService.randValY.generate();
} else {
stopBlocking();
}
}
private void startBlocking() {
if (!isBlocking && mc.player.getHeldItemMainhand().getItem() instanceof SwordItem) {
mc.player.setActiveHand(Hand.MAIN_HAND);
isBlocking = true;
}
}
private void stopBlocking() {
if (isBlocking) {
mc.player.stopActiveHand();
isBlocking = false;
}
}
private LivingEntity smartTargetSelection(double range, MultiOption targetOptions, boolean ignoreNaked) {
LivingEntity bestTarget = null;
double bestScore = -1;
// Use a larger AABB for target selection to ensure targets at the edge of the range are included
AxisAlignedBB aabb = mc.player.getBoundingBox().grow(range + 1);
System.out.println("smartTargetSelection: distance.getValue() = " + distance.getValue()); // Проверяем значение distance
for (LivingEntity entity : mc.world.getEntitiesWithinAABB(LivingEntity.class, aabb)) {
if (entity == mc.player || entity.isDead() || entity.getHealth() <= 0) continue;
// Target Checks
if (entity instanceof ClientPlayerEntity && !targetOptions.getValue("Players")) continue;
double distanceToEntity = mc.player.getDistance(entity);
System.out.println(" Entity: " + entity.getName().getString() + ", distanceToEntity = " + distanceToEntity); // Дистанция до цели
if (distanceToEntity > range) continue;
if (!isEntityVisible(entity)) continue;
if (ignoreNaked && entity instanceof ClientPlayerEntity) { //ignoreNaked check
}
double score = calculateTargetScore(entity);
if (score > bestScore) {
bestScore = score;
bestTarget = entity;
}
}
if(bestTarget != null) {
System.out.println("Selected target: " + bestTarget.getName().getString());
} else {
System.out.println("No target selected.");
}
return bestTarget;
}
private double calculateTargetScore(LivingEntity entity) {
double healthScore = 20 - entity.getHealth(); // Lower health = higher score
double distanceScore = -mc.player.getDistance(entity); // Closer distance = higher score
return healthScore + distanceScore; // Combine scores
}
private Vector2f calculateTargetRotation(LivingEntity targetEntity) {
Vector3d targetPos = new Vector3d(targetEntity.getPosX(), targetEntity.getPosY() + targetEntity.getEyeHeight(), targetEntity.getPosZ());
double x = targetPos.x - mc.player.getPosX();
double y = targetPos.y - (mc.player.getPosY() + mc.player.getEyeHeight());
double z = targetPos.z - mc.player.getPosZ();
double horizontalDistance = Math.sqrt(x * x + z * z);
float yaw = (float) Math.toDegrees(Math.atan2(z, x)) - 90;
float pitch = (float) -Math.toDegrees(Math.atan2(y, horizontalDistance));
return new Vector2f(yaw, pitch);
}
private boolean isEntityVisible(LivingEntity entity) {
Vector3d eyesPos = new Vector3d(mc.player.getPosX(), mc.player.getPosY() + mc.player.getEyeHeight(), mc.player.getPosZ());
Vector3d targetPos = new Vector3d(entity.getPosX(), entity.getPosY() + entity.getEyeHeight(), entity.getPosZ());
net.minecraft.util.math.RayTraceResult result = mc.world.rayTraceBlocks(eyesPos, targetPos, false, true, false);
return result == null || result.getType() == net.minecraft.util.math.RayTraceResult.Type.MISS;
}
@Override
public void onEnable() {
currentRotation = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
isBlocking = false;
}
@Override
public void onDisable() {
target = null;
stopBlocking();
}
public LazyValue<Object> getDistance() {
return null;
}
}