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!!!!!
This commit is contained in:
parent
b71dcba7a2
commit
12f1ec92a0
1 changed files with 16 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue