add useSwordToMine setting.

Signed-off-by: scorbett123 <sam@corbettchocolates.com>
This commit is contained in:
scorbett123 2020-11-01 16:12:38 +00:00
parent 320a5d64a3
commit 49bc96dc7e
No known key found for this signature in database
GPG Key ID: C16B9466EBFC2DE7
2 changed files with 8 additions and 0 deletions

View File

@ -1108,6 +1108,11 @@ public final class Settings {
*/ */
public final Setting<Boolean> renderSelectionCorners = new Setting<>(true); public final Setting<Boolean> renderSelectionCorners = new Setting<>(true);
/**
* Use sword to mine.
*/
public final Setting<Boolean> useSwordToMine = new Setting<>(true);
/** /**
* Desktop notifications * Desktop notifications
*/ */

View File

@ -26,6 +26,7 @@ import net.minecraft.init.Enchantments;
import net.minecraft.init.MobEffects; import net.minecraft.init.MobEffects;
import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.item.ItemTool; import net.minecraft.item.ItemTool;
import java.util.HashMap; import java.util.HashMap;
@ -124,6 +125,8 @@ 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 (!Baritone.settings().useSwordToMine.value && itemStack.getItem() instanceof ItemSword)
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) {