meta = $meta; } public function getName(){ return "Burning Furnace"; } public function canBeActivated(){ return true; } public function getHardness(){ return 3.5; } public function getToolType(){ return Tool::TYPE_PICKAXE; } public function getLightLevel(){ return 13; } public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ $faces = [ 0 => 4, 1 => 2, 2 => 5, 3 => 3, ]; $this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0]; $this->getLevel()->setBlock($block, $this, true, true); $nbt = new CompoundTag("", [ new ListTag("Items", []), new StringTag("id", Tile::FURNACE), new IntTag("x", $this->x), new IntTag("y", $this->y), new IntTag("z", $this->z) ]); $nbt->Items->setTagType(NBT::TAG_Compound); if($item->hasCustomName()){ $nbt->CustomName = new StringTag("CustomName", $item->getCustomName()); } if($item->hasCustomBlockData()){ foreach($item->getCustomBlockData() as $key => $v){ $nbt->{$key} = $v; } } Tile::createTile("Furnace", $this->getLevel(), $nbt); return true; } public function onBreak(Item $item){ $this->getLevel()->setBlock($this, new Air(), true, true); return true; } public function onActivate(Item $item, Player $player = null){ if($player instanceof Player){ $furnace = $this->getLevel()->getTile($this); if(!($furnace instanceof TileFurnace)){ $nbt = new CompoundTag("", [ new ListTag("Items", []), new StringTag("id", Tile::FURNACE), new IntTag("x", $this->x), new IntTag("y", $this->y), new IntTag("z", $this->z) ]); $nbt->Items->setTagType(NBT::TAG_Compound); $furnace = Tile::createTile("Furnace", $this->getLevel(), $nbt); } if(isset($furnace->namedtag->Lock) and $furnace->namedtag->Lock instanceof StringTag){ if($furnace->namedtag->Lock->getValue() !== $item->getCustomName()){ return true; } } $player->addWindow($furnace->getInventory()); } return true; } public function getDrops(Item $item){ $drops = []; if($item->isPickaxe() >= Tool::TIER_WOODEN){ $drops[] = [Item::FURNACE, 0, 1]; } return $drops; } }