pocketmine\event\entity\ExplosionPrimeEvent::getForce PHP Method

getForce() public method

public getForce ( ) : float
return float
    public function getForce()
    {
        return $this->force;
    }

Usage Example

示例#1
0
 public function onUpdate($currentTick)
 {
     if ($this->closed) {
         return false;
     }
     $this->timings->startTiming();
     $hasUpdate = parent::onUpdate($currentTick);
     if (!$this->hadCollision and $this->isCritical) {
         $this->level->addParticle(new CriticalParticle($this->add($this->width / 2 + mt_rand(-100, 100) / 500, $this->height / 2 + mt_rand(-100, 100) / 500, $this->width / 2 + mt_rand(-100, 100) / 500)));
     } elseif ($this->onGround) {
         $this->isCritical = false;
     }
     if ($this->age > 1200 or $this->isCollided) {
         $hasUpdate = true;
         if ($this->isCollided and $this->canExplode) {
             $this->server->getPluginManager()->callEvent($ev = new ExplosionPrimeEvent($this, 2.8));
             if (!$ev->isCancelled()) {
                 $explosion = new Explosion($this, $ev->getForce(), $this->shootingEntity);
                 if ($ev->isBlockBreaking()) {
                     $explosion->explodeA();
                 }
                 $explosion->explodeB();
             }
         }
         $this->kill();
     }
     $this->timings->stopTiming();
     return $hasUpdate;
 }
All Usage Examples Of pocketmine\event\entity\ExplosionPrimeEvent::getForce