From 3e17f5000e067d2f215208b5577f4b576fd8d92b Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 19 Dec 2024 23:34:47 +0000 Subject: [PATCH] Remove useless property --- src/entity/object/AreaEffectCloud.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/entity/object/AreaEffectCloud.php b/src/entity/object/AreaEffectCloud.php index 713cd3cb2c..d5bb67e307 100644 --- a/src/entity/object/AreaEffectCloud.php +++ b/src/entity/object/AreaEffectCloud.php @@ -81,7 +81,6 @@ public static function getNetworkTypeId() : string{ return EntityIds::AREA_EFFEC /** @var array entity ID => expiration */ protected array $victims = []; - protected int $nextUpdateAge = self::UPDATE_DELAY; protected int $maxAge = self::DEFAULT_DURATION; protected int $maxAgeChangeOnUse = self::DEFAULT_DURATION_CHANGE_ON_USE; @@ -151,7 +150,7 @@ protected function initEntity(CompoundTag $nbt) : void{ } }else{ foreach($this->potionType->getEffects() as $effect){ - $this->effectContainer->add($effect); + $this->effectContainer->add($effect->setDuration((int) round($effect->getDuration() / 4))); if($effect->getType() instanceof InstantEffect){ $this->setReapplicationDelay(0); } @@ -341,12 +340,11 @@ protected function entityBaseTick(int $tickDiff = 1) : bool{ return true; } $this->setRadius($radius); - if($this->age >= $this->nextUpdateAge){ + if($this->age >= self::UPDATE_DELAY && ($this->age % self::UPDATE_DELAY) === 0){ if($this->age > $this->maxAge){ $this->flagForDespawn(); return true; } - $this->nextUpdateAge = $this->age + self::UPDATE_DELAY; foreach($this->victims as $entityId => $expiration){ if($this->age >= $expiration){ @@ -397,7 +395,7 @@ protected function entityBaseTick(int $tickDiff = 1) : bool{ if($effect->getType() instanceof InstantEffect){ $effect->getType()->applyEffect($entity, $effect, 0.5, $this); }else{ - $entity->getEffects()->add($effect->setDuration((int) round($effect->getDuration() / 4))); + $entity->getEffects()->add($effect); } } if($this->reapplicationDelay !== 0){