events.listen('recipes', function (event) {

  event.replaceOutput('#forge:dusts/coal', 'wtbw_machines:coal_dust')
  event.replaceOutput('#forge:dusts/charcoal', 'wtbw_machines:charcoal_dust')

  var unifyMetal = function (name, ingotItem, dustItem, blockItem, nuggetItem) {
		event.replaceOutput('#forge:ingots/' + name, ingotItem)
		event.replaceOutput('#forge:dusts/' + name, dustItem)
		event.replaceOutput('#forge:nuggets/' + name, nuggetItem)
		event.replaceOutput('#forge:storage_blocks/' + name, blockItem)
		event.remove({ output: '#forge:ingots/' + name, type: 'minecraft:smelting' })
		event.remove({ output: '#forge:ingots/' + name, type: 'minecraft:blasting' })
		event.recipes.minecraft.smelting(ingotItem, '#forge:dusts/' + name)
		event.recipes.minecraft.smelting(ingotItem, '#forge:ores/' + name)
		event.recipes.minecraft.blasting(ingotItem, '#forge:dusts/' + name)
		event.recipes.minecraft.blasting(ingotItem, '#forge:ores/' + name)
    }

  unifyMetal('iron', 'minecraft:iron_ingot', 'wtbw_machines:iron_dust', 'minecraft:iron_block', 'minecraft:iron_nugget')
  unifyMetal('gold', 'minecraft:gold_ingot', 'wtbw_machines:gold_dust', 'minecraft:gold_block', 'minecraft:gold_nugget')
  unifyMetal('copper', 'usefulfoundation:copper_ingot', 'wtbw_machines:copper_dust', 'wtbw_core:copper_block', 'usefulfoundation:copper_nugget')

  }
)
