From 12f1ec92a0c04ac35ad81370c2183ecd2827af02 Mon Sep 17 00:00:00 2001 From: alemi Date: Sat, 11 Nov 2023 15:29:52 +0100 Subject: feat: allow to select prefer-looting in autoweapon yes i know that *technically* a sharp 5 axe has 3 DPS and a god sword has only 2.9411763880904593 but if a mob dies in 3 attacks, faster attacks means it will die faster, also looting is usually more important, to say nothing about fire aspect which deals DoT and sweeping edge which deals AoE damage. USE THE SWORD!!!!! --- src/main/java/ftbsc/bscv/modules/self/AutoTool.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 limit; + public final ForgeConfigSpec.ConfigValue 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; -- cgit v1.2.3-56-ga3b1