diff --git a/Changelog.txt b/Changelog.txt index 5e342901a..37d3cfc9a 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -31,6 +31,7 @@ Version 1.4.06-dev = Fixed Fishing treasures always having the same enchants = Fixed Smelting returning ink sacs instead of Lapis when double-dropping = Fixed bug where players could remain in party chat after leaving or being kicked from a party. + = Fixed bug where non-player arrows couldn't be deflected. ! Changed Berserk to add items to inventory rather than denying pickup ! Changed Call of the Wild, newly summoned pet's will have a custom name. (added permission node to disable this) ! Changed Chimaera Wing's recipe result to use the ingredient Material diff --git a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java index 43747925d..48dda2249 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java @@ -284,6 +284,24 @@ public final class CombatUtils { swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage()); } } + + if (damager.getType() == EntityType.ARROW) { + LivingEntity shooter = ((Arrow) damager).getShooter(); + + if (shooter instanceof Player || !SkillType.UNARMED.getPVEEnabled()) { + return; + } + + UnarmedManager unarmedManager = mcMMOPlayer.getUnarmedManager(); + + if (unarmedManager.canDeflect()) { + event.setCancelled(unarmedManager.deflectCheck()); + + if (event.isCancelled()) { + return; + } + } + } } else if (attacker instanceof Player) { Player player = (Player) attacker;