Living: fix being unable to die in the void

This commit is contained in:
Dylan K. Taylor 2020-06-02 23:18:40 +01:00
parent 734bc6c4a7
commit 915224c8e5

View File

@ -437,6 +437,9 @@ abstract class Living extends Entity implements Damageable{
*/
public function applyDamageModifiers(EntityDamageEvent $source) : void{
if($this->lastDamageCause !== null and $this->attackTime > 0){
if($this->lastDamageCause->getBaseDamage() >= $source->getBaseDamage()){
$source->setCancelled();
}
$source->setModifier(-$this->lastDamageCause->getBaseDamage(), EntityDamageEvent::MODIFIER_PREVIOUS_DAMAGE_COOLDOWN);
}
if($source->canBeReducedByArmor()){