Merge pull request #2107 from scorbett123/toolsSaver
add itemSaver setting.
This commit is contained in:
commit
b32c9f1724
@ -696,6 +696,11 @@ public final class Settings {
|
||||
*/
|
||||
public final Setting<Boolean> censorRanCommands = new Setting<>(false);
|
||||
|
||||
/**
|
||||
* Stop using tools just before they are going to break.
|
||||
*/
|
||||
public final Setting<Boolean> itemSaver = new Setting<>(false);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -124,6 +124,9 @@ 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() && Baritone.settings().itemSaver.value && itemStack.getMaxDamage() > 1) {
|
||||
continue;
|
||||
}
|
||||
double speed = calculateSpeedVsBlock(itemStack, blockState);
|
||||
boolean silkTouch = hasSilkTouch(itemStack);
|
||||
if (speed > highestSpeed) {
|
||||
|
Loading…
Reference in New Issue
Block a user