From c7a5b8b0b42d2013bb918b5dd8aab4b24af6853a Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 7 Jul 2019 17:37:52 +0100 Subject: [PATCH] Fixed noDamageTicks not preventing damage when last damage cause is null noDamageTicks should make the entity completely invulnerable while active. --- src/pocketmine/entity/Living.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pocketmine/entity/Living.php b/src/pocketmine/entity/Living.php index c9030152f..3dd029596 100644 --- a/src/pocketmine/entity/Living.php +++ b/src/pocketmine/entity/Living.php @@ -541,7 +541,9 @@ abstract class Living extends Entity implements Damageable{ } public function attack(EntityDamageEvent $source) : void{ - if($this->attackTime > 0 or $this->noDamageTicks > 0){ + if($this->noDamageTicks > 0){ + $source->setCancelled(); + }elseif($this->attackTime > 0){ $lastCause = $this->getLastDamageCause(); if($lastCause !== null and $lastCause->getBaseDamage() >= $source->getBaseDamage()){ $source->setCancelled();