From d6e05c90fea2ab3afb1e1e118a4839248a83b70c Mon Sep 17 00:00:00 2001 From: "Dylan T." Date: Fri, 26 Sep 2025 19:18:32 +0100 Subject: [PATCH] EndCrystal: defer explosion until next tick update (#6801) --- src/entity/object/EndCrystal.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/entity/object/EndCrystal.php b/src/entity/object/EndCrystal.php index 74c7664bf..2b79773dc 100644 --- a/src/entity/object/EndCrystal.php +++ b/src/entity/object/EndCrystal.php @@ -52,6 +52,8 @@ class EndCrystal extends Entity implements Explosive{ protected bool $showBase = false; protected ?Vector3 $beamTarget = null; + private bool $primed = false; + protected function getInitialSizeInfo() : EntitySizeInfo{ return new EntitySizeInfo(2.0, 2.0); } protected function getInitialDragMultiplier() : float{ return 1.0; } @@ -88,11 +90,9 @@ class EndCrystal extends Entity implements Explosive{ parent::attack($source); if( $source->getCause() !== EntityDamageEvent::CAUSE_VOID && - !$this->isFlaggedForDespawn() && !$source->isCancelled() ){ - $this->flagForDespawn(); - $this->explode(); + $this->primed = true; } } @@ -125,6 +125,13 @@ class EndCrystal extends Entity implements Explosive{ return $nbt; } + protected function onDeathUpdate(int $tickDiff) : bool{ + if($this->primed){ + $this->explode(); + } + return true; + } + public function explode() : void{ $ev = new EntityPreExplodeEvent($this, 6); $ev->call();