mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 00:07:30 +00:00
Only reduce durability when armor reduced damage. (#5444)
https://minecraft.fandom.com/wiki/Durability#Armor_durability
This commit is contained in:
parent
174c9a48f5
commit
1d4b6dc66e
@ -455,7 +455,9 @@ abstract class Living extends Entity{
|
||||
*/
|
||||
protected function applyPostDamageEffects(EntityDamageEvent $source) : void{
|
||||
$this->setAbsorption(max(0, $this->getAbsorption() + $source->getModifier(EntityDamageEvent::MODIFIER_ABSORPTION)));
|
||||
$this->damageArmor($source->getBaseDamage());
|
||||
if($source->canBeReducedByArmor()){
|
||||
$this->damageArmor($source->getBaseDamage());
|
||||
}
|
||||
|
||||
if($source instanceof EntityDamageByEntityEvent && ($attacker = $source->getDamager()) !== null){
|
||||
$damage = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user