Added itemSaverThreshold

This commit is contained in:
mankool 2021-06-09 10:34:45 -07:00
parent e85c1bbc0d
commit 8bfe32eeef
3 changed files with 7 additions and 2 deletions

View File

@ -733,6 +733,11 @@ public final class Settings {
*/
public final Setting<Boolean> itemSaver = new Setting<>(false);
/**
* Durability to leave on the tool when using itemSaver
*/
public final Setting<Integer> itemSaverThreshold = new Setting<>(10);
/**
* Always prefer silk touch tools over regular tools. This will not sacrifice speed, but it will always prefer silk
* touch tools over other tools of the same speed. This includes always choosing ANY silk touch tool over your hand.

View File

@ -112,7 +112,7 @@ public final class InventoryBehavior extends Behavior {
if (stack.isEmpty()) {
continue;
}
if (Baritone.settings().itemSaver.value && stack.getItemDamage() >= stack.getMaxDamage() && stack.getMaxDamage() > 1) {
if (Baritone.settings().itemSaver.value && (stack.getItemDamage() + Baritone.settings().itemSaverThreshold.value) >= stack.getMaxDamage() && stack.getMaxDamage() > 1) {
continue;
}
if (cla$$.isInstance(stack.getItem())) {

View File

@ -129,7 +129,7 @@ public class ToolSet {
continue;
}
if (Baritone.settings().itemSaver.value && itemStack.getItemDamage() >= itemStack.getMaxDamage() && itemStack.getMaxDamage() > 1) {
if (Baritone.settings().itemSaver.value && (itemStack.getItemDamage() + Baritone.settings().itemSaverThreshold.value) >= itemStack.getMaxDamage() && itemStack.getMaxDamage() > 1) {
continue;
}
double speed = calculateSpeedVsBlock(itemStack, blockState);