Librarian is a Gradle plugin specifically designed for Minecraft mod development to simplify dependency management, with a particular focus on NeoForge and Modrinth integration.
- Automatic Loader Version Resolution: Automatically determines the correct NeoForge version for your Minecraft version
- Mod Dependency Management: Easily add mods from Modrinth or other Maven repositories as dependencies with automatic version resolution
- Caching System: Caches resolved versions to improve build performance
- Simple DSL: Intuitive domain-specific language for configuring mods and dependencies
- NeoForge Integration: Seamlessly works with NeoForge mod development setup, supporting client or server-only mod configuration
Pre-requisite plugin:
Add to your build.gradle or build.gradle.kts:
plugins {
id("top.wmsnp.librarian") version "0.1.0"
}In your gradle.properties file, specify the Minecraft version:
minecraft_version=1.21.11The primary feature of Librarian is the ability to easily add mods from Modrinth and other platforms as dependencies:
// Basic usage - Add Modrinth mod to localRuntime configuration
librarian {
mod("jei")
mod("create")
}librarian {
mod("jei", "compileOnly", "clientRuntimeOnly")
}librarian {
mod("jei") { version = "27.4.0.15" }
}Librarian allows you to create custom resolvers for adding mod dependencies from any Maven repository. Here's a complete example of a custom resolver configuration:
librarian {
// Add custom resolver
resolver("jei", "https://maven.blamejared.com/", "mezz.jei"){
// Configure artifact name construction
artifact = { slug, mc, ld -> "${slug}-${mc}-${ld}" }
}
// Use custom resolver
mod("jei") { resolver = "jei" }
}-
Basic Parameters:
name: Unique identifier for the resolver, used to reference it inmodconfigurationsbaseUrl: Base URL of the Maven repositorygroup: (Optional) Maven group ID of the mod. If not provided, you need to handle it in the artifact function
-
artifactFunction:- Used to construct the artifact name
- Receives three parameters: mod slug, Minecraft version, and loader type
- Should return the complete artifact name
-
versionFilterFunction:- Used to select an appropriate version from the list returned by the repository
- Receives three parameters: list of available versions, Minecraft version, and loader type
- Should return the selected version number or
null(if no suitable version)
-
notationFunction:- Used to construct the Gradle dependency notation
- Receives three parameters: group ID, artifact name, and version number
- Should return a standard Gradle dependency notation (e.g.,
group:artifact:version)
-
metadataUrlFunction:- Used to construct the metadata URL for fetching version information
- Receives two parameters: group ID and artifact name
- Should return a complete URL pointing to the Maven metadata XML file
Librarian automatically integrates with NeoForge's mod development tools. It:
- Resolves the correct NeoForge version for your Minecraft version: You can use
librarian.loaderVersioninstead of hardcodingneo_versioningradle.properties - Sets up NeoForge extension configuration
- Configures run configurations for NeoForge development
- modrinth: Default resolver for Modrinth mods
- custom resolvers: Create your own resolvers for other mod platforms
Librarian is licensed under the MIT License.