{"id":20292814,"url":"https://github.com/groovymc/modsdotgroovy","last_synced_at":"2025-04-11T11:23:40.706Z","repository":{"id":56744036,"uuid":"524483403","full_name":"GroovyMC/ModsDotGroovy","owner":"GroovyMC","description":"A Gradle plugin that converts a mods.groovy to mods.toml, fabric.mod.json and quilt.mod.json","archived":false,"fork":false,"pushed_at":"2024-12-21T20:05:43.000Z","size":1145,"stargazers_count":4,"open_issues_count":3,"forks_count":3,"subscribers_count":3,"default_branch":"v2","last_synced_at":"2025-03-25T07:41:43.564Z","etag":null,"topics":["fabricmc","forge","gradle-plugin","minecraft","neoforged","quiltmc"],"latest_commit_sha":null,"homepage":"https://groovymc.org/mdg","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GroovyMC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-13T18:55:11.000Z","updated_at":"2024-12-21T20:05:46.000Z","dependencies_parsed_at":"2023-02-12T22:45:39.937Z","dependency_job_id":"87ae3fff-0026-491a-8e84-4d026ff18f2c","html_url":"https://github.com/GroovyMC/ModsDotGroovy","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GroovyMC%2FModsDotGroovy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GroovyMC%2FModsDotGroovy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GroovyMC%2FModsDotGroovy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GroovyMC%2FModsDotGroovy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GroovyMC","download_url":"https://codeload.github.com/GroovyMC/ModsDotGroovy/tar.gz/refs/heads/v2","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248382292,"owners_count":21094559,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fabricmc","forge","gradle-plugin","minecraft","neoforged","quiltmc"],"created_at":"2024-11-14T15:19:27.018Z","updated_at":"2025-04-11T11:23:40.684Z","avatar_url":"https://github.com/GroovyMC.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ModsDotGroovy\n[![Version](https://img.shields.io/maven-central/v/org.groovymc.modsdotgroovy/modsdotgroovy?style=for-the-badge\u0026color=blue\u0026label=Latest%20Version\u0026prefix=v)](https://central.sonatype.com/artifact/org.groovymc.modsdotgroovy/modsdotgroovy/)\n\nModsDotGroovy v2 is a tool that allows writing Minecraft mod metadata files in Groovy which is then compiled down to\na `mods.toml`, `fabric.mod.json`, `quilt.mod.json` and/or `plugin.yml` when the mod is built.\n\nIt features a swappable frontend for adjusting IDE suggestions based on your target mod loader and a plugin system for\nadding support for new platforms and functionality.\n\n## Getting started\nTo start using mods.groovy, simply add the plugin to your `build.gradle`:\n```groovy\nplugins {\n    id 'org.groovymc.modsdotgroovy' version '2.0.0'\n}\n```\n\nThen add a `mods.groovy` file to your resources folder:\n```\n└──📂 src\n   └──📂 main\n      └──📂 resources\n         └──📄 mods.groovy\n```\n\nYou can find examples of mods.groovy files in the Test directory of this repo.\n\nBy default, the Gradle plugin detects your platform and sets up the right mods.groovy DSL frontend and plugins for you.\nThe built toml/json files are put in your built jar in the place your chosen mod loader expects.\n\n## Usage\nThis varies a bit depending on your chosen platform, as we try to maintain familiarity with your existing platform's\nformat where possible. Some plugins may provide smart defaults, such as generating a functional `updateJsonUrl` on Forge\nwhen it detects that you've set a working CurseForge link as your `displayUrl`.\n\nRefer to the documentation for your specific platform for more details:\n- [Forge]() (todo)\n- [Fabric]() (todo)\n- [Quilt]() (todo)\n- [Spigot]() (todo)\n- [Multiplatform]() (todo)\n\nHowever, the following is a general guide that should work in most cases:\n- Your mods.groovy file should start with `ModsDotGroovy.make {` or `(platform name)ModsDotGroovy.make {` (e.g.: `FabricModsDotGroovy.make {`)\n- When inside a closure (the `{}`), you can type `it.` to get IDE suggestions based on your current context\n- You can access build properties with `buildProperties['name']`\n    - You may need to cast these to booleans or ints where appropriate (e.g. `buildProperties['enableSpecialThing'] as boolean`)\n- Avoid using the `this` keyword as it refers to the script context rather than your mods.groovy closure context, which may cause unexpected behaviour.\n\n## Customising mods.groovy\n### Adding plugins\nYou can add additional mods.groovy plugins for supporting more platforms, adding additional validation,\nnew functionality, and more.\n\nTo do so, add an `mdgPlugin` dependency to your project and the Gradle plugin should pick it up. Here's an example\nof adding the stock plugins:\n```groovy\ndependencies {\n    mdgPlugin 'org.groovymc.modsdotgroovy:stock-plugins'\n}\n```\nNote! The stock plugins are automatically added for you by the Gradle plugin, unless you explicitly tell it not to\n(see [automatic configuration and setup](#automatic-configuration-and-setup)).\n\n### Changing DSL frontends\nThe frontend DSL is what determines IDE support and routes your code to the plugins. These can be swapped out to\nimprove IDE support, as you'll only get suggestions for things that apply to your specific platform(s).\n\nTo do so, add an `mdgFrontend` dependency to your project and the Gradle plugin should pick it up. Here's an example\nof using the stock multiplatform frontend:\n```groovy\ndependencies {\n    mdgFrontend 'org.groovymc.modsdotgroovy:frontend-dsl-multiplatform'\n}\n```\nNote! Stock frontends are automatically swapped out for you by the Gradle plugin, unless you explicitly tell it not to\n(see [automatic configuration and setup](#automatic-configuration-and-setup)).\n\n### Changing platforms\nOn Gradle, you can explicitly define which platform(s) you want. This is auto-detected if omitted.\n```groovy\nimport org.groovymc.modsdotgroovy.types.core.Platform\n\nmodsDotGroovy {\n    platform = Platform.FORGE\n}\n\n```\nYou can also specify a list for multiplatform:\n```groovy\nimport org.groovymc.modsdotgroovy.types.core.Platform\n\nmodsDotGroovy {\n    platform = [Platform.FORGE, Platform.FABRIC]\n}\n```\n\nThis determines the output format (for example, mods.toml for `Platform.FORGE`) as well as which plugins and frontend\nto use (unless you explicitly tell the Gradle plugin not to set up the DSL and plugins for you).\n\n### Providing build properties\nIn mods.groovy, you can access build properties you expose with `buildProperties['propertyName']`. To do so, you must\nfirst explicitly tell mods.groovy to include them:\n```groovy\nmodsDotGroovy.gather {\n    projectProperty 'propertyName'\n}\n```\n\n### Automatic configuration and setup\nMost of the time you don't need to turn this off, but for the edge-cases where you do, you can do so with:\n```groovy\nmodsDotGroovy {\n    // creates the modsDotGroovyToX Gradle tasks, using the mods.groovy file in your main sourceset as the input\n    automaticConfiguration = false\n    \n    // adds the right frontend DSL to your project based on the detected (or explicitly defined) platform\n    setupDsl = false\n    \n    // adds the stock plugins to your project\n    setupPlugins = false\n  \n    // attempts to automatically infer details such as platform or minecraft version for you project\n    inferGether = false\n}\n```\n\n## Extending mods.groovy\nIf you're a developer interested in writing your own plugins or frontend DSLs, refer to the developer guide for more\ninformation.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgroovymc%2Fmodsdotgroovy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgroovymc%2Fmodsdotgroovy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgroovymc%2Fmodsdotgroovy/lists"}