package ru.dbotthepony.mc.otm.registry

import net.minecraft.core.registries.Registries
import net.minecraft.tags.TagKey
import net.minecraft.world.entity.npc.VillagerProfession
import net.minecraft.world.entity.npc.VillagerTrades
import net.minecraft.world.level.levelgen.structure.Structure
import net.minecraft.world.level.saveddata.maps.MapDecorationTypes
import net.neoforged.neoforge.event.village.VillagerTradesEvent
import ru.dbotthepony.mc.otm.OverdriveThatMatters.loc

object MStructureTags {
	val LABORATORIES = create("laboratories")
	val FIELD_RESEARCH_PODS = create("field_research_pods")
	val WRECKAGES = create("wreckages")

	fun create(location: String): TagKey<Structure> {
		return TagKey.create(Registries.STRUCTURE, loc(location))
	}

	fun registerVillagerTrades(event: VillagerTradesEvent) {
		if (event.type == VillagerProfession.CARTOGRAPHER) {
			with (event.trades.get(2)) {
				add(VillagerTrades.TreasureMapForEmeralds(10, WRECKAGES, "filled_map.otm_wreckage",
					MapDecorationTypes.RED_X, 12, 5))
			}
			with (event.trades.get(3)) {
				add(VillagerTrades.TreasureMapForEmeralds(25, LABORATORIES, "filled_map.otm_laboratory",
					MapDecorationTypes.LIGHT_BLUE_BANNER, 12, 10))
			}
		}
	}
}
