Mycel 1.4.0 API

Mycel is the shared core library of the MyCelium mods: configuration, events, scheduling, networking, registration, data files and chat helpers that work the same on Fabric, Forge and NeoForge.

Getting started

Add JitPack and the library (use a release tag):

repositories {
    maven { url 'https://jitpack.io' }
}
dependencies {
    modImplementation 'com.github.MyCelium-GG:MyCel-Lib:VERSION'   // Fabric
    // implementation 'com.github.MyCelium-GG:MyCel-Lib:VERSION'   // Forge / NeoForge
}

Then, from each loader entrypoint:


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

public static void init() {
    Mycel.initialize();
    Mycel.registerMod(META);
    ConfigBuilder builder = Mycel.config(META);
    ENABLED = builder.booleanValue("enabled", true, "Whether the feature runs.");
    CONFIG = builder.build();
}

Start at Mycel. Guides, examples and the player documentation live on the MyCelium wiki.

Compatibility

Mycel follows semantic versioning: within one major version, code compiled against an older release keeps working. Anything in my.celium.org.internal, and members not shown on this site, are not API and may change in any release. Deprecated members are removed only in the next major version.

Packages
Package
Description
The entry point: Mycel.
Client-only helpers: the generated config screen (ClientHooks) and the shared palette for screens and HUD (MycelTheme).
Helpers for writing commands in the shared Mycel chat style.
Typed, validated JSON configs: build one with Mycel.config(ModMetadata), read values through ConfigValue.
Safe JSON files for a mod's own data: atomic writes, broken files kept aside instead of overwritten.
Diagnostics behind /mycel info, /mycel mods and /mycel dump.
Swap one entity for another while keeping the state you choose.
The few loader-independent events Mycel unifies: join, leave, server lifecycle and entity replacement.
One shared logger with per-mod prefixes.
Describes a mod to Mycel: id, name, version, links and update URL.
Loader-independent packets on vanilla CustomPacketPayloads.
Which loader is running and what it knows: versions, folders, other mods.
Deferred registration of items, blocks and entity types on every loader.
Run work later, repeatedly, or off the server thread.
Support for headless unit tests of mods built on Mycel.
Translation key helpers that never crash on a missing key.
The optional, asynchronous update checker.
Small helpers for players, inventories, items, blocks, entities and chat text.