From 705df7d50838d62162892468af59ab95bca0cc14 Mon Sep 17 00:00:00 2001 From: Ali <47182802+UnknownOre@users.noreply.github.com> Date: Thu, 14 Jul 2022 19:56:18 +0300 Subject: [PATCH 1/2] EffectManager: remove redundant check (#5153) --- src/entity/effect/EffectManager.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/entity/effect/EffectManager.php b/src/entity/effect/EffectManager.php index 81f25f185..72e47f71e 100644 --- a/src/entity/effect/EffectManager.php +++ b/src/entity/effect/EffectManager.php @@ -85,14 +85,11 @@ class EffectManager{ $index = spl_object_id($effectType); if(isset($this->effects[$index])){ $effect = $this->effects[$index]; - $hasExpired = $effect->hasExpired(); $ev = new EntityEffectRemoveEvent($this->entity, $effect); $ev->call(); if($ev->isCancelled()){ - if($hasExpired && !$ev->getEffect()->hasExpired()){ //altered duration of an expired effect to make it not get removed - foreach($this->effectAddHooks as $hook){ - $hook($ev->getEffect(), true); - } + foreach($this->effectAddHooks as $hook){ + $hook($ev->getEffect(), true); } return; } From baf75089f5f7376ce3356861a27a31b4be5d329f Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 14 Jul 2022 19:52:51 +0100 Subject: [PATCH 2/2] Entity: cancel fire damage for fireproof entities --- src/entity/Entity.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/entity/Entity.php b/src/entity/Entity.php index 84901197c..40382c564 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -522,6 +522,9 @@ abstract class Entity{ } public function attack(EntityDamageEvent $source) : void{ + if($this->isFireProof() && ($source->getCause() === EntityDamageEvent::CAUSE_FIRE || $source->getCause() === EntityDamageEvent::CAUSE_FIRE_TICK)){ + $source->cancel(); + } $source->call(); if($source->isCancelled()){ return;