Class Mycel
java.lang.Object
my.celium.org.Mycel
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final ModMetadataMycel's own metadata (registered automatically oninitialize()).static final StringMycel's own mod id.static final StringMycel's version. -
Method Summary
Modifier and TypeMethodDescriptionstatic ConfigBuilderconfig(ModMetadata metadata) Starts a configuration formetadata(10-30 lines for a typical mod).static MycelConfigThe live config for a mod id, ornullwhen the mod built none.static PathThe loader'sconfigdirectory.Every mod the loader has loaded (not only Mycel mods).static StringLoader version string.static StringMinecraft version string.static StringgetModVersion(String modId) static Platformstatic Collection<ModMetadata> All registered mods in registration order.static StringMycel's version.static voidInitialises Mycel exactly once: detects the platform, loadsconfig/mycel.jsonand registers Mycel itself.static booleanisClient()Whether this is a client environment.static booleanWhether a mod's functionality is enabled.static booleanWhetherinitialize()has run.static booleanisModLoaded(String modId) static net.minecraft.client.gui.screens.ScreenopenConfigScreen(net.minecraft.client.gui.screens.Screen parent, String modId) Creates the config screen formodId(client only).static ModMetadataregisterMod(ModMetadata metadata) Registers a dependent mod.static voidsetEnabled(String modId, boolean enabled) Enables/disables a mod at runtime without a restart.
-
Field Details
-
MOD_ID
-
VERSION
-
METADATA
Mycel's own metadata (registered automatically oninitialize()).
-
-
Method Details
-
initialize
public static void initialize()Initialises Mycel exactly once: detects the platform, loadsconfig/mycel.jsonand registers Mycel itself. Loader entrypoints call this first; extra calls are ignored with a debug line. -
isInitialized
public static boolean isInitialized()Whetherinitialize()has run. -
registerMod
Registers a dependent mod. Duplicate ids keep the first registration (warns). Queues an async update check when the mod opted in. -
getRegisteredMods
All registered mods in registration order. -
config
Starts a configuration formetadata(10-30 lines for a typical mod). -
getConfig
The live config for a mod id, ornullwhen the mod built none. -
isEnabled
Whether a mod's functionality is enabled. Defaults totrueso a missing toggle never disables a feature by accident. -
setEnabled
Enables/disables a mod at runtime without a restart. -
getVersion
Mycel's version. -
getPlatform
-
getLoadedMods
-
getMinecraftVersion
Minecraft version string. -
getLoaderVersion
Loader version string. -
isClient
public static boolean isClient()Whether this is a client environment. -
getConfigDir
The loader'sconfigdirectory. -
isModLoaded
-
getModVersion
-
openConfigScreen
public static net.minecraft.client.gui.screens.Screen openConfigScreen(net.minecraft.client.gui.screens.Screen parent, String modId) Creates the config screen formodId(client only). Returnsnullon dedicated servers or when the mod has no config - so it is always safe to call; check the result fornull.
-