package net.touhoudiscord.hexucasting.fabric

import net.fabricmc.api.ModInitializer
import net.minecraft.core.Registry
import net.minecraft.resources.ResourceLocation
import net.touhoudiscord.hexucasting.api.HexucastingAPI
import net.touhoudiscord.hexucasting.common.casting.Patterns
import java.util.function.BiConsumer

object FabricHexucastingInitializer : ModInitializer {

    override fun onInitialize() {
        HexucastingAPI.LOGGER.info("Hello Fabric World!")

        FabricHexucastingConfig.setup()

        initListeners()

        initRegistries()

        Patterns.registerPatterns()
    }

    private fun initListeners() {}

    private fun initRegistries() {}


    private fun <T> bind(registry: Registry<in T>): BiConsumer<T, ResourceLocation> =
        BiConsumer<T, ResourceLocation> { t, id -> Registry.register(registry, id, t) }
}