mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-28 03:34:43 +02:00
Account for Unbreaking enchantment when using abilities
This commit is contained in:
@ -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.
|
||||
*
|
||||
|
Reference in New Issue
Block a user