fix: try to consider attack speed for tool dps
This commit is contained in:
parent
184aa773ba
commit
36dfda2d4c
1 changed files with 9 additions and 4 deletions
|
@ -21,11 +21,16 @@ public class Inventory implements ICommons {
|
||||||
|
|
||||||
// TODO ????????????? wtf is this is there an easier way?
|
// TODO ????????????? wtf is this is there an easier way?
|
||||||
public static double itemDamage(ItemStack item) {
|
public static double itemDamage(ItemStack item) {
|
||||||
Collection<AttributeModifier> attrs =
|
Collection<AttributeModifier> damage_attrs =
|
||||||
item.getAttributeModifiers(EquipmentSlotType.MAINHAND)
|
item.getAttributeModifiers(EquipmentSlotType.MAINHAND)
|
||||||
.get(Attributes.ATTACK_DAMAGE);
|
.get(Attributes.ATTACK_DAMAGE);
|
||||||
if (attrs.isEmpty()) return 0.;
|
if (damage_attrs.isEmpty()) return 0.;
|
||||||
return Math.abs(attrs.iterator().next().getAmount());
|
double damage = Math.abs(damage_attrs.iterator().next().getAmount());
|
||||||
|
Collection<AttributeModifier> speed_attrs =
|
||||||
|
item.getAttributeModifiers(EquipmentSlotType.MAINHAND)
|
||||||
|
.get(Attributes.ATTACK_SPEED);
|
||||||
|
if (speed_attrs.isEmpty()) return damage;
|
||||||
|
double speed = Math.abs(speed_attrs.iterator().next().getAmount());
|
||||||
|
return damage * speed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue