/*
 *  Copyright 2025-2026 R3944Realms
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package top.r3944realms.eroticdungeongame;

import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.bernie.geckolib.GeckoLib;
import top.r3944realms.eroticdungeongame.content.recipe.EDGRecipeBookTypes;
import top.r3944realms.eroticdungeongame.content.recipe.EDGRecipeTypeCategories;
import top.r3944realms.eroticdungeongame.core.network.EDGNetworkHandler;
import top.r3944realms.eroticdungeongame.core.register.*;

@Mod(EroticDungeon.MOD_ID)
public class EroticDungeon {
    public static final String MOD_ID = "eroticdungeongame";//Erotic Dungeon Game
    public static final Logger LOGGER = LoggerFactory.getLogger(EroticDungeon.class);
    public static final IEventBus EVENT_BUS = FMLJavaModLoadingContext.get().getModEventBus();
    public EroticDungeon() {
        initialize(EVENT_BUS);
    }
    public static void initialize(IEventBus eventBus) {
        GeckoLib.initialize();
        EDGItems.register(eventBus);
        EDGBlocks.register(eventBus);
        EDGBlockEntities.register(eventBus);
        EDGCreativeTabs.register(eventBus);
        EDGEntities.register(eventBus);
        EDGSoundEvents.register(eventBus);
        EDGPois.register(eventBus);
        EDGVillagers.register(eventBus);
        EDGMenuTypes.register(eventBus);
        EDGRecipeTypes.register(eventBus);
        EDGCustomStats.register(eventBus);
        EDGRecipeSerializers.register(eventBus);
        EDGParticleTypes.register(eventBus);
        EDGEnchantments.register(eventBus);
        EDGRecipeBookTypes.init();
        EDGRecipeTypeCategories.init();
        EDGNetworkHandler.register();
    }
    @Contract("_ -> new")
    public static @NotNull ResourceLocation rl(String path) {
        return new ResourceLocation(MOD_ID, path);
    }
    @Contract("_, _ -> new")
    public static @NotNull ResourceLocation rl(String modId, String path) {
        return new ResourceLocation(modId, path);
    }
    @Contract("_ -> new")
    public static @NotNull ResourceLocation mrl(String path) {
        return new ResourceLocation(path);
    }
    public static Logger getLogger() {
        return LOGGER;
    }
    /**
     * The type Mod info.
     */
    public static class ModInfo {
        /**
         * The constant VERSION.
         */
        public static final String VERSION;
        static {
            // 从 ModList 获取当前 ModContainer 的元数据
            VERSION = ModList.get()
                    .getModContainerById(MOD_ID)
                    .map(c -> c.getModInfo().getVersion().toString())
                    .orElse("UNKNOWN");
        }
    }

}
