package ru.dbotthepony.mc.otm.registry

import net.minecraft.core.Registry
import net.minecraft.core.registries.Registries
import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType
import net.minecraftforge.eventbus.api.IEventBus
import net.minecraftforge.registries.DeferredRegister
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.data.condition.ChanceWithPlaytimeCondition
import ru.dbotthepony.mc.otm.data.condition.HasExoPackCondition
import ru.dbotthepony.mc.otm.data.condition.ItemInInventoryCondition
import ru.dbotthepony.mc.otm.data.condition.KilledByRealPlayer
import ru.dbotthepony.mc.otm.data.condition.KilledByRealPlayerOrIndirectly
import ru.dbotthepony.mc.otm.data.condition.ChanceCondition

object MLootItemConditions {
	private val registry = DeferredRegister.create(Registries.LOOT_CONDITION_TYPE, OverdriveThatMatters.MOD_ID)

	val HAS_EXOPACK: LootItemConditionType 							by registry.register("has_exopack") { LootItemConditionType(HasExoPackCondition) }
	val CHANCE_WITH_PLAYTIME: LootItemConditionType 				by registry.register("chance_with_playtime") { LootItemConditionType(ChanceWithPlaytimeCondition.SERIALIZER) }
	val ITEM_IN_INVENTORY: LootItemConditionType 					by registry.register("item_in_inventory") { LootItemConditionType(ItemInInventoryCondition.SERIALIZER) }
	val KILLED_BY_REAL_PLAYER: LootItemConditionType 				by registry.register("killed_by_real_player") { LootItemConditionType(KilledByRealPlayer) }
	val KILLED_BY_REAL_PLAYER_OR_INDIRECTLY: LootItemConditionType 	by registry.register("killed_by_real_player_or_indirectly") { LootItemConditionType(KilledByRealPlayerOrIndirectly) }
	val CHANCE: LootItemConditionType 								by registry.register("chance") { LootItemConditionType(ChanceCondition.SERIALIZER) }

	internal fun register(bus: IEventBus) {
		registry.register(bus)
	}
}
