pocketmine\entity\Entity::kill PHP Method

kill() public method

public kill ( )
    public function kill()
    {
        $this->health = 0;
        $this->removeAllEffects();
        $this->scheduleUpdate();
        if ($this->getLevel()->getServer()->expEnabled) {
            $exp = mt_rand($this->getDropExpMin(), $this->getDropExpMax());
            if ($exp > 0) {
                $this->getLevel()->spawnXPOrb($this, $exp);
            }
        }
    }

Usage Example

Example #1
0
 public function kill()
 {
     parent::kill();
     foreach ($this->getDrops() as $item) {
         $this->getLevel()->dropItem($this, $item);
     }
 }
All Usage Examples Of pocketmine\entity\Entity::kill