aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
author alemi <me@alemi.dev>2023-11-11 15:29:52 +0100
committer alemi <me@alemi.dev>2023-11-11 15:29:52 +0100
commit12f1ec92a0c04ac35ad81370c2183ecd2827af02 (patch)
treec72bddcb89cbe088b1c6fdd4c7fa386263a9217c /src/main
parentb71dcba7a27942a31ba8802cd607ebf6b4113e50 (diff)
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!!!!!
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/ftbsc/bscv/modules/self/AutoTool.java16
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;