Class Mycel

java.lang.Object
my.celium.org.Mycel

public final class Mycel extends Object
Mycel - the shared core library for the MyCelium ecosystem.

A dependent mod's entire integration looks like this:

public static final ModMetadata META =
    ModMetadata.builder("mymod", "My Mod", "1.0.0").build();

public static final ConfigValue<Boolean> ENABLED;
public static final MycelConfig CONFIG;

static {
    Mycel.initialize();          // once, from the loader entrypoint
    Mycel.registerMod(META);
    ConfigBuilder builder = Mycel.config(META);
    ENABLED = builder.booleanValue("enabled", true, "Whether the feature runs.");
    CONFIG = builder.build();
}

Initialization is idempotent and ordered: platform detection, global config, then registration of dependent mods. Expensive or blocking work (update checks) always happens asynchronously.

  • Field Details

  • Method Details

    • initialize

      public static void initialize()
      Initialises Mycel exactly once: detects the platform, loads config/mycel.json and registers Mycel itself. Loader entrypoints call this first; extra calls are ignored with a debug line.
    • isInitialized

      public static boolean isInitialized()
      Whether initialize() has run.
    • registerMod

      public static ModMetadata registerMod(ModMetadata metadata)
      Registers a dependent mod. Duplicate ids keep the first registration (warns). Queues an async update check when the mod opted in.
    • getRegisteredMods

      public static Collection<ModMetadata> getRegisteredMods()
      All registered mods in registration order.
    • config

      public static ConfigBuilder config(ModMetadata metadata)
      Starts a configuration for metadata (10-30 lines for a typical mod).
    • getConfig

      public static MycelConfig getConfig(String modId)
      The live config for a mod id, or null when the mod built none.
    • isEnabled

      public static boolean isEnabled(String modId)
      Whether a mod's functionality is enabled. Defaults to true so a missing toggle never disables a feature by accident.
    • setEnabled

      public static void setEnabled(String modId, boolean enabled)
      Enables/disables a mod at runtime without a restart.
    • getVersion

      public static String getVersion()
      Mycel's version.
    • getPlatform

      public static Platform getPlatform()
    • getLoadedMods

      public static List<LoadedMod> getLoadedMods()
      Every mod the loader has loaded (not only Mycel mods). Empty when unknown.
    • getMinecraftVersion

      public static String getMinecraftVersion()
      Minecraft version string.
    • getLoaderVersion

      public static String getLoaderVersion()
      Loader version string.
    • isClient

      public static boolean isClient()
      Whether this is a client environment.
    • getConfigDir

      public static Path getConfigDir()
      The loader's config directory.
    • isModLoaded

      public static boolean isModLoaded(String modId)
    • getModVersion

      public static String getModVersion(String modId)
    • openConfigScreen

      public static net.minecraft.client.gui.screens.Screen openConfigScreen(net.minecraft.client.gui.screens.Screen parent, String modId)
      Creates the config screen for modId (client only). Returns null on dedicated servers or when the mod has no config - so it is always safe to call; check the result for null.