package top.r3944realms.lib39.example.compat;

import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import org.jetbrains.annotations.NotNull;
import top.r3944realms.lib39.Lib39;
import top.r3944realms.lib39.core.compat.ICompat;

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

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

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

    @Override
    public ResourceLocation 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"));
    }
}
