Пример #1
0
 public function onActivate(Item $item, Player $player = null)
 {
     if ($player instanceof Player and $player->getFood() < 20) {
         ++$this->meta;
         $player->setFood($player->getFood() + 2);
         if ($this->meta >= 0x6) {
             $this->getLevel()->setBlock($this, new Air(), true);
         } else {
             $this->getLevel()->setBlock($this, $this, true);
         }
         return true;
     }
     return false;
 }