don't fall back onto the first slot if it has a low durability item in the slot.

Signed-off-by: Sam Corbett <sam@corbettchocolates.com>
This commit is contained in:
Sam Corbett 2020-10-28 08:44:40 +00:00
parent 4aa52d2f2e
commit 9922382581
2 changed files with 2 additions and 3 deletions

View File

@ -114,7 +114,7 @@ public final class InventoryBehavior extends Behavior {
}
if (cla$$.isInstance(stack.getItem())) {
double speed = ToolSet.calculateSpeedVsBlock(stack, against.getDefaultState()); // takes into account enchants
if (speed > bestSpeed) {
if (speed > bestSpeed && !(stack.getItemDamage() >= stack.getMaxDamage() && Baritone.settings().itemSaver.value && stack.getMaxDamage() > 1)) {
bestSpeed = speed;
bestInd = i;
}

View File

@ -18,7 +18,6 @@
package baritone.utils;
import baritone.Baritone;
import baritone.api.utils.Helper;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.entity.EntityPlayerSP;
@ -125,7 +124,7 @@ public class ToolSet {
IBlockState blockState = b.getDefaultState();
for (int i = 0; i < 9; i++) {
ItemStack itemStack = player.inventory.getStackInSlot(i);
if (itemStack.getItemDamage() >= itemStack.getMaxDamage() - 1 && Baritone.settings().itemSaver.value) {
if (itemStack.getItemDamage() >= itemStack.getMaxDamage() && Baritone.settings().itemSaver.value && itemStack.getMaxDamage() > 1) {
continue;
}
double speed = calculateSpeedVsBlock(itemStack, blockState);