Skip to content

Commit 9f6bab1

Browse files
committed
ensure kill aura registers when attacking stops
fixes many minor pausing and swapping related issues in ka
1 parent 4c35f86 commit 9f6bab1

File tree

1 file changed

+43
-18
lines changed
  • src/main/java/meteordevelopment/meteorclient/systems/modules/combat

1 file changed

+43
-18
lines changed

src/main/java/meteordevelopment/meteorclient/systems/modules/combat/KillAura.java

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -262,17 +262,33 @@ public void onDeactivate() {
262262

263263
@EventHandler
264264
private void onTick(TickEvent.Pre event) {
265-
if (!mc.player.isAlive() || PlayerUtils.getGameMode() == GameMode.SPECTATOR) return;
266-
if (pauseOnUse.get() && (mc.interactionManager.isBreakingBlock() || mc.player.isUsingItem())) return;
267-
if (onlyOnClick.get() && !mc.options.attackKey.isPressed()) return;
268-
if (TickRate.INSTANCE.getTimeSinceLastTick() >= 1f && pauseOnLag.get()) return;
269-
if (pauseOnCA.get() && Modules.get().get(CrystalAura.class).isActive() && Modules.get().get(CrystalAura.class).kaTimer > 0) return;
270-
265+
if (!mc.player.isAlive() || PlayerUtils.getGameMode() == GameMode.SPECTATOR) {
266+
stopAttacking();
267+
return;
268+
}
269+
if (pauseOnUse.get() && (mc.interactionManager.isBreakingBlock() || mc.player.isUsingItem())) {
270+
stopAttacking();
271+
return;
272+
}
273+
if (onlyOnClick.get() && !mc.options.attackKey.isPressed()) {
274+
stopAttacking();
275+
return;
276+
}
277+
if (TickRate.INSTANCE.getTimeSinceLastTick() >= 1f && pauseOnLag.get()) {
278+
stopAttacking();
279+
return;
280+
}
281+
if (pauseOnCA.get() && Modules.get().get(CrystalAura.class).isActive() && Modules.get().get(CrystalAura.class).kaTimer > 0) {
282+
stopAttacking();
283+
return;
284+
}
271285
if (onlyOnLook.get()) {
272286
Entity targeted = mc.targetedEntity;
273287

274-
if (targeted == null) return;
275-
if (!entityCheck(targeted)) return;
288+
if (targeted == null || !entityCheck(targeted)) {
289+
stopAttacking();
290+
return;
291+
}
276292

277293
targets.clear();
278294
targets.add(mc.targetedEntity);
@@ -282,15 +298,7 @@ private void onTick(TickEvent.Pre event) {
282298
}
283299

284300
if (targets.isEmpty()) {
285-
attacking = false;
286-
if (wasPathing) {
287-
PathManagers.get().resume();
288-
wasPathing = false;
289-
}
290-
if (swapBack.get() && swapped) {
291-
InvUtils.swap(previousSlot, false);
292-
swapped = false;
293-
}
301+
stopAttacking();
294302
return;
295303
}
296304

@@ -319,7 +327,10 @@ private void onTick(TickEvent.Pre event) {
319327
InvUtils.swap(weaponResult.slot(), false);
320328
}
321329

322-
if (!itemInHand()) return;
330+
if (!itemInHand()) {
331+
stopAttacking();
332+
return;
333+
}
323334

324335
attacking = true;
325336
if (rotation.get() == RotationMode.Always) Rotations.rotate(Rotations.getYaw(primary), Rotations.getPitch(primary, Target.Body));
@@ -338,6 +349,20 @@ private void onSendPacket(PacketEvent.Send event) {
338349
}
339350
}
340351

352+
private void stopAttacking() {
353+
if (!attacking) return;
354+
355+
attacking = false;
356+
if (wasPathing) {
357+
PathManagers.get().resume();
358+
wasPathing = false;
359+
}
360+
if (swapBack.get() && swapped) {
361+
InvUtils.swap(previousSlot, false);
362+
swapped = false;
363+
}
364+
}
365+
341366
private boolean shouldShieldBreak() {
342367
for (Entity target : targets) {
343368
if (target instanceof PlayerEntity player) {

0 commit comments

Comments
 (0)