Skip to content

Commit dc2ae84

Browse files
committed
Let it always break anchors if it is able to do so
1 parent 5a51f41 commit dc2ae84

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

  • src/main/java/meteordevelopment/meteorclient/systems/modules/combat

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -340,11 +340,10 @@ private void doAnchorAura() {
340340

341341
FindItemResult anchor = InvUtils.findInHotbar(Items.RESPAWN_ANCHOR);
342342
FindItemResult glowStone = InvUtils.findInHotbar(Items.GLOWSTONE);
343-
if (!anchor.found() || !glowStone.found()) return;
344343

345344
if (bestBreakDamage > 0) {
346-
doBreak(anchor, glowStone);
347-
} else if (bestPlaceDamage > 0 && place.get()) {
345+
doBreak(glowStone);
346+
} else if (bestPlaceDamage > 0 && place.get() && anchor.found() && glowStone.found()) {
348347
doPlace(anchor);
349348
}
350349
});
@@ -362,18 +361,18 @@ private void doPlace(FindItemResult anchor) {
362361
placeDelayLeft = 0;
363362
}
364363

365-
private void doBreak(FindItemResult anchor, FindItemResult glowStone) {
364+
private void doBreak(FindItemResult glowStone) {
366365
// Set render info
367366
renderBlockPos = bestBreakPos;
368367

369368
if (rotate.get()) {
370-
Rotations.rotate(Rotations.getYaw(bestBreakPos), Rotations.getPitch(bestBreakPos), 40, () -> doInteract(anchor, glowStone));
369+
Rotations.rotate(Rotations.getYaw(bestBreakPos), Rotations.getPitch(bestBreakPos), 40, () -> doInteract(glowStone));
371370
} else {
372-
doInteract(anchor, glowStone);
371+
doInteract(glowStone);
373372
}
374373
}
375374

376-
private void doInteract(FindItemResult anchor, FindItemResult glowStone) {
375+
private void doInteract(FindItemResult glowStone) {
377376
BlockState blockState = mc.world.getBlockState(bestBreakPos);
378377
if (blockState.getBlock() != Blocks.RESPAWN_ANCHOR) return;
379378

@@ -382,6 +381,8 @@ private void doInteract(FindItemResult anchor, FindItemResult glowStone) {
382381

383382
// Charge the anchor
384383
if (charges == 0 && chargeDelayLeft++ >= chargeDelay.get()) {
384+
if (!glowStone.found()) return;
385+
385386
InvUtils.swap(glowStone.slot(), swapBack.get());
386387
BlockUtils.interact(new BlockHitResult(center, BlockUtils.getDirection(bestBreakPos), bestBreakPos, true), Hand.MAIN_HAND, swing.get());
387388
chargeDelayLeft = 0;
@@ -390,7 +391,10 @@ private void doInteract(FindItemResult anchor, FindItemResult glowStone) {
390391

391392
// Explode the anchor when charged
392393
if (charges > 0 && breakDelayLeft++ >= breakDelay.get()) {
393-
InvUtils.swap(anchor.slot(), swapBack.get());
394+
FindItemResult fir = InvUtils.findInHotbar(item -> !item.getItem().equals(Items.GLOWSTONE));
395+
if (!fir.found()) return;
396+
397+
InvUtils.swap(fir.slot(), swapBack.get());
394398
BlockUtils.interact(new BlockHitResult(center, BlockUtils.getDirection(bestBreakPos), bestBreakPos, true), Hand.MAIN_HAND, swing.get());
395399
breakDelayLeft = 0;
396400

0 commit comments

Comments
 (0)