aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/ftbsc/bscv/modules/defense/Aura.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/main/java/ftbsc/bscv/modules/defense/Aura.java b/src/main/java/ftbsc/bscv/modules/defense/Aura.java
index 290ab81..3ebe569 100644
--- a/src/main/java/ftbsc/bscv/modules/defense/Aura.java
+++ b/src/main/java/ftbsc/bscv/modules/defense/Aura.java
@@ -129,6 +129,9 @@ public class Aura extends QuickModule implements ICommons {
if (MC.player.getAttackStrengthScale(0.f) < this.strenght.get()) return;
+ float distance = Float.MAX_VALUE;
+ Entity target = null;
+
for (Entity e : MC.level.entitiesForRendering()) {
if (e.equals(MC.player)) continue;
if (!(e instanceof LivingEntity)) continue;
@@ -143,13 +146,21 @@ public class Aura extends QuickModule implements ICommons {
}
if (this.trace.get() && !MC.player.canSee(e)) continue;
+ float dist = MC.player.distanceTo(e);
+ if (dist < distance) {
+ distance = dist;
+ target = e;
+ }
+ }
+
+ if (target != null) {
switch (this.look.get()) {
case ONCE:
- MC.player.lookAt(Type.EYES, e.getEyePosition(1.0F));
+ MC.player.lookAt(Type.EYES, target.getEyePosition(1.0F));
MC.player.connection.send(new CPlayerPacket.RotationPacket(MC.player.yRot, MC.player.xRot, MC.player.isOnGround()));
break;
case PACKET:
- this.lookAtHidden(Type.EYES, e.getEyePosition(1.0F));
+ this.lookAtHidden(Type.EYES, target.getEyePosition(1.0F));
break;
case NONE: break;
}
@@ -157,12 +168,10 @@ public class Aura extends QuickModule implements ICommons {
if (this.tool.get()) {
this.autotool.selectBestWeapon();
}
- MC.gameMode.attack(MC.player, e);
+ MC.gameMode.attack(MC.player, target);
if (this.swing.get()) {
MC.player.swing(Hand.MAIN_HAND);
}
-
- break; // TODO should find all valid targets and choose one rather than stopping here
}
}
}