Skip to content

Commit 9ce8727

Browse files
authored
fix(AutoGap): respect allowEgap setting when choosing enchanted gaps (#5637)
1 parent e57b6ad commit 9ce8727

File tree

1 file changed

+9
-14
lines changed
  • src/main/java/meteordevelopment/meteorclient/systems/modules/player

1 file changed

+9
-14
lines changed

src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoGap.java

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -305,31 +305,26 @@ private boolean shouldEatHealth() {
305305
}
306306

307307
private int findSlot() {
308-
boolean preferEGap = this.allowEgap.get() || requiresEGap;
309-
int slot = -1;
310-
311308
for (int i = 0; i < 9; i++) {
312-
// Skip if item stack is empty
313309
ItemStack stack = mc.player.getInventory().getStack(i);
310+
311+
// Skip if item stack is empty
314312
if (stack.isEmpty()) continue;
315313

316314
// Skip if item isn't a gap or egap
317315
if (isNotGapOrEGap(stack)) continue;
316+
318317
Item item = stack.getItem();
319318

320-
// If egap was found and preferEGap is true we can return the current slot
321-
if (item == Items.ENCHANTED_GOLDEN_APPLE && preferEGap) {
322-
slot = i;
323-
break;
324-
}
319+
// If egap was found and allowEgapSetting is true we can return the current slot
320+
if (item == Items.ENCHANTED_GOLDEN_APPLE && allowEgap.get()) return i;
321+
325322
// If gap was found and egap is not required we can return the current slot
326-
else if (item == Items.GOLDEN_APPLE && !requiresEGap) {
327-
slot = i;
328-
if (!preferEGap) break;
329-
}
323+
if (item == Items.GOLDEN_APPLE && !requiresEGap) return i;
330324
}
331325

332-
return slot;
326+
// No suitable gap or egap found
327+
return -1;
333328
}
334329

335330
private boolean isNotGapOrEGap(ItemStack stack) {

0 commit comments

Comments
 (0)