0
0
mirror of https://github.com/Wurst-Imperium/Wurst7.git synced 2024-09-20 01:12:13 +02:00

Fix isTooDamaged() check in putAwayDamagedTool()

This commit is contained in:
Alexander01998 2024-05-23 21:52:34 +02:00
parent e178cab6ab
commit b0111c744e

View File

@ -131,7 +131,7 @@ public final class AutoToolHack extends Hack
ItemStack heldItem = player.getMainHandStack(); ItemStack heldItem = player.getMainHandStack();
boolean heldItemDamageable = isDamageable(heldItem); boolean heldItemDamageable = isDamageable(heldItem);
if(heldItemDamageable && isTooDamaged(heldItem, repairMode)) if(heldItemDamageable && isTooDamaged(heldItem, repairMode))
putAwayDamagedTool(); putAwayDamagedTool(repairMode);
BlockState state = BlockUtils.getState(pos); BlockState state = BlockUtils.getState(pos);
int bestSlot = getBestSlot(state, useSwords, repairMode); int bestSlot = getBestSlot(state, useSwords, repairMode);
@ -206,7 +206,7 @@ public final class AutoToolHack extends Hack
return stack.getMaxDamage() - stack.getDamage() <= repairMode; return stack.getMaxDamage() - stack.getDamage() <= repairMode;
} }
private void putAwayDamagedTool() private void putAwayDamagedTool(int repairMode)
{ {
PlayerInventory inv = MC.player.getInventory(); PlayerInventory inv = MC.player.getInventory();
int selectedSlot = inv.selectedSlot; int selectedSlot = inv.selectedSlot;
@ -234,7 +234,8 @@ public final class AutoToolHack extends Hack
// Failing that, swap with a less damaged item // Failing that, swap with a less damaged item
OptionalInt notTooDamagedSlot = IntStream.range(9, 36) OptionalInt notTooDamagedSlot = IntStream.range(9, 36)
.filter(i -> !isTooDamaged(inv.getStack(i), 0)).findFirst(); .filter(i -> !isTooDamaged(inv.getStack(i), repairMode))
.findFirst();
if(notTooDamagedSlot.isPresent()) if(notTooDamagedSlot.isPresent())
{ {
im.windowClick_SWAP(notTooDamagedSlot.getAsInt(), selectedSlot); im.windowClick_SWAP(notTooDamagedSlot.getAsInt(), selectedSlot);