commit
f0d2bae3d1
@ -61,6 +61,21 @@ public final class Settings {
|
||||
*/
|
||||
public final Setting<Boolean> allowInventory = new Setting<>(false);
|
||||
|
||||
/**
|
||||
* Allow player to decide if to use auto tool or not
|
||||
*/
|
||||
public final Setting<Boolean> autoTool = new Setting<>(true);
|
||||
|
||||
/**
|
||||
* Should movement cost calculation ignore the cost of breaking blocks with current slot, and assume best possible
|
||||
* item in the hotbar?
|
||||
*
|
||||
* Only use this if actually necessary, make sure to put this back to original state (false), or it
|
||||
* might mess up pathing in some combinations with auto tool setting. (just fall back to original settings if any
|
||||
* problems occurs)
|
||||
*/
|
||||
public final Setting<Boolean> ignoreAutoToolMovementCost = new Setting<>(false);
|
||||
|
||||
/**
|
||||
* It doesn't actually take twenty ticks to place a block, this cost is so high
|
||||
* because we want to generally conserve blocks which might be limited.
|
||||
|
@ -432,7 +432,9 @@ public interface MovementHelper extends ActionCosts, Helper {
|
||||
* @param ts previously calculated ToolSet
|
||||
*/
|
||||
static void switchToBestToolFor(IPlayerContext ctx, IBlockState b, ToolSet ts, boolean preferSilkTouch) {
|
||||
ctx.player().inventory.currentItem = ts.getBestSlot(b.getBlock(), preferSilkTouch);
|
||||
if (Baritone.settings().autoTool.value) {
|
||||
ctx.player().inventory.currentItem = ts.getBestSlot(b.getBlock(), preferSilkTouch);
|
||||
}
|
||||
}
|
||||
|
||||
static void moveTowards(IPlayerContext ctx, MovementState state, BlockPos pos) {
|
||||
|
@ -96,12 +96,27 @@ public class ToolSet {
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate which tool on the hotbar is best for mining
|
||||
* Calculate which tool on the hotbar is best for mining, depending on an override setting,
|
||||
* related to auto tool movement cost, it will either return current selected slot, or the best slot.
|
||||
*
|
||||
* @param b the blockstate to be mined
|
||||
* @return An int containing the index in the tools array that worked best
|
||||
*/
|
||||
|
||||
public int getBestSlot(Block b, boolean preferSilkTouch) {
|
||||
return getBestSlot(b, preferSilkTouch, false);
|
||||
}
|
||||
|
||||
public int getBestSlot(Block b, boolean preferSilkTouch, boolean pathingCalculation) {
|
||||
|
||||
/*
|
||||
If we actually want know what efficiency our held item has instead of the best one
|
||||
possible, this lets us make pathing depending on the actual tool used (if auto tool is disabled)
|
||||
*/
|
||||
if (!Baritone.settings().ignoreAutoToolMovementCost.value && pathingCalculation) {
|
||||
return player.inventory.currentItem;
|
||||
}
|
||||
|
||||
int best = 0;
|
||||
double highestSpeed = Double.NEGATIVE_INFINITY;
|
||||
int lowestCost = Integer.MIN_VALUE;
|
||||
@ -137,7 +152,7 @@ public class ToolSet {
|
||||
* @return A double containing the destruction ticks with the best tool
|
||||
*/
|
||||
private double getBestDestructionTime(Block b) {
|
||||
ItemStack stack = player.inventory.getStackInSlot(getBestSlot(b, false));
|
||||
ItemStack stack = player.inventory.getStackInSlot(getBestSlot(b, false, true));
|
||||
return calculateSpeedVsBlock(stack, b.getDefaultState()) * avoidanceMultiplier(b);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user