diff options
-rw-r--r-- | src/main/java/ftbsc/bscv/modules/self/AutoTool.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/ftbsc/bscv/modules/self/AutoTool.java b/src/main/java/ftbsc/bscv/modules/self/AutoTool.java index 1474085..c37a8a2 100644 --- a/src/main/java/ftbsc/bscv/modules/self/AutoTool.java +++ b/src/main/java/ftbsc/bscv/modules/self/AutoTool.java @@ -1,11 +1,14 @@ package ftbsc.bscv.modules.self; import com.google.auto.service.AutoService; + +import ftbsc.bscv.Boscovicino; import ftbsc.bscv.api.ILoadable; import ftbsc.bscv.modules.AbstractModule; import ftbsc.bscv.tools.Inventory; import ftbsc.bscv.tools.Setting; import net.minecraft.block.BlockState; +import net.minecraft.enchantment.Enchantments; import net.minecraft.inventory.container.Slot; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockRayTraceResult; @@ -19,6 +22,7 @@ import java.util.List; public class AutoTool extends AbstractModule { public final ForgeConfigSpec.ConfigValue<Integer> limit; + public final ForgeConfigSpec.ConfigValue<Boolean> prefer_looting; public AutoTool() { super(); @@ -28,6 +32,12 @@ public class AutoTool extends AbstractModule { .comment("durability limit for tools, set to 0 to destroy them") .fallback(1) .build(this); + + this.prefer_looting = Setting.Bool.builder() + .name("prefer-looting") + .comment("when picking best weapon, prefer looting over slight more DPS") + .fallback(true) + .build(this); } private boolean itemIsTooDamaged(ItemStack item) { @@ -47,6 +57,12 @@ public class AutoTool extends AbstractModule { } double damage = Inventory.itemDPS(item); + + int looting = Inventory.getEnchLevel(item, Enchantments.MOB_LOOTING); + if (this.prefer_looting.get() && looting > 0) { + damage += 0.1 * looting; + } + if (damage > current_damage) { current_slot = i; current_damage = damage; |