getCause() === EntityDamageEvent::CAUSE_VOID){ parent::attack($source); } } protected function initEntity(){ parent::initEntity(); if($this->namedtag->hasTag("Fuse", ShortTag::class)){ $this->fuse = $this->namedtag->getShort("Fuse"); }else{ $this->fuse = 80; } $this->setGenericFlag(self::DATA_FLAG_IGNITED, true); $this->setDataProperty(self::DATA_FUSE_LENGTH, self::DATA_TYPE_INT, $this->fuse); $this->level->broadcastLevelEvent($this, LevelEventPacket::EVENT_SOUND_IGNITE); } public function canCollideWith(Entity $entity) : bool{ return false; } public function saveNBT(){ parent::saveNBT(); $this->namedtag->setShort("Fuse", $this->fuse, true); //older versions incorrectly saved this as a byte } public function entityBaseTick(int $tickDiff = 1) : bool{ if($this->closed){ return false; } $hasUpdate = parent::entityBaseTick($tickDiff); if($this->fuse % 5 === 0){ //don't spam it every tick, it's not necessary $this->setDataProperty(self::DATA_FUSE_LENGTH, self::DATA_TYPE_INT, $this->fuse); } if(!$this->isFlaggedForDespawn()){ $this->fuse -= $tickDiff; if($this->fuse <= 0){ $this->flagForDespawn(); $this->explode(); } } return $hasUpdate or $this->fuse >= 0; } public function explode(){ $this->server->getPluginManager()->callEvent($ev = new ExplosionPrimeEvent($this, 4)); if(!$ev->isCancelled()){ $explosion = new Explosion($this, $ev->getForce(), $this); if($ev->isBlockBreaking()){ $explosion->explodeA(); } $explosion->explodeB(); } } }