add itemSaver setting.

Signed-off-by: scorbett123 <sam@corbettchocolates.com>
This commit is contained in:
scorbett123 2020-10-24 18:03:29 +01:00
parent 39cfebeb34
commit 4aa52d2f2e
No known key found for this signature in database
GPG Key ID: C16B9466EBFC2DE7
2 changed files with 9 additions and 0 deletions

View File

@ -684,6 +684,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.

View File

@ -18,6 +18,7 @@
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;
@ -124,6 +125,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() - 1 && Baritone.settings().itemSaver.value) {
continue;
}
double speed = calculateSpeedVsBlock(itemStack, blockState);
boolean silkTouch = hasSilkTouch(itemStack);
if (speed > highestSpeed) {