Account for Unbreaking enchantment when using abilities

This commit is contained in:
TfT_02
2013-11-05 14:51:45 +01:00
parent af98c8eb59
commit c31f5b5782
4 changed files with 12 additions and 2 deletions

View File

@ -167,6 +167,15 @@ public class SkillUtils {
}
}
public static void handleDurabilityChange(ItemStack itemStack, int durabilityModifier, boolean handleUnbreaking) {
if (handleUnbreaking) {
double modifier = 1 / (itemStack.getEnchantmentLevel(Enchantment.DURABILITY) + 1);
durabilityModifier = (int) (durabilityModifier * modifier);
}
handleDurabilityChange(itemStack, durabilityModifier);
}
/**
* Modify the durability of an ItemStack.
*