mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Account for Unbreaking enchantment when using abilities
This commit is contained in:
parent
af98c8eb59
commit
c31f5b5782
@ -17,6 +17,7 @@ Version 1.4.08-dev
|
|||||||
= Fixed IllegalArgumentException caused by an empty Fishing treasure category
|
= Fixed IllegalArgumentException caused by an empty Fishing treasure category
|
||||||
= Fixed bug with Salvage not reading the config value for the anvil material.
|
= Fixed bug with Salvage not reading the config value for the anvil material.
|
||||||
= Fixed exploit where you could receive smelting XP for improper items
|
= Fixed exploit where you could receive smelting XP for improper items
|
||||||
|
= Fixed bug where the Unbreaking enchantment was ignored when using "Super Breaker" or "Giga Drill Breaker"
|
||||||
|
|
||||||
Version 1.4.07
|
Version 1.4.07
|
||||||
+ Added XP boost to Acrobatics when wearing Boots of Feather Falling
|
+ Added XP boost to Acrobatics when wearing Boots of Feather Falling
|
||||||
|
@ -55,6 +55,6 @@ public class ExcavationManager extends SkillManager {
|
|||||||
excavationBlockCheck(blockState);
|
excavationBlockCheck(blockState);
|
||||||
excavationBlockCheck(blockState);
|
excavationBlockCheck(blockState);
|
||||||
|
|
||||||
SkillUtils.handleDurabilityChange(getPlayer().getItemInHand(), Config.getInstance().getAbilityToolDamage());
|
SkillUtils.handleDurabilityChange(getPlayer().getItemInHand(), Config.getInstance().getAbilityToolDamage(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ public class MiningManager extends SkillManager {
|
|||||||
Material material = blockState.getType();
|
Material material = blockState.getType();
|
||||||
|
|
||||||
if (mcMMOPlayer.getAbilityMode(skill.getAbility())) {
|
if (mcMMOPlayer.getAbilityMode(skill.getAbility())) {
|
||||||
SkillUtils.handleDurabilityChange(getPlayer().getItemInHand(), Config.getInstance().getAbilityToolDamage());
|
SkillUtils.handleDurabilityChange(getPlayer().getItemInHand(), Config.getInstance().getAbilityToolDamage(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ModUtils.isCustomMiningBlock(blockState) && !ModUtils.getCustomBlock(blockState).isDoubleDropEnabled()) || material != Material.GLOWING_REDSTONE_ORE && !Config.getInstance().getDoubleDropsEnabled(skill, material)) {
|
if ((ModUtils.isCustomMiningBlock(blockState) && !ModUtils.getCustomBlock(blockState).isDoubleDropEnabled()) || material != Material.GLOWING_REDSTONE_ORE && !Config.getInstance().getDoubleDropsEnabled(skill, material)) {
|
||||||
|
@ -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.
|
* Modify the durability of an ItemStack.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user