mirror of https://github.com/cabaletta/baritone
Merge 136d040ee0
into f2679bea29
This commit is contained in:
commit
025b3e199c
|
@ -123,6 +123,8 @@ public class ToolSet {
|
||||||
double highestSpeed = Double.NEGATIVE_INFINITY;
|
double highestSpeed = Double.NEGATIVE_INFINITY;
|
||||||
int lowestCost = Integer.MIN_VALUE;
|
int lowestCost = Integer.MIN_VALUE;
|
||||||
boolean bestSilkTouch = false;
|
boolean bestSilkTouch = false;
|
||||||
|
int bestFortune = Integer.MIN_VALUE;
|
||||||
|
boolean isCrop = b instanceof CropBlock;
|
||||||
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);
|
||||||
|
@ -135,11 +137,13 @@ public class ToolSet {
|
||||||
}
|
}
|
||||||
double speed = calculateSpeedVsBlock(itemStack, blockState);
|
double speed = calculateSpeedVsBlock(itemStack, blockState);
|
||||||
boolean silkTouch = hasSilkTouch(itemStack);
|
boolean silkTouch = hasSilkTouch(itemStack);
|
||||||
|
int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, itemStack);
|
||||||
if (speed > highestSpeed) {
|
if (speed > highestSpeed) {
|
||||||
highestSpeed = speed;
|
highestSpeed = speed;
|
||||||
best = i;
|
best = i;
|
||||||
lowestCost = getMaterialCost(itemStack);
|
lowestCost = getMaterialCost(itemStack);
|
||||||
bestSilkTouch = silkTouch;
|
bestSilkTouch = silkTouch;
|
||||||
|
bestFortune = fortune;
|
||||||
} else if (speed == highestSpeed) {
|
} else if (speed == highestSpeed) {
|
||||||
int cost = getMaterialCost(itemStack);
|
int cost = getMaterialCost(itemStack);
|
||||||
if ((cost < lowestCost && (silkTouch || !bestSilkTouch)) ||
|
if ((cost < lowestCost && (silkTouch || !bestSilkTouch)) ||
|
||||||
|
@ -148,6 +152,7 @@ public class ToolSet {
|
||||||
best = i;
|
best = i;
|
||||||
lowestCost = cost;
|
lowestCost = cost;
|
||||||
bestSilkTouch = silkTouch;
|
bestSilkTouch = silkTouch;
|
||||||
|
bestFortune = fortune;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue