Everything can be traced back to getBestSlot();
This commit is contained in:
parent
2ed3e10833
commit
f8872e1cd4
@ -432,10 +432,8 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
* @param ts previously calculated ToolSet
|
* @param ts previously calculated ToolSet
|
||||||
*/
|
*/
|
||||||
static void switchToBestToolFor(IPlayerContext ctx, IBlockState b, ToolSet ts, boolean preferSilkTouch) {
|
static void switchToBestToolFor(IPlayerContext ctx, IBlockState b, ToolSet ts, boolean preferSilkTouch) {
|
||||||
if (Baritone.settings().autoTool.value) {
|
|
||||||
ctx.player().inventory.currentItem = ts.getBestSlot(b.getBlock(), preferSilkTouch);
|
ctx.player().inventory.currentItem = ts.getBestSlot(b.getBlock(), preferSilkTouch);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void moveTowards(IPlayerContext ctx, MovementState state, BlockPos pos) {
|
static void moveTowards(IPlayerContext ctx, MovementState state, BlockPos pos) {
|
||||||
state.setTarget(new MovementTarget(
|
state.setTarget(new MovementTarget(
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
package baritone.utils;
|
package baritone.utils;
|
||||||
|
|
||||||
import baritone.Baritone;
|
import baritone.Baritone;
|
||||||
|
import baritone.command.argparser.DefaultArgParsers;
|
||||||
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;
|
||||||
@ -102,6 +103,11 @@ public class ToolSet {
|
|||||||
* @return An int containing the index in the tools array that worked best
|
* @return An int containing the index in the tools array that worked best
|
||||||
*/
|
*/
|
||||||
public int getBestSlot(Block b, boolean preferSilkTouch) {
|
public int getBestSlot(Block b, boolean preferSilkTouch) {
|
||||||
|
// Make all depending calculation respect auto tool value without doing unecessary calculations...
|
||||||
|
if (Baritone.settings().autoTool.value) {
|
||||||
|
return player.inventory.currentItem;
|
||||||
|
}
|
||||||
|
|
||||||
int best = 0;
|
int best = 0;
|
||||||
double highestSpeed = Double.NEGATIVE_INFINITY;
|
double highestSpeed = Double.NEGATIVE_INFINITY;
|
||||||
int lowestCost = Integer.MIN_VALUE;
|
int lowestCost = Integer.MIN_VALUE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user