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