add itemSaver setting.
Signed-off-by: scorbett123 <sam@corbettchocolates.com>
This commit is contained in:
parent
39cfebeb34
commit
4aa52d2f2e
@ -684,6 +684,11 @@ public final class Settings {
|
|||||||
*/
|
*/
|
||||||
public final Setting<Boolean> censorRanCommands = new Setting<>(false);
|
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
|
* 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.
|
* touch tools over other tools of the same speed. This includes always choosing ANY silk touch tool over your hand.
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
package baritone.utils;
|
package baritone.utils;
|
||||||
|
|
||||||
import baritone.Baritone;
|
import baritone.Baritone;
|
||||||
|
import baritone.api.utils.Helper;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.entity.EntityPlayerSP;
|
import net.minecraft.client.entity.EntityPlayerSP;
|
||||||
@ -124,6 +125,9 @@ public class ToolSet {
|
|||||||
IBlockState blockState = b.getDefaultState();
|
IBlockState blockState = b.getDefaultState();
|
||||||
for (int i = 0; i < 9; i++) {
|
for (int i = 0; i < 9; i++) {
|
||||||
ItemStack itemStack = player.inventory.getStackInSlot(i);
|
ItemStack itemStack = player.inventory.getStackInSlot(i);
|
||||||
|
if (itemStack.getItemDamage() >= itemStack.getMaxDamage() - 1 && Baritone.settings().itemSaver.value) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
double speed = calculateSpeedVsBlock(itemStack, blockState);
|
double speed = calculateSpeedVsBlock(itemStack, blockState);
|
||||||
boolean silkTouch = hasSilkTouch(itemStack);
|
boolean silkTouch = hasSilkTouch(itemStack);
|
||||||
if (speed > highestSpeed) {
|
if (speed > highestSpeed) {
|
||||||
|
Loading…
Reference in New Issue
Block a user