Inheritance: extends Spawnable, implements pocketmine\inventory\InventoryHolder, implements pocketmine\tile\Container, implements pocketmine\tile\Nameable
Esempio n. 1
0
 public function __construct(Furnace $furnace, Item $fuel, $burnTime)
 {
     parent::__construct($furnace->getBlock());
     $this->fuel = $fuel;
     $this->burnTime = (int) $burnTime;
     $this->furnace = $furnace;
 }
Esempio n. 2
0
 public function __construct(Furnace $furnace, Item $source, Item $result)
 {
     parent::__construct($furnace->getBlock());
     $this->source = clone $source;
     $this->source->setCount(1);
     $this->result = $result;
     $this->furnace = $furnace;
 }
Esempio n. 3
0
 public function onActivate(Item $item, Player $player = null)
 {
     if ($player instanceof Player) {
         $t = $this->getLevel()->getTile($this);
         $furnace = false;
         if ($t instanceof Furnace) {
             $furnace = $t;
         } else {
             $nbt = new Compound(false, [new Enum("Items", []), new String("id", Tile::FURNACE), new Int("x", $this->x), new Int("y", $this->y), new Int("z", $this->z)]);
             $nbt->Items->setTagType(NBT::TAG_Compound);
             $furnace = new Furnace($this->getLevel()->getChunkAt($this->x >> 4, $this->z >> 4), $nbt);
         }
         if (($player->getGamemode() & 0x1) === 0x1) {
             return true;
         }
         $player->addWindow($furnace->getInventory());
     }
     return true;
 }