[{"data":1,"prerenderedAt":233},["ShallowReactive",2],{"docs-\u002Fbuild-logic\u002Fconsumer":3},{"id":4,"title":5,"body":6,"description":223,"extension":224,"meta":225,"navTitle":226,"navigation":227,"path":228,"rawbody":229,"seo":230,"stem":231,"__hash__":232},"docs\u002Fbuild-logic\u002Fconsumer.md","Using It In A Mod",{"type":7,"value":8,"toc":214},"minimark",[9,13,26,31,38,51,61,64,93,97,107,113,129,133,136,142,146,157,165,171,175,186,192],[10,11,5],"h1",{"id":12},"using-it-in-a-mod",[14,15,16,17,21,22,25],"p",{},"The ",[18,19,20],"code",{},"magicutils.consumer-*"," plugins wire MagicUtils into your own module. Instead\nof declaring dependencies, shadow config, and run tasks by hand, you apply one\nplugin per platform module and describe what you need in ",[18,23,24],{},"magicutilsConsumer { }",".",[27,28,30],"h2",{"id":29},"apply-the-plugin","Apply The Plugin",[14,32,33,34,37],{},"Each platform module applies the matching consumer plugin. It brings in\n",[18,35,36],{},"java-library",", the shadow plugin, and the MagicUtils target\u002Frepository\nconventions:",[14,39,40,41,44,45,50],{},"The plugin version is declared once in ",[18,42,43],{},"pluginManagement"," (see\n",[46,47,49],"a",{"href":48},"\u002Fbuild-logic\u002Foverview","Overview","), so the module just applies it by id:",[52,53,59],"pre",{"className":54,"code":56,"language":57,"meta":58},[55],"language-kotlin","plugins {\n    id(\"magicutils.consumer-bukkit\")\n}\n\nmagicutilsConsumer {\n    \u002F\u002F Defaults to the `magicutils_version` gradle property, else this project's\n    \u002F\u002F version. Set it explicitly to pin a MagicUtils release.\n    magicutilsVersion.set(\"1.27.1\")\n\n    \u002F\u002F Modules to pull in. api(...) exposes them to dependents; implementation(...)\n    \u002F\u002F keeps them internal.\n    implementation(\"config\", \"commands\", \"lang\")\n}\n","kotlin","",[18,60,56],{"__ignoreMap":58},[14,62,63],{},"The consumer plugin per platform:",[65,66,67,73,78,83,88],"ul",{},[68,69,70],"li",{},[18,71,72],{},"magicutils.consumer-bukkit",[68,74,75],{},[18,76,77],{},"magicutils.consumer-fabric",[68,79,80],{},[18,81,82],{},"magicutils.consumer-velocity",[68,84,85],{},[18,86,87],{},"magicutils.consumer-bungee",[68,89,90],{},[18,91,92],{},"magicutils.consumer-neoforge",[27,94,96],{"id":95},"embedded-vs-shared","Embedded vs Shared",[14,98,99,102,103,106],{},[18,100,101],{},"embedMagicUtils"," (default ",[18,104,105],{},"true",") controls whether MagicUtils is shaded into\nyour artifact or expected as a separate install on the server:",[52,108,111],{"className":109,"code":110,"language":57,"meta":58},[55],"magicutilsConsumer {\n    \u002F\u002F false: depend on a shared MagicUtils bundle installed on the server\n    \u002F\u002F (magicutils-bukkit-bundle \u002F magicutils-fabric-bundle), don't shade it in.\n    embedMagicUtils.set(false)\n}\n",[18,112,110],{"__ignoreMap":58},[14,114,115,116,119,120,123,124,128],{},"You can also set it from the command line or ",[18,117,118],{},"gradle.properties"," with\n",[18,121,122],{},"-Pmagicutils_embed=false",". See ",[46,125,127],{"href":126},"\u002Fgetting-started\u002Finstallation","Installation"," for\nthe embedded vs shared trade-off.",[27,130,132],{"id":131},"selecting-modules","Selecting Modules",[14,134,135],{},"Declare the MagicUtils modules your code needs. The plugin resolves them to the\nright coordinates for the active target:",[52,137,140],{"className":138,"code":139,"language":57,"meta":58},[55],"magicutilsConsumer {\n    \u002F\u002F Exposed to anything that depends on this module.\n    api(\"config\")\n    \u002F\u002F Internal to this module only.\n    implementation(\"commands\", \"lang\", \"http-client\")\n    \u002F\u002F Extra third-party libraries to bundle alongside MagicUtils.\n    bundledLibraries(\"com.squareup.okhttp3:okhttp:4.12.0\")\n}\n",[18,141,139],{"__ignoreMap":58},[27,143,145],{"id":144},"multi-target-in-a-consumer","Multi-Target In A Consumer",[14,147,148,149,152,153,156],{},"Because the consumer applies ",[18,150,151],{},"magicutils.target",", your own module is also\ntarget-aware. Build or run it against a specific target with ",[18,154,155],{},"-Ptarget",":",[52,158,163],{"className":159,"code":161,"language":162,"meta":58},[160],"language-bash",".\u002Fgradlew build -Ptarget=mc262\n","bash",[18,164,161],{"__ignoreMap":58},[14,166,167,168,25],{},"This is what lets one mod source tree ship against several Minecraft versions,\nwhich is the point of building on ",[18,169,170],{},"build-logic",[27,172,174],{"id":173},"optional-dev-server","Optional Dev Server",[14,176,177,178,181,182,185],{},"Opt into a run task with ",[18,179,180],{},"devServer { }",". Conventions cover the common case, so\n",[18,183,184],{},"devServer()"," with no body is enough to get a Paper\u002FFolia\u002FFabric\u002FVelocity runner:",[52,187,190],{"className":188,"code":189,"language":57,"meta":58},[55],"magicutilsConsumer {\n    implementation(\"commands\")\n\n    devServer {\n        \u002F\u002F All optional — these are the defaults.\n        port.set(25565)\n        onlineMode.set(false)\n        folia.set(true)\n        motd.set(\"{pluginName} {platform} dev\")\n\n        \u002F\u002F Pull test-time dependencies from Modrinth into the dev server.\n        modrinth(\"placeholderapi\") { }\n    }\n}\n",[18,191,189],{"__ignoreMap":58},[14,193,194,195,198,199,198,202,205,206,209,210,25],{},"That registers the platform's run task (",[18,196,197],{},"runPaper",", ",[18,200,201],{},"runFolia",[18,203,204],{},"runFabric",",\n",[18,207,208],{},"runVelocity","), covered in ",[46,211,213],{"href":212},"\u002Fbuild-logic\u002Fdev-server","Dev Server & Smoke",{"title":58,"searchDepth":215,"depth":215,"links":216},3,[217,219,220,221,222],{"id":29,"depth":218,"text":30},2,{"id":95,"depth":218,"text":96},{"id":131,"depth":218,"text":132},{"id":144,"depth":218,"text":145},{"id":173,"depth":218,"text":174},"Apply the MagicUtils consumer Gradle plugins to your Bukkit\u002FFabric\u002FVelocity\u002FBungee\u002FNeoForge module: pick modules, embed or share the runtime, and get a dev server.","md",{},null,true,"\u002Fbuild-logic\u002Fconsumer","---\ntitle: Using It In A Mod\ndescription: 'Apply the MagicUtils consumer Gradle plugins to your Bukkit\u002FFabric\u002FVelocity\u002FBungee\u002FNeoForge module: pick modules, embed or share the runtime, and get a dev server.'\n---\n\n# Using It In A Mod\n\nThe `magicutils.consumer-*` plugins wire MagicUtils into your own module. Instead\nof declaring dependencies, shadow config, and run tasks by hand, you apply one\nplugin per platform module and describe what you need in `magicutilsConsumer { }`.\n\n## Apply The Plugin\n\nEach platform module applies the matching consumer plugin. It brings in\n`java-library`, the shadow plugin, and the MagicUtils target\u002Frepository\nconventions:\n\nThe plugin version is declared once in `pluginManagement` (see\n[Overview](\u002Fbuild-logic\u002Foverview)), so the module just applies it by id:\n\n```kotlin\nplugins {\n    id(\"magicutils.consumer-bukkit\")\n}\n\nmagicutilsConsumer {\n    \u002F\u002F Defaults to the `magicutils_version` gradle property, else this project's\n    \u002F\u002F version. Set it explicitly to pin a MagicUtils release.\n    magicutilsVersion.set(\"1.27.1\")\n\n    \u002F\u002F Modules to pull in. api(...) exposes them to dependents; implementation(...)\n    \u002F\u002F keeps them internal.\n    implementation(\"config\", \"commands\", \"lang\")\n}\n```\n\nThe consumer plugin per platform:\n\n- `magicutils.consumer-bukkit`\n- `magicutils.consumer-fabric`\n- `magicutils.consumer-velocity`\n- `magicutils.consumer-bungee`\n- `magicutils.consumer-neoforge`\n\n## Embedded vs Shared\n\n`embedMagicUtils` (default `true`) controls whether MagicUtils is shaded into\nyour artifact or expected as a separate install on the server:\n\n```kotlin\nmagicutilsConsumer {\n    \u002F\u002F false: depend on a shared MagicUtils bundle installed on the server\n    \u002F\u002F (magicutils-bukkit-bundle \u002F magicutils-fabric-bundle), don't shade it in.\n    embedMagicUtils.set(false)\n}\n```\n\nYou can also set it from the command line or `gradle.properties` with\n`-Pmagicutils_embed=false`. See [Installation](\u002Fgetting-started\u002Finstallation) for\nthe embedded vs shared trade-off.\n\n## Selecting Modules\n\nDeclare the MagicUtils modules your code needs. The plugin resolves them to the\nright coordinates for the active target:\n\n```kotlin\nmagicutilsConsumer {\n    \u002F\u002F Exposed to anything that depends on this module.\n    api(\"config\")\n    \u002F\u002F Internal to this module only.\n    implementation(\"commands\", \"lang\", \"http-client\")\n    \u002F\u002F Extra third-party libraries to bundle alongside MagicUtils.\n    bundledLibraries(\"com.squareup.okhttp3:okhttp:4.12.0\")\n}\n```\n\n## Multi-Target In A Consumer\n\nBecause the consumer applies `magicutils.target`, your own module is also\ntarget-aware. Build or run it against a specific target with `-Ptarget`:\n\n```bash\n.\u002Fgradlew build -Ptarget=mc262\n```\n\nThis is what lets one mod source tree ship against several Minecraft versions,\nwhich is the point of building on `build-logic`.\n\n## Optional Dev Server\n\nOpt into a run task with `devServer { }`. Conventions cover the common case, so\n`devServer()` with no body is enough to get a Paper\u002FFolia\u002FFabric\u002FVelocity runner:\n\n```kotlin\nmagicutilsConsumer {\n    implementation(\"commands\")\n\n    devServer {\n        \u002F\u002F All optional — these are the defaults.\n        port.set(25565)\n        onlineMode.set(false)\n        folia.set(true)\n        motd.set(\"{pluginName} {platform} dev\")\n\n        \u002F\u002F Pull test-time dependencies from Modrinth into the dev server.\n        modrinth(\"placeholderapi\") { }\n    }\n}\n```\n\nThat registers the platform's run task (`runPaper`, `runFolia`, `runFabric`,\n`runVelocity`), covered in [Dev Server & Smoke](\u002Fbuild-logic\u002Fdev-server).\n",{"title":5,"description":223},"build-logic\u002Fconsumer","mMYKXC3VxBM_NJgGXmQjrOzamqUJ8pNACf7VRDmWzBY",1783944486788]