pocketmine\event\entity\EntityDeathEvent::setDrops PHP Метод

setDrops() публичный Метод

public setDrops ( array $drops )
$drops array
    public function setDrops(array $drops)
    {
        $this->drops = $drops;
    }

Usage Example

Пример #1
0
 public function EntityDeathEvent(EntityDeathEvent $ev)
 {
     $entity = $ev->getEntity();
     if (!$entity instanceof BaseEntity or !isset(self::$drops[$entity::NETWORK_ID])) {
         return;
     }
     $drops = [];
     foreach (self::$drops[$entity::NETWORK_ID] as $key => $data) {
         if (!isset($data[0]) || !isset($data[1]) || !isset($data[2])) {
             unset(self::$drops[$entity::NETWORK_ID][$key]);
             continue;
         }
         $count = explode(",", $data[2]);
         $item = Item::get($data[0], $data[1]);
         $item->setCount(max(mt_rand(...$count), 0));
         $drops[] = $item;
     }
     $ev->setDrops($drops);
 }
All Usage Examples Of pocketmine\event\entity\EntityDeathEvent::setDrops