package ru.dbotthepony.mc.otm.datagen.tags

import net.minecraft.tags.BlockTags
import net.minecraft.tags.ItemTags
import net.minecraft.world.item.Items
import net.minecraft.world.level.block.Blocks
import ru.dbotthepony.mc.otm.registry.MBlockTags
import ru.dbotthepony.mc.otm.registry.game.MBlocks
import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.game.MItems
import ru.dbotthepony.mc.otm.registry.MRegistry

fun addConstructionTags(tagsProvider: TagsProvider) {
	tagsProvider.blocks.Appender(BlockTags.BEACON_BASE_BLOCKS)
		.add(MBlocks.TRITANIUM_INGOT_BLOCK)
		.add(MBlocks.DILITHIUM_CRYSTAL_BLOCK)
		.add(MBlocks.WITHERED_STEEL_BLOCK)
		.add(MBlocks.ROFLITE_ALLOY_BLOCK)

	tagsProvider.blocks.Appender(MBlockTags.MULTIBLOCK_STRUCTURE)
		.add(MBlockTags.MULTIBLOCK_HARD_STRUCTURE, MBlockTags.MULTIBLOCK_SOFT_STRUCTURE)

	tagsProvider.blocks.Appender(MBlockTags.MULTIBLOCK_SOFT_STRUCTURE)
		.add(MBlockTags.HARDENED_GLASS)

	tagsProvider.blocks.Appender(MBlockTags.MULTIBLOCK_HARD_STRUCTURE)
		.add(MRegistry.VENT.allBlocks.values)
		.add(MRegistry.VENT_ALTERNATIVE.allBlocks.values)
		.add(MRegistry.TRITANIUM_BLOCK.allBlocks.values)
		.add(MRegistry.TRITANIUM_STRIPED_BLOCK.blocks.values.stream().flatMap { it.values.stream() })

	tagsProvider.items.Appender(MItemTags.CRAFTING_TABLES).add(Items.CRAFTING_TABLE)
	tagsProvider.items.Appender(MItemTags.WORKBENCHES).add(Items.CRAFTING_TABLE)
	tagsProvider.items.Appender(MItemTags.WORKBENCH).add(Items.CRAFTING_TABLE)
	tagsProvider.items.Appender(MItemTags.FURNACES).add(Items.FURNACE)

	tagsProvider.blocks.Appender(MBlockTags.CRAFTING_TABLES).add(Blocks.CRAFTING_TABLE)
	tagsProvider.blocks.Appender(MBlockTags.WORKBENCHES).add(Blocks.CRAFTING_TABLE)
	tagsProvider.blocks.Appender(MBlockTags.WORKBENCH).add(Blocks.CRAFTING_TABLE)

	tagsProvider.items.forge("hardened_glass").add(MRegistry.INDUSTRIAL_GLASS.allItems.values)
	tagsProvider.items.forge("hardened_glass/colorless").add(MRegistry.INDUSTRIAL_GLASS.item)
	tagsProvider.items.forge("hardened_glass/tinted").add(MRegistry.INDUSTRIAL_GLASS.items.values)

	tagsProvider.items.forge("hardened_glass_panes").add(MRegistry.INDUSTRIAL_GLASS_PANE.allItems.values)
	tagsProvider.items.forge("hardened_glass_panes/colorless").add(MRegistry.INDUSTRIAL_GLASS_PANE.item)
	tagsProvider.items.forge("hardened_glass_panes/tinted").add(MRegistry.INDUSTRIAL_GLASS_PANE.items.values)

	tagsProvider.blocks.forge("hardened_glass").add(MRegistry.INDUSTRIAL_GLASS.allBlocks.values)
	tagsProvider.blocks.forge("hardened_glass/colorless").add(MRegistry.INDUSTRIAL_GLASS.block)
	tagsProvider.blocks.forge("hardened_glass/tinted").add(MRegistry.INDUSTRIAL_GLASS.blocks.values)

	tagsProvider.blocks.forge("hardened_glass_panes").add(MRegistry.INDUSTRIAL_GLASS_PANE.allBlocks.values)
	tagsProvider.blocks.forge("hardened_glass_panes/colorless").add(MRegistry.INDUSTRIAL_GLASS_PANE.block)
	tagsProvider.blocks.forge("hardened_glass_panes/tinted").add(MRegistry.INDUSTRIAL_GLASS_PANE.blocks.values)

	MRegistry.INDUSTRIAL_GLASS.forEachItem { s, _, item -> tagsProvider.items.forge("hardened_glass/$s").add(item) }
	MRegistry.INDUSTRIAL_GLASS_PANE.forEachItem { s, _, item -> tagsProvider.items.forge("hardened_glass_panes/$s").add(item) }

	MRegistry.INDUSTRIAL_GLASS.forEachBlock { s, _, block -> tagsProvider.blocks.forge("hardened_glass/$s").add(block) }
	MRegistry.INDUSTRIAL_GLASS_PANE.forEachBlock { s, _, block -> tagsProvider.blocks.forge("hardened_glass_panes/$s").add(block) }

	tagsProvider.items.Appender(MItemTags.INDUSTRIAL_GLASS).add(MRegistry.INDUSTRIAL_GLASS.allItems.values)
	tagsProvider.blocks.Appender(MBlockTags.INDUSTRIAL_GLASS).add(MRegistry.INDUSTRIAL_GLASS.allBlocks.values)
	tagsProvider.items.Appender(MItemTags.CARGO_CRATES).add(MRegistry.CARGO_CRATES.allItems.values)
	tagsProvider.blocks.Appender(MBlockTags.CARGO_CRATES).add(MRegistry.CARGO_CRATES.allBlocks.values)

	tagsProvider.items.Appender(ItemTags.DOORS).add(MItems.TRITANIUM_DOOR.values)
	tagsProvider.blocks.Appender(BlockTags.DOORS).add(MBlocks.TRITANIUM_DOOR.values)

	tagsProvider.items.Appender(ItemTags.TRAPDOORS).add(MItems.TRITANIUM_TRAPDOOR.values)
	tagsProvider.blocks.Appender(BlockTags.TRAPDOORS).add(MBlocks.TRITANIUM_TRAPDOOR.values)

	tagsProvider.blocks.Appender(BlockTags.PRESSURE_PLATES).add(MRegistry.TRITANIUM_PRESSURE_PLATE.allBlocks.values)

	tagsProvider.blocks.Appender(BlockTags.STAIRS)
		.add(MRegistry.FLOOR_TILES_STAIRS.blocks.values)
		.add(MRegistry.TRITANIUM_STAIRS.allBlocks.values)
		.add(MRegistry.TRITANIUM_STRIPED_STAIRS.flatBlocks)
		.add(MBlocks.TRITANIUM_STRIPED_STAIRS.values)

	tagsProvider.blocks.Appender(BlockTags.SLABS)
		.add(MRegistry.TRITANIUM_SLAB.allBlocks.values)
		.add(MRegistry.TRITANIUM_STRIPED_SLAB.flatBlocks)
		.add(MRegistry.FLOOR_TILES_SLAB.blocks.values)
		.add(MBlocks.TRITANIUM_STRIPED_SLAB.values)

	tagsProvider.blocks.Appender(BlockTags.WALLS)
		.add(MRegistry.TRITANIUM_WALL.allBlocks.values)
		.add(MRegistry.TRITANIUM_STRIPED_WALL.flatBlocks)
		.add(MBlocks.TRITANIUM_STRIPED_WALL.values)

	tagsProvider.items.Appender(ItemTags.STAIRS)
		.add(MRegistry.FLOOR_TILES_STAIRS.items.values)
		.add(MRegistry.TRITANIUM_STAIRS.allItems.values)
		.add(MRegistry.TRITANIUM_STRIPED_STAIRS.flatItems)
		.add(MItems.TRITANIUM_STRIPED_STAIRS.values)

	tagsProvider.items.Appender(ItemTags.SLABS)
		.add(MRegistry.TRITANIUM_SLAB.allItems.values)
		.add(MRegistry.TRITANIUM_STRIPED_SLAB.flatItems)
		.add(MRegistry.FLOOR_TILES_SLAB.items.values)
		.add(MItems.TRITANIUM_STRIPED_SLAB.values)

	tagsProvider.items.Appender(ItemTags.WALLS)
		.add(MRegistry.TRITANIUM_WALL.allItems.values)
		.add(MRegistry.TRITANIUM_STRIPED_WALL.flatItems)
		.add(MItems.TRITANIUM_STRIPED_WALL.values)

}
