package net.touhoudiscord.hexucasting.api;

import com.google.common.base.Suppliers;
import net.minecraft.resources.ResourceLocation;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.function.Supplier;

public interface HexucastingAPI
{
	String MOD_ID = "hexucasting";
	Logger LOGGER = LogManager.getLogger(MOD_ID);
	
	Supplier<HexucastingAPI> INSTANCE = Suppliers.memoize(() -> {
		try {
			return (HexucastingAPI) Class.forName("net.touhoudiscord.hexucasting.common.impl.YourModAPIImpl")
								 .getDeclaredConstructor().newInstance();
		} catch (ReflectiveOperationException e) {
			LogManager.getLogger().warn("Unable to find YourModAPIImpl, using a dummy");
			return new HexucastingAPI() {
			};
		}
	});
	
	static HexucastingAPI instance() {
		return INSTANCE.get();
	}
	
	static ResourceLocation modLoc(String s) {
		return new ResourceLocation(MOD_ID, s);
	}
}
