Meridian

Developers

Meridian exposes a stable, read-only API plus a handful of provider interfaces so other mods can read the enchanting system's state, feed it their own blocks and items, and roll enchantments through the same engine the table uses — without a hard dependency.

Soft Dependency Setup

Compile against Meridian with modCompileOnly so it stays optional at runtime, then guard every call with a mod-loaded check.

Gradle:

repositories {
    // Sibling jars resolve from GitHub Releases through an artifact-only `rfizzle:` ivy repo.
    ivy {
        name = 'GitHubReleases'
        url = 'https://github.com'
        patternLayout {
            artifact '/[organisation]/[module]/releases/download/v[revision]/[module]-[revision].jar'
        }
        metadataSources { artifact() }
        content { includeGroup 'rfizzle' }
    }
}

dependencies {
    modCompileOnly "rfizzle:meridian:<version>"
}

Guard calls so your mod loads cleanly whether or not Meridian is present:

if (FabricLoader.getInstance().isModLoaded("meridian")) {
    // safe to touch the Meridian API here
}

MeridianAPI

Static entry points on com.rfizzle.meridian.api.MeridianAPI. Every method is read-only, never throws for a well-formed call, and never returns null.

MethodReturnsSideDescription
gatherStats(Level, BlockPos)StatCollectionBothThe clamped shelf stats (Eterna, Quanta, Arcana, Rectification, Clues, blacklist, treasure flag) an enchanting table at that position would scan right now.
getEnchantmentInfo(Holder<Enchantment>)EnchantmentInfoBothEffective max level, max loot level, level cap, power functions and enabled flag for one enchantment, config overrides applied.
getAllEnchantmentInfo()Map<ResourceKey<Enchantment>, EnchantmentInfo>BothThe same, for every registered enchantment.
getStoredPoints(Level, BlockPos, ResourceKey<Enchantment>)OptionalIntBothPoints stored for one enchantment in the Enchantment Library at that position; empty if the block is not a library.
rollLootEnchantments(ServerLevel, RandomSource, ItemStack, int, boolean)List<EnchantmentInstance>ServerRoll enchantments for a stack through Meridian's selection engine at the given power, optionally allowing treasure; clamped to each entry's loot cap. Empty when the item is unenchantable or nothing rolls.

Provider Interfaces

Implement these on your own blocks and items to take part in Meridian's mechanics. Every call the host makes into them is isolated: a provider that throws is logged once and skipped, and the table, anvil, or reload carries on.

TypeImplement onEffect
IEnchantingStatProvidera BlockContributes stats to the table scan and draws its own table particles.
BlacklistSource / TreasureFlagSourcea shelf BlockEntityBlacklists enchantments from rolling / unlocks treasure rolls while in range.
EnchantableIteman ItemPost-processes the enchantment list the table selected for that item.
MeridianReloadCallbacka listenerFabric event fired server-side at the end of /meridian reload, after config and enchantment info are rebuilt and synced.

Usage Examples

Read a table's stats

import com.rfizzle.meridian.api.MeridianAPI;
import com.rfizzle.meridian.api.StatCollection;

if (FabricLoader.getInstance().isModLoaded("meridian")) {
    StatCollection stats = MeridianAPI.gatherStats(level, tablePos);
    float eterna = stats.eterna();
}

Roll loot enchantments (server)

import com.rfizzle.meridian.api.MeridianAPI;

List<EnchantmentInstance> rolled = MeridianAPI.rollLootEnchantments(
        serverLevel, rng, stack, /* power */ 30, /* treasureAllowed */ false);
for (EnchantmentInstance inst : rolled) {
    stack.enchant(inst.enchantment, inst.level);
}

React to a config reload

import com.rfizzle.meridian.api.MeridianReloadCallback;

MeridianReloadCallback.EVENT.register(server -> {
    // re-read MeridianAPI.getAllEnchantmentInfo() here
});

Notes

  • The API package is com.rfizzle.meridian.api — everything outside it is internal and may change without notice. Types in it are annotated @Stable and hold across patch and minor versions.
  • rollLootEnchantments needs a ServerLevel; call it from server logic, not client rendering. The other accessors work on either side.
  • Meridian uses official Mojang mappings (e.g. ServerLevel, ItemStack), matching a standard 1.21.1 Fabric + Loom setup.

Building an integration and something's missing? Open an issue — the API surface grows based on real integration needs.