package ru.dbotthepony.mc.otm.datagen.recipes

import net.minecraft.world.item.Items
import net.minecraftforge.common.Tags
import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.MItems

fun addMachineUpgradeRecipes(consumer: RecipeOutput) {
	MatteryRecipe(MItems.MachineUpgrades.Basic.BLANK, 4)
		.rowB(Items.REDSTONE)
		.rowAC(MItemTags.IRON_PLATES, MItemTags.IRON_PLATES)
		.rowB(MItems.ELECTRIC_PARTS)
		.unlockedBy(MItemTags.IRON_PLATES)
		.unlockedBy(MItems.ELECTRIC_PARTS)
		.build(consumer)

	MatteryRecipe(MItems.MachineUpgrades.Normal.BLANK, 4)
		.row(MItemTags.COPPER_WIRES, Items.REDSTONE, MItemTags.COPPER_WIRES)
		.row(MItemTags.IRON_PLATES, Items.REDSTONE, MItemTags.IRON_PLATES)
		.rowB(MItems.ELECTRIC_PARTS)
		.unlockedBy(MItemTags.IRON_PLATES)
		.unlockedBy(MItems.ELECTRIC_PARTS)
		.build(consumer)

	MatteryRecipe(MItems.MachineUpgrades.Advanced.BLANK, 4)
		.row(MItemTags.GOLD_WIRES, Items.REDSTONE, MItemTags.GOLD_WIRES)
		.row(MItemTags.TRITANIUM_PLATES, MItemTags.COPPER_WIRES, MItemTags.TRITANIUM_PLATES)
		.row(MItems.ELECTRIC_PARTS, Items.REDSTONE, MItems.ELECTRIC_PARTS)
		.unlockedBy(MItemTags.TRITANIUM_PLATES)
		.unlockedBy(MItems.ELECTRIC_PARTS)
		.build(consumer)

	for (tier in MItems.MachineUpgrades.CRAFTABLE_TIERS) {
		MatteryRecipe(tier.SPEED, 1)
			.rowB(Items.REDSTONE)
			.row(Items.SUGAR, MItemTags.COPPER_WIRES, Items.SUGAR)
			.rowB(tier.BLANK)
			.unlockedBy(tier.BLANK)
			.unlockedBy(MItemTags.COPPER_WIRES)
			.build(consumer)

		MatteryRecipe(tier.ENERGY_CONSUMPTION, 1)
			.rowB(Items.REDSTONE)
			.row(MItemTags.COPPER_WIRES, MItemTags.GOLD_WIRES, MItemTags.COPPER_WIRES)
			.rowB(tier.BLANK)
			.unlockedBy(tier.BLANK)
			.unlockedBy(MItemTags.GOLD_WIRES)
			.build(consumer)

		MatteryRecipe(tier.FAILSAFE, 1)
			.rowB(MItems.ELECTRIC_PARTS)
			.row(MItemTags.COPPER_WIRES, MItems.QUANTUM_TRANSCEIVER, MItemTags.COPPER_WIRES)
			.rowB(tier.BLANK)
			.unlockedBy(tier.BLANK)
			.unlockedBy(MItems.QUANTUM_TRANSCEIVER)
			.build(consumer)

		MatteryRecipe(tier.ENERGY_STORAGE, 1)
			.rowB(Items.REDSTONE)
			.row(Items.REDSTONE, MItems.ENERGY_BUS, Items.REDSTONE)
			.rowB(tier.BLANK)
			.unlockedBy(tier.BLANK)
			.unlockedBy(MItems.ENERGY_BUS)
			.build(consumer)

		MatteryRecipe(tier.MATTER_STORAGE, 1)
			.rowB(Tags.Items.GLASS)
			.row(Tags.Items.GLASS, MItems.MATTER_CAPACITOR_PARTS, Tags.Items.GLASS)
			.rowB(tier.BLANK)
			.unlockedBy(tier.BLANK)
			.unlockedBy(MItems.MATTER_CAPACITOR_PARTS)
			.build(consumer)

		MatteryRecipe(tier.PROCESSING_ITEMS, 1)
			.rowB(MItems.ELECTRIC_PARTS)
			.row(MItems.ELECTROMAGNET, MItemTags.TRITANIUM_PLATES, MItems.ELECTROMAGNET)
			.rowB(tier.BLANK)
			.unlockedBy(tier.BLANK)
			.unlockedBy(MItems.ELECTROMAGNET)
			.build(consumer)
	}
}
