package top.r3944realms.lib39.example.compat;

import net.minecraft.resources.Identifier;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.ModList;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
import org.jetbrains.annotations.NotNull;
import top.r3944realms.lib39.Lib39;
import top.r3944realms.lib39.core.compat.INeoForgeCompat;

/**
 * The type Lib 39 compat.
 */
public class Lib39Compat implements INeoForgeCompat {
    /**
     * The Initialized.
     */
    boolean initialized = false;
    /**
     * The constant INSTANCE.
     */
    public static Lib39Compat INSTANCE = new Lib39Compat();
    /**
     * The constant ID.
     */
    public static Identifier ID = Lib39.rl("lib39");

    @Override
    public void setInitialize(boolean initialize) {
        this.initialized = initialize;
    }

    @Override
    public boolean isInitialized() {
        return initialized;
    }

    @Override
    public Identifier id() {
        return ID;
    }

    @Override
    public boolean isModLoaded() {
        return ModList.get().isLoaded("lib39");
    }

    @Override
    public void initialize() {

    }

    @Override
    public void addCommonModListener(@NotNull IEventBus modBus) {
        modBus.addListener(this::onSetUp);
    }

    private void onSetUp (@NotNull FMLCommonSetupEvent event) {
        event.enqueueWork(() -> Lib39.LOGGER.info("Loading Lib39 Compat"));
    }
}
