Skip to content
MehVahdJukaar edited this page Jul 25, 2026 · 3 revisions

Moonlight Library

A library mod with the shared code and utilities I use across my mods. Formerly Selene.

Some of it is the usual multiloader plumbing so you can write one codebase for NeoForge, Forge and Fabric. The rest is stuff you won't find elsewhere: generating textures and models at runtime, detecting every wood type in the game and registering blocks for them, a whole config system with its own screen, virtual fluids, fake levels.

Adding it to your mod

repositories {
    maven { url = uri("https://registry.somethingcatchy.net/repository/maven-public/") }
}
// common
modCompileOnly("net.mehvahdjukaar:moonlight-common:$moonlight_version")

// fabric
modImplementation("net.mehvahdjukaar:moonlight-fabric:$moonlight_version")
modRuntimeOnly("net.mehvahdjukaar:codecui-fabric:$codecui_version")

// neoforge
modImplementation("net.mehvahdjukaar:moonlight-neoforge:$moonlight_version")
modRuntimeOnly("net.mehvahdjukaar:codecui-neoforge:$codecui_version")

Important

codecui is required now. It's bundled with JiJ so players never install it themselves, but it isn't on the dev runtime classpath, so without those modRuntimeOnly lines your dev game crashes with a NoClassDefFoundError.

Versions are the full <mc version>-<mod version> strings, like 1.21.1-3.1.4d. Full setup, including the access transformer and what your mod init should look like, is on Getting Started.

Tip

Every page links a matching example class from the repo, which is the fastest way to see a feature in use.

If you're only here for one thing

These are the ones that replace a whole other dependency, or that nothing else does:

Platform Helpers Write once for both loaders. The Architectury slot
Configs + Config Screen Fully featured config system and a full in game screen
Runtime Resource Packs Generate textures, models, recipes and lang while the game loads
Texture Manipulation Palettes and respriting, in code
Block Set API Find every wood or leaves type installed and register a block per type
Global Datapack Folder One folder of datapacks that applies to every world
Fake Levels A Level with no world behind it, for previews and simulation

For modders

Basics Getting Started · Platform Helpers · Registration · Networking · Events · Configs · Config Screen

Resources Runtime Resource Packs · Texture Manipulation · Resource Helpers · Block Set API

Client Custom Models · Item Rendering · Rendered Textures · Post Shaders · GUI Toolkit · Colors

World and gameplay Block and Item Interfaces · Additional Item Placements · Improved Entities · Fake Levels · World Data · Dispenser Behaviors · Spawn Boxes

Utilities Codec Utilities · Misc Helpers · Commands

For pack makers

These need no code, just a datapack:

Links

CurseForge · Modrinth · GitHub

Clone this wiki locally