package top.r3944realms.lib39.example;

import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.common.NeoForge;
import top.r3944realms.lib39.example.core.event.ExCommonEventHandler;
import top.r3944realms.lib39.example.core.network.ExNetworkHandler;
import top.r3944realms.lib39.example.core.register.NeoForgeExLib39Items;

/**
 * The type Forge lib 39 example.
 */
public class NeoForgeLib39Example {
    private static boolean registered = false;

    /**
     * Instantiates a new Lib 39 example.
     *
     * @param modEventBus the mod event bus
     */
    public NeoForgeLib39Example(IEventBus modEventBus) {
        if (!registered) {
            init(modEventBus);
            registerToEventBus(modEventBus);
            registered = true;
        }
    }

    /**
     * Init.
     *
     * @param modEventBus the mod event bus
     */
    public void init(IEventBus modEventBus) {
        NeoForgeExLib39Items.register(modEventBus);
    }

    private void registerToEventBus(IEventBus modEventBus) {
        IEventBus modBus = modEventBus;
        IEventBus gameBus = NeoForge.EVENT_BUS;
        modBus.register(ExCommonEventHandler.Mod.class);
        gameBus.register(ExCommonEventHandler.Game.class);

    }


    /**
     * Demonstrate feature.
     */
    public void demonstrateFeature() {

    }
}