Merge pull request #2138 from scorbett123/swordSaver

add useSwordToMine setting.
This commit is contained in:
Leijurv 2021-02-08 16:54:37 -08:00 committed by GitHub
commit 4132d6ff61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

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

View File

@ -26,6 +26,7 @@ import net.minecraft.init.Enchantments;
import net.minecraft.init.MobEffects;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.item.ItemTool;
import java.util.HashMap;
@ -124,6 +125,10 @@ public class ToolSet {
IBlockState blockState = b.getDefaultState();
for (int i = 0; i < 9; i++) {
ItemStack itemStack = player.inventory.getStackInSlot(i);
if (!Baritone.settings().useSwordToMine.value && itemStack.getItem() instanceof ItemSword) {
continue;
}
if (Baritone.settings().itemSaver.value && itemStack.getItemDamage() >= itemStack.getMaxDamage() && itemStack.getMaxDamage() > 1) {
continue;
}