Skip to content
MindScrathPublic

About

A Gradle plugin for Minecraft Mod development that automates dependency resolution and management, supporting NeoForge, Modrinth and more Maven Repos.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Librarian - Minecraft Mod Dependency Manager

GitHub license Gradle Plugin Portal 简体中文

Librarian is a Gradle plugin specifically designed for Minecraft mod development to simplify dependency management, with a particular focus on NeoForge and Modrinth integration.

Features

  • 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

Quick Start

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.11

Usage

Adding Mods

The 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")
}

Adding Mods to Multiple Configurations

librarian {
    mod("jei", "compileOnly", "clientRuntimeOnly")
}

Specifying Custom Versions

librarian {
    mod("jei") { version = "27.4.0.15" }
}

Using Custom Resolvers

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" }
}
  1. Basic Parameters:

    • name: Unique identifier for the resolver, used to reference it in mod configurations
    • baseUrl: Base URL of the Maven repository
    • group: (Optional) Maven group ID of the mod. If not provided, you need to handle it in the artifact function
  2. artifact Function:

    • Used to construct the artifact name
    • Receives three parameters: mod slug, Minecraft version, and loader type
    • Should return the complete artifact name
  3. versionFilter Function:

    • 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)
  4. notation Function:

    • 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)
  5. metadataUrl Function:

    • 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

NeoForge Integration

Librarian automatically integrates with NeoForge's mod development tools. It:

  1. Resolves the correct NeoForge version for your Minecraft version: You can use librarian.loaderVersion instead of hardcoding neo_version in gradle.properties
  2. Sets up NeoForge extension configuration
  3. Configures run configurations for NeoForge development

Available Resolvers

  • modrinth: Default resolver for Modrinth mods
  • custom resolvers: Create your own resolvers for other mod platforms

License

Librarian is licensed under the MIT License.

About

A Gradle plugin for Minecraft Mod development that automates dependency resolution and management, supporting NeoForge, Modrinth and more Maven Repos.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages