summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/ftbsc/bscv/tools/Inventory.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main/java/ftbsc/bscv/tools/Inventory.java b/src/main/java/ftbsc/bscv/tools/Inventory.java
index 23eb4a1..b47950f 100644
--- a/src/main/java/ftbsc/bscv/tools/Inventory.java
+++ b/src/main/java/ftbsc/bscv/tools/Inventory.java
@@ -21,11 +21,16 @@ public class Inventory implements ICommons {
// TODO ????????????? wtf is this is there an easier way?
public static double itemDamage(ItemStack item) {
- Collection<AttributeModifier> attrs =
+ Collection<AttributeModifier> damage_attrs =
item.getAttributeModifiers(EquipmentSlotType.MAINHAND)
.get(Attributes.ATTACK_DAMAGE);
- if (attrs.isEmpty()) return 0.;
- return Math.abs(attrs.iterator().next().getAmount());
-
+ if (damage_attrs.isEmpty()) return 0.;
+ 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;
}
}