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;
}