Inheritance: extends pocketmine\event\block\BlockEvent, implements pocketmine\event\Cancellable
Example #1
0
 public function onFuranceBurn(FurnaceBurnEvent $event)
 {
     $event->getFurnace()->namedtag["CookTime"] = 200;
 }
Example #2
0
 protected function checkFuel(Item $fuel)
 {
     $this->server->getPluginManager()->callEvent($ev = new FurnaceBurnEvent($this, $fuel, $fuel->getFuelTime()));
     if ($ev->isCancelled()) {
         return;
     }
     $this->namedtag->MaxTime = new Short("MaxTime", $ev->getBurnTime());
     $this->namedtag->BurnTime = new Short("BurnTime", $ev->getBurnTime());
     $this->namedtag->BurnTicks = new Short("BurnTicks", 0);
     if ($this->getBlock()->getId() === Item::FURNACE) {
         $this->getLevel()->setBlock($this, Block::get(Item::BURNING_FURNACE, $this->getBlock()->getDamage()), true);
     }
     if ($this->namedtag["BurnTime"] > 0 and $ev->isBurning()) {
         $fuel->setCount($fuel->getCount() - 1);
         if ($fuel->getCount() === 0) {
             $fuel = Item::get(Item::AIR, 0, 0);
         }
         $this->inventory->setFuel($fuel);
     }
 }
Example #3
0
 public function onFurnaceBurn(FurnaceBurnEvent $event)
 {
     $fuelSkill = SkillManager::getSkillByItem($event->getFuel());
     if (count($fuelSkill) > 0) {
         $event->setCancelled();
     }
 }