[{"data":1,"prerenderedAt":398},["ShallowReactive",2],{"docs-\u002Fplatforms\u002Ffabric":3},{"id":4,"title":5,"body":6,"description":388,"extension":389,"meta":390,"navTitle":391,"navigation":392,"path":393,"rawbody":394,"seo":395,"stem":396,"__hash__":397},"docs\u002Fplatforms\u002Ffabric.md","Fabric",{"type":7,"value":8,"toc":377},"minimark",[9,13,26,31,41,64,68,74,251,255,258,286,294,298,316,320,323,341,345,355,359,370],[10,11,5],"h1",{"id":12},"fabric",[14,15,16,17,21,22,25],"p",{},"For most mods, use ",[18,19,20],"code",{},"magicutils-fabric-bundle"," and wire the runtime through\n",[18,23,24],{},"FabricBootstrap",".",[27,28,30],"h2",{"id":29},"recommended-bootstrap","Recommended Bootstrap",[32,33,39],"pre",{"className":34,"code":36,"language":37,"meta":38},[35],"language-java","public final class MyMod implements ModInitializer {\n    private static final String MOD_ID = \"mymod\";\n\n    private MinecraftServer server;\n    private FabricBootstrap.RuntimeResult magic;\n\n    @Override\n    public void onInitialize() {\n        magic = FabricBootstrap.forMod(MOD_ID, () -> server)\n                .enableCommands()\n                .buildRuntime();\n\n        CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {\n            if (magic.commandRegistry() != null) {\n                magic.commandRegistry().registerCommand(dispatcher, new ExampleCommand());\n            }\n        });\n\n        ServerLifecycleEvents.SERVER_STARTED.register(server -> this.server = server);\n        ServerLifecycleEvents.SERVER_STOPPING.register(server -> {\n            this.server = null;\n            if (magic != null) {\n                magic.runtime().close();\n                magic = null;\n            }\n        });\n    }\n}\n","java","",[18,40,36],{"__ignoreMap":38},[14,42,43,45,46,49,50,49,53,56,57,49,60,63],{},[18,44,24],{}," wires ",[18,47,48],{},"Platform",", ",[18,51,52],{},"ConfigManager",[18,54,55],{},"Logger",",\n",[18,58,59],{},"LanguageManager",[18,61,62],{},"Messages",", and an optional Fabric command registry. Actual\ncommand registration still happens in Fabric's Brigadier callback.",[27,65,67],{"id":66},"bootstrap-options","Bootstrap Options",[14,69,70,73],{},[18,71,72],{},"FabricBootstrap.Builder"," supports the following configuration:",[75,76,77,90],"table",{},[78,79,80],"thead",{},[81,82,83,87],"tr",{},[84,85,86],"th",{},"Method",[84,88,89],{},"Description",[91,92,93,104,114,128,138,148,158,168,178,188,198,211,221,231,241],"tbody",{},[81,94,95,101],{},[96,97,98],"td",{},[18,99,100],{},"slf4j(logger)",[96,102,103],{},"Bind an SLF4J logger for console output.",[81,105,106,111],{},[96,107,108],{},[18,109,110],{},"configDir(path)",[96,112,113],{},"Override the config\u002Flang data directory.",[81,115,116,121],{},[96,117,118],{},[18,119,120],{},"enableCommands()",[96,122,123,124,127],{},"Create a ",[18,125,126],{},"CommandRegistry"," during bootstrap.",[81,129,130,135],{},[96,131,132],{},[18,133,134],{},"permissionPrefix(prefix)",[96,136,137],{},"Set the permission node prefix for commands.",[81,139,140,145],{},[96,141,142],{},[18,143,144],{},"opLevel(int)",[96,146,147],{},"Operator threshold used for permission fallbacks.",[81,149,150,155],{},[96,151,152],{},[18,153,154],{},"configureCommands(consumer)",[96,156,157],{},"Register commands during bootstrap.",[81,159,160,165],{},[96,161,162],{},[18,163,164],{},"enableDiagnostics()",[96,166,167],{},"Enable the diagnostics service.",[81,169,170,175],{},[96,171,172],{},[18,173,174],{},"configureDiagnostics(consumer)",[96,176,177],{},"Register custom diagnostic checks.",[81,179,180,185],{},[96,181,182],{},[18,183,184],{},"initLanguage(boolean)",[96,186,187],{},"Enable\u002Fdisable language manager initialization.",[81,189,190,195],{},[96,191,192],{},[18,193,194],{},"bindLoggerLanguage(boolean)",[96,196,197],{},"Bind the language manager to the logger.",[81,199,200,205],{},[96,201,202],{},[18,203,204],{},"setMessagesManager(boolean)",[96,206,207,208,210],{},"Set the global ",[18,209,62],{}," language manager.",[81,212,213,218],{},[96,214,215],{},[18,216,217],{},"registerMessages(boolean)",[96,219,220],{},"Register the plugin's messages scope.",[81,222,223,228],{},[96,224,225],{},[18,226,227],{},"addMagicUtilsMessages(boolean)",[96,229,230],{},"Register built-in MagicUtils messages.",[81,232,233,238],{},[96,234,235],{},[18,236,237],{},"bindClientLocaleSync(boolean)",[96,239,240],{},"Follow each player's client locale.",[81,242,243,248],{},[96,244,245],{},[18,246,247],{},"translations(consumer)",[96,249,250],{},"Configure additional translations.",[27,252,254],{"id":253},"modular-setup","Modular Setup",[14,256,257],{},"If you do not want the bundle, combine the platform adapter with the Fabric\nintegration modules you need:",[259,260,261,267,276,281],"ul",{},[262,263,264],"li",{},[18,265,266],{},"magicutils-fabric",[262,268,269,272,273,275],{},[18,270,271],{},"magicutils-commands-fabric"," (this module provides ",[18,274,24],{},")",[262,277,278],{},[18,279,280],{},"magicutils-logger-fabric",[262,282,283],{},[18,284,285],{},"magicutils-placeholders-fabric",[14,287,288,290,291,293],{},[18,289,24],{}," lives in ",[18,292,271],{},", so a bootstrap-first\nmodular setup must include it even if you do not register any commands.",[27,295,297],{"id":296},"permissions","Permissions",[14,299,300,301,304,305,308,309,311,312,315],{},"Fabric permissions integrate with ",[18,302,303],{},"fabric-permissions-api-v0"," when installed.\nIf no permission provider exists, MagicUtils falls back to op-level checks. Use\n",[18,306,307],{},"opLevel(...)"," on ",[18,310,24],{}," or ",[18,313,314],{},"CommandRegistry.create(...)"," when you\nneed a different default operator level.",[27,317,319],{"id":318},"placeholders","Placeholders",[14,321,322],{},"Fabric placeholder support is optional and activates automatically when\nplaceholder mods are present:",[259,324,325,334],{},[262,326,327],{},[328,329,333],"a",{"href":330,"rel":331},"https:\u002F\u002Fmodrinth.com\u002Fmod\u002Fplaceholder-api",[332],"nofollow","Text Placeholder API",[262,335,336],{},[328,337,340],{"href":338,"rel":339},"https:\u002F\u002Fmodrinth.com\u002Fmod\u002Fminiplaceholders",[332],"MiniPlaceholders",[27,342,344],{"id":343},"config-format","Config Format",[14,346,347,348,311,351,354],{},"Default config format on Fabric is JSONC. You can override it via\n",[18,349,350],{},"\u003Cconfig>.format",[18,352,353],{},"magicutils.format"," (see the Config module docs).",[27,356,358],{"id":357},"bundle-strategy","Bundle Strategy",[259,360,361,367],{},[262,362,363,364,366],{},"Embed ",[18,365,20],{}," in your mod.",[262,368,369],{},"Or ship one shared bundle mod on the server and depend on it.",[371,372,374],"callout",{"type":373},"danger",[14,375,376],{},"Do not use both approaches at the same time — embedding the bundle and also\ninstalling it as a separate mod will load MagicUtils twice.",{"title":38,"searchDepth":378,"depth":378,"links":379},3,[380,382,383,384,385,386,387],{"id":29,"depth":381,"text":30},2,{"id":66,"depth":381,"text":67},{"id":253,"depth":381,"text":254},{"id":296,"depth":381,"text":297},{"id":318,"depth":381,"text":319},{"id":343,"depth":381,"text":344},{"id":357,"depth":381,"text":358},"Wire MagicUtils into a Fabric mod with FabricBootstrap and the fabric-bundle: config, logger, lang, commands, and placeholders for modular setups.","md",{},null,true,"\u002Fplatforms\u002Ffabric","---\ntitle: Fabric\ndescription: 'Wire MagicUtils into a Fabric mod with FabricBootstrap and the fabric-bundle: config, logger, lang, commands, and placeholders for modular setups.'\n---\n\n# Fabric\n\nFor most mods, use `magicutils-fabric-bundle` and wire the runtime through\n`FabricBootstrap`.\n\n## Recommended Bootstrap\n\n```java\npublic final class MyMod implements ModInitializer {\n    private static final String MOD_ID = \"mymod\";\n\n    private MinecraftServer server;\n    private FabricBootstrap.RuntimeResult magic;\n\n    @Override\n    public void onInitialize() {\n        magic = FabricBootstrap.forMod(MOD_ID, () -> server)\n                .enableCommands()\n                .buildRuntime();\n\n        CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {\n            if (magic.commandRegistry() != null) {\n                magic.commandRegistry().registerCommand(dispatcher, new ExampleCommand());\n            }\n        });\n\n        ServerLifecycleEvents.SERVER_STARTED.register(server -> this.server = server);\n        ServerLifecycleEvents.SERVER_STOPPING.register(server -> {\n            this.server = null;\n            if (magic != null) {\n                magic.runtime().close();\n                magic = null;\n            }\n        });\n    }\n}\n```\n\n`FabricBootstrap` wires `Platform`, `ConfigManager`, `Logger`,\n`LanguageManager`, `Messages`, and an optional Fabric command registry. Actual\ncommand registration still happens in Fabric's Brigadier callback.\n\n## Bootstrap Options\n\n`FabricBootstrap.Builder` supports the following configuration:\n\n| Method | Description |\n| --- | --- |\n| `slf4j(logger)` | Bind an SLF4J logger for console output. |\n| `configDir(path)` | Override the config\u002Flang data directory. |\n| `enableCommands()` | Create a `CommandRegistry` during bootstrap. |\n| `permissionPrefix(prefix)` | Set the permission node prefix for commands. |\n| `opLevel(int)` | Operator threshold used for permission fallbacks. |\n| `configureCommands(consumer)` | Register commands during bootstrap. |\n| `enableDiagnostics()` | Enable the diagnostics service. |\n| `configureDiagnostics(consumer)` | Register custom diagnostic checks. |\n| `initLanguage(boolean)` | Enable\u002Fdisable language manager initialization. |\n| `bindLoggerLanguage(boolean)` | Bind the language manager to the logger. |\n| `setMessagesManager(boolean)` | Set the global `Messages` language manager. |\n| `registerMessages(boolean)` | Register the plugin's messages scope. |\n| `addMagicUtilsMessages(boolean)` | Register built-in MagicUtils messages. |\n| `bindClientLocaleSync(boolean)` | Follow each player's client locale. |\n| `translations(consumer)` | Configure additional translations. |\n\n## Modular Setup\n\nIf you do not want the bundle, combine the platform adapter with the Fabric\nintegration modules you need:\n\n- `magicutils-fabric`\n- `magicutils-commands-fabric` (this module provides `FabricBootstrap`)\n- `magicutils-logger-fabric`\n- `magicutils-placeholders-fabric`\n\n`FabricBootstrap` lives in `magicutils-commands-fabric`, so a bootstrap-first\nmodular setup must include it even if you do not register any commands.\n\n## Permissions\n\nFabric permissions integrate with `fabric-permissions-api-v0` when installed.\nIf no permission provider exists, MagicUtils falls back to op-level checks. Use\n`opLevel(...)` on `FabricBootstrap` or `CommandRegistry.create(...)` when you\nneed a different default operator level.\n\n## Placeholders\n\nFabric placeholder support is optional and activates automatically when\nplaceholder mods are present:\n\n- [Text Placeholder API](https:\u002F\u002Fmodrinth.com\u002Fmod\u002Fplaceholder-api)\n- [MiniPlaceholders](https:\u002F\u002Fmodrinth.com\u002Fmod\u002Fminiplaceholders)\n\n## Config Format\n\nDefault config format on Fabric is JSONC. You can override it via\n`\u003Cconfig>.format` or `magicutils.format` (see the Config module docs).\n\n## Bundle Strategy\n\n- Embed `magicutils-fabric-bundle` in your mod.\n- Or ship one shared bundle mod on the server and depend on it.\n\n::callout{type=\"danger\"}\nDo not use both approaches at the same time — embedding the bundle and also\ninstalling it as a separate mod will load MagicUtils twice.\n::\n",{"title":5,"description":388},"platforms\u002Ffabric","o7IJFfEjU-QZVT7X9mMSINk0Qy-a1kxA-1Ctaaa5f1A",1783944485844]