package ru.dbotthepony.mc.otm.registry.game

import net.minecraft.core.registries.Registries
import net.minecraft.tags.TagKey
import net.minecraft.world.entity.EntityType
import net.minecraft.world.item.Item
import net.minecraft.world.item.Items
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.core.ResourceLocation
import ru.dbotthepony.mc.otm.core.collect.SupplierList
import ru.dbotthepony.mc.otm.item.consumables.NotNormalFood
import ru.dbotthepony.mc.otm.registry.MDeferredRegister

@Suppress("PropertyName")
class SuspiciousFoods(registry: MDeferredRegister<Item>) {
	val OWNED_MEAT_CONSUMERS: TagKey<EntityType<*>> = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation(OverdriveThatMatters.MOD_ID, "owned_consumes_suspicious_meat"))
	val OWNED_FISH_CONSUMERS: TagKey<EntityType<*>> = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation(OverdriveThatMatters.MOD_ID, "owned_consumes_suspicious_fish"))
	val OWNED_EXOTIC_FISH_CONSUMERS: TagKey<EntityType<*>> = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation(OverdriveThatMatters.MOD_ID, "owned_consumes_suspicious_fish"))
	val OWNED_COOKIE_CONSUMERS: TagKey<EntityType<*>> = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation(OverdriveThatMatters.MOD_ID, "owned_consumes_suspicious_cookie"))
	val OWNED_CARROT_CONSUMERS: TagKey<EntityType<*>> = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation(OverdriveThatMatters.MOD_ID, "owned_consumes_suspicious_carrot"))

	val MEAT_CONSUMERS: TagKey<EntityType<*>> = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation(OverdriveThatMatters.MOD_ID, "consumes_suspicious_meat"))
	val FISH_CONSUMERS: TagKey<EntityType<*>> = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation(OverdriveThatMatters.MOD_ID, "consumes_suspicious_fish"))
	val EXOTIC_FISH_CONSUMERS: TagKey<EntityType<*>> = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation(OverdriveThatMatters.MOD_ID, "consumes_suspicious_fish"))
	val COOKIE_CONSUMERS: TagKey<EntityType<*>> = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation(OverdriveThatMatters.MOD_ID, "consumes_suspicious_cookie"))
	val CARROT_CONSUMERS: TagKey<EntityType<*>> = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation(OverdriveThatMatters.MOD_ID, "consumes_suspicious_carrot"))

	private val meat = MEAT_CONSUMERS to OWNED_MEAT_CONSUMERS
	private val fish = FISH_CONSUMERS to OWNED_FISH_CONSUMERS
	private val efish = EXOTIC_FISH_CONSUMERS to OWNED_EXOTIC_FISH_CONSUMERS

	val APPLE by registry.register("suspicious_apple") { NotNormalFood({ Items.APPLE }) }
	val BAKED_POTATO by registry.register("suspicious_baked_potato") { NotNormalFood({ Items.BAKED_POTATO }) }
	val BEEF by registry.register("suspicious_beef") { NotNormalFood({ Items.BEEF }, meat) }
	val BEETROOT by registry.register("suspicious_beetroot") { NotNormalFood({ Items.BEETROOT }) }
	val BEETROOT_SOUP by registry.register("suspicious_beetroot_soup") { NotNormalFood({ Items.BEETROOT_SOUP }) }
	val BREAD by registry.register("suspicious_bread") { NotNormalFood({ Items.BREAD }) }
	val CARROT by registry.register("suspicious_carrot") { NotNormalFood({ Items.CARROT }, CARROT_CONSUMERS, OWNED_CARROT_CONSUMERS) }
	val CHICKEN by registry.register("suspicious_chicken") { NotNormalFood({ Items.CHICKEN }, meat) }
	val CHORUS_FRUIT by registry.register("suspicious_chorus_fruit") { NotNormalFood({ Items.CHORUS_FRUIT }) }
	val COD by registry.register("suspicious_cod") { NotNormalFood({ Items.COD }, fish) }
	val COOKED_BEEF by registry.register("suspicious_cooked_beef") { NotNormalFood({ Items.COOKED_BEEF }, meat) }
	val COOKED_CHICKEN by registry.register("suspicious_cooked_chicken") { NotNormalFood({ Items.COOKED_CHICKEN }, meat) }
	val COOKED_COD by registry.register("suspicious_cooked_cod") { NotNormalFood({ Items.COOKED_COD }, fish) }
	val COOKED_MUTTON by registry.register("suspicious_cooked_mutton") { NotNormalFood({ Items.COOKED_MUTTON }, meat) }
	val COOKED_PORKCHOP by registry.register("suspicious_cooked_porkchop") { NotNormalFood({ Items.COOKED_PORKCHOP }, meat) }
	val COOKED_RABBIT by registry.register("suspicious_cooked_rabbit") { NotNormalFood({ Items.COOKED_RABBIT }, meat) }
	val COOKED_SALMON by registry.register("suspicious_cooked_salmon") { NotNormalFood({ Items.COOKED_SALMON }, fish) }
	val COOKIE by registry.register("suspicious_cookie") { NotNormalFood({ Items.COOKIE }, COOKIE_CONSUMERS, OWNED_COOKIE_CONSUMERS) }
	val ENCHANTED_GOLDEN_APPLE by registry.register("suspicious_enchanted_golden_apple") { NotNormalFood({ Items.ENCHANTED_GOLDEN_APPLE }) }
	val GOLDEN_APPLE by registry.register("suspicious_golden_apple") { NotNormalFood({ Items.GOLDEN_APPLE }) }
	val GOLDEN_CARROT by registry.register("suspicious_golden_carrot") { NotNormalFood({ Items.GOLDEN_CARROT }, CARROT_CONSUMERS, OWNED_CARROT_CONSUMERS) }
	val MELON_SLICE by registry.register("suspicious_melon_slice") { NotNormalFood({ Items.MELON_SLICE }) }
	val MUSHROOM_STEW by registry.register("suspicious_mushroom_stew") { NotNormalFood({ Items.MUSHROOM_STEW }) }
	val MUTTON by registry.register("suspicious_mutton") { NotNormalFood({ Items.MUTTON }, meat) }
	val POISONOUS_POTATO by registry.register("suspicious_poisonous_potato") { NotNormalFood({ Items.POISONOUS_POTATO }) }
	val PORKCHOP by registry.register("suspicious_porkchop") { NotNormalFood({ Items.PORKCHOP }, meat) }
	val POTATO by registry.register("suspicious_potato") { NotNormalFood({ Items.POTATO }) }
	val PUFFERFISH by registry.register("suspicious_pufferfish") { NotNormalFood({ Items.PUFFERFISH }, efish) }
	val PUMPKIN_PIE by registry.register("suspicious_pumpkin_pie") { NotNormalFood({ Items.PUMPKIN_PIE }) }
	val RABBIT by registry.register("suspicious_rabbit") { NotNormalFood({ Items.RABBIT }, meat) }
	val RABBIT_STEW by registry.register("suspicious_rabbit_stew") { NotNormalFood({ Items.RABBIT_STEW }) }
	val ROTTEN_FLESH by registry.register("suspicious_rotten_flesh") { NotNormalFood({ Items.ROTTEN_FLESH }, meat) }
	val SALMON by registry.register("suspicious_salmon") { NotNormalFood({ Items.SALMON }, fish) }
	val SWEET_BERRIES by registry.register("suspicious_sweet_berries") { NotNormalFood({ Items.SWEET_BERRIES }) }
	val GLOW_BERRIES by registry.register("suspicious_glow_berries") { NotNormalFood({ Items.GLOW_BERRIES }) }
	val TROPICAL_FISH by registry.register("suspicious_tropical_fish") { NotNormalFood({ Items.TROPICAL_FISH }, efish) }
	
	val ITEMS = SupplierList(
		::APPLE, ::BAKED_POTATO, ::BEEF,
		::BEETROOT, ::BEETROOT_SOUP, ::BREAD, ::CARROT, ::CHICKEN, ::CHORUS_FRUIT, ::COD,
		::COOKED_BEEF, ::COOKED_CHICKEN, ::COOKED_COD, ::COOKED_MUTTON, ::COOKED_PORKCHOP, ::COOKED_RABBIT, ::COOKED_SALMON, ::COOKIE, ::ENCHANTED_GOLDEN_APPLE,
		::GOLDEN_APPLE, ::GOLDEN_CARROT, ::MELON_SLICE, ::MUSHROOM_STEW, ::MUTTON, ::POISONOUS_POTATO, ::PORKCHOP, ::POTATO,
		::PUFFERFISH, ::PUMPKIN_PIE, ::RABBIT, ::RABBIT_STEW, ::ROTTEN_FLESH, ::SALMON, ::SWEET_BERRIES, ::GLOW_BERRIES, ::TROPICAL_FISH,
	)

	// "dried_kelp" to { Items.DRIED_KELP },
	// "spider_eye" to { Items.SPIDER_EYE },
	// "honey_bottle" to { Items.HONEY_BOTTLE },
}
