Mod Menu Documentation

repository·26.3·Indexed 20 days ago

https://github.com/terraformersmc/modmenu

A utility mod for Fabric and Quilt that provides a centralized interface for viewing installed mods and accessing configuration screens. It includes a Java API for mod developers to implement the ModMenuApi interface, provide custom configuration screens, and manage mod metadata, translations, and badges via fabric.mod.json or quilt.mod.json.

Tokens
1.4K
Snippets
6
Records
8
Agent score
21%

What's inside Mod Menu

  1. Set up the Mod Menu Java API dependency

    26.3

    To use the Java API, add Mod Menu as a compile-time dependency in your build.gradle.

    1. Add the Terraformers Maven repository.
    2. Add the dependency using implementation (for testing in your environment) or modCompileOnly (to compile against it without requiring it as a runtime dependency).
    // build.gradle
    repositories {
      maven {
        name = "Terraformers"
        url = "https://maven.terraformersmc.com/"
      }
    }
    
    dependencies {
      // Use modImplementation for testing, or modCompileOnly for compilation only
      implementation("com.terraformersmc:modmenu:${project.modmenu_version}")
    }
    # gradle.properties
    modmenu_version=VERSION_NUMBER_HERE
  2. Translate mod names and descriptions using the Translation API

    26.3

    You can translate your mod's name, summary, and description without changing Java code by adding translation keys to your language files.

    To translate a specific mod, use the format modmenu.<type>Translation.<your_mod_id>.

    Supported types:

    • nameTranslation (for the mod name)
    • descriptionTranslation (for the full description)
    • summaryTranslation (for a short, one-sentence description)

    Example for a mod with ID traverse in Pirate Speak:

    {
        "modmenu.nameTranslation.traverse": "Menu o' mods!",
        "modmenu.descriptionTranslation.traverse": "Menu o' mods ye installed matey!",
        "modmenu.summaryTranslation.traverse": "Menu o' mods ye installed matey!"
    }
  3. Configure Fabric metadata for Mod Menu

    26.3

    Add a modmenu block inside the custom object in your fabric.mod.json to enhance how your mod appears in Mod Menu.

    Supported keys:

    • links: An object of hyperlinks. Keys are treated as translation keys (e.g., modmenu.discord displays as "Discord"). Use your own namespace for custom keys.
    • badges: An array of strings. Supported values are library and deprecated. (client is added automatically if environment is set to client).
    • parent: Either a string (the mod ID) or an object defining a dummy parent. Used to group modules under a parent mod.
    • update_checker: A boolean. Set to false to disable the Modrinth-based update checker.

    Dummy parent objects support: id, name, description, icon, and badges.

    {
      "custom": {
        "modmenu": {
          "links": {
            "modmenu.discord": "https://discord.gg/jEGF5fb"
          },
          "badges": [ "library", "deprecated" ],
          "parent": {
            "id": "example-api",
            "name": "Example API",
            "description": "Modular example library",
            "icon": "assets/example-api-module-v1/parent_icon.png",
            "badges": [ "library" ]
          },
          "update_checker": true
        }
      }
    }
  4. Configure Quilt metadata for Mod Menu

    26.3

    For Quilt mods, the modmenu configuration block is placed at the root of the quilt.mod.json file instead of inside a custom block.

    {
      "modmenu": {
        // Configuration keys like links, badges, etc. go here
      }
    }
  5. Use ModMenuApi static helper methods

    26.3

    The ModMenuApi interface provides helper methods for creating UI elements related to Mod Menu:

    • createModsScreen(Screen previous): Returns an instance of the Mods screen.
    • createModsButtonText(): Returns the Text object used for the Mod Menu 'Mods' button.
  6. Attach Modpack badges via Java API

    26.3

    You can grant the Modpack badge to your mod (indicating it is part of a modpack) by implementing attachModpackBadges in your ModMenuApi implementation.

    @Override
    public void attachModpackBadges(Consumer<String> consumer) {
        consumer.accept("modmenu"); // Indicates that 'modmenu' is part of the modpack
    }
  7. Provide custom configuration screens via Java API

    26.3

    Implement ModMenuApi to allow users to access your mod's config screens directly from Mod Menu.

    • getModConfigScreenFactory: Use this to provide a Screen factory for your own mod's configuration.
    • getProvidedConfigScreenFactories: Use this if your mod provides configuration screens for other mods (e.g., a config library like Cloth Config).