# Table of Contents - [Introduction to Cloth Config | Cloth Config](#introduction-to-cloth-config-cloth-config) - [Initial page | Roughly Enough Items](#initial-page-roughly-enough-items) - [Frequently Asked Questions | Cloth Config](#frequently-asked-questions-cloth-config) - [Setup with Fabric | Cloth Config](#setup-with-fabric-cloth-config) - [Setup with Forge | Cloth Config](#setup-with-forge-cloth-config) - [Creating a Config Screen | Cloth Config](#creating-a-config-screen-cloth-config) - [Saving the Config | Cloth Config](#saving-the-config-cloth-config) - [Creating a Dropdown Menu | Cloth Config](#creating-a-dropdown-menu-cloth-config) - [Building the Config Screen | Cloth Config](#building-the-config-screen-cloth-config) - [Creating a Config Option | Cloth Config](#creating-a-config-option-cloth-config) - [Creating a Config Category | Cloth Config](#creating-a-config-category-cloth-config) - [ModMenu Integration | Cloth Config](#modmenu-integration-cloth-config) - [Introduction to Auto Config 1u | Cloth Config](#introduction-to-auto-config-1u-cloth-config) - [Setup with Gradle | Cloth Config](#setup-with-gradle-cloth-config) - [Creating a Config Class | Cloth Config](#creating-a-config-class-cloth-config) - [Registering the Config | Cloth Config](#registering-the-config-cloth-config) - [Reading the Config | Cloth Config](#reading-the-config-cloth-config) - [Generating a Cloth Config Screen | Cloth Config](#generating-a-cloth-config-screen-cloth-config) - [Annotations | Cloth Config](#annotations-cloth-config) - [Custom Gui Handlers | Cloth Config](#custom-gui-handlers-cloth-config) - [Post-Validation | Cloth Config](#post-validation-cloth-config) - [Partitioning the Config | Cloth Config](#partitioning-the-config-cloth-config) - [Setup with Fabric | Cloth Config](#setup-with-fabric-cloth-config) - [Creating a Config Screen | Cloth Config](#creating-a-config-screen-cloth-config) - [Introduction to Auto Config 1u | Cloth Config](#introduction-to-auto-config-1u-cloth-config) - [Creating a Dropdown Menu | Cloth Config](#creating-a-dropdown-menu-cloth-config) --- # Introduction to Cloth Config | Cloth Config Welcome to Cloth Config wiki! [hashtag](https://shedaniel.gitbook.io/cloth-config#cloth-config-major-versions) Cloth Config Major Versions ----------------------------------------------------------------------------------------------------------------- Version Support ~v1~ Discontinued. Supports 1.14.x ~v2~ Discontinued. Supports 1.14.x - 1.15.x ~v3~ Discontinued. Supports 1.16 **(Before 20w17a)** **v4 (Stable)** **Active**. Supports 1.16.x **(Since 20w17a)** ~v5~ Discontinued. Supports 1.17.x **v6 (Stable)** **Active**. Supports 1.18.x ~v7~ Discontinued. Supports 1.19, use v8. **v8 (Stable)** **Active**. Supports 1.19 - 1.19.2 **v9 (Stable)** **Active**. Supports 1.19.3 **v10 (Stable)** **Active**. Supports 1.19.4 **v11 (Stable)** **Active**. Supports 1.20.x [NextFrequently Asked Questionschevron-right](https://shedaniel.gitbook.io/cloth-config/frequently-asked-questions) Last updated 2 years ago --- # Initial page | Roughly Enough Items [https://shedaniel.notion.site/Roughly-Enough-Items-51b147ae451b478e9899b8d2653faef1arrow-up-right](https://shedaniel.notion.site/Roughly-Enough-Items-51b147ae451b478e9899b8d2653faef1) Last updated 3 years ago --- # Frequently Asked Questions | Cloth Config [hashtag](https://shedaniel.gitbook.io/cloth-config/frequently-asked-questions#isnt-cloth-config-client-sided-only) Isn't Cloth Config client sided only? -------------------------------------------------------------------------------------------------------------------------------------------------------------- Yes, Cloth Config is client sided only. However, Cloth Config is only a config screen API, not actually a fully configuration API. You can simply ignore Cloth Config when you are on the client, or you can ask the server to send the client a copy of the config and sync it over when the user saves from Cloth Config. [hashtag](https://shedaniel.gitbook.io/cloth-config/frequently-asked-questions#are-you-still-maintaining-cloth-auto-config) Are you still maintaining Cloth / Auto Config? ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Yes, but only to fix bugs and update it to new Minecraft versions, you can see [Introduction to Cloth Config](https://shedaniel.gitbook.io/cloth-config) for the list of supported Minecraft versions, I tend to maintain support for a long time. Cloth / Auto Config is unlikely to receive new features. [hashtag](https://shedaniel.gitbook.io/cloth-config/frequently-asked-questions#are-there-any-alternatives-to-cloth-auto-config) Are there any alternatives to Cloth / Auto Config? --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Here are some notable alternatives that I think (personally), are pretty good as well. * MidnightConfig: [https://github.com/TeamMidnightDust/MidnightLib/wikiarrow-up-right](https://github.com/TeamMidnightDust/MidnightLib/wiki) * owo-lib: [https://docs.wispforest.io/owo/config/arrow-up-right](https://docs.wispforest.io/owo/config/) * OroConfig: [https://github.com/OroArmor/Oro-Configarrow-up-right](https://github.com/OroArmor/Oro-Config) * Omega Config: [https://github.com/Draylar/omega-configarrow-up-right](https://github.com/Draylar/omega-config) _I still think other's config screens kinda suck - shedaniel 2022_ [PreviousIntroduction to Cloth Configchevron-left](https://shedaniel.gitbook.io/cloth-config) [NextSetup with Fabricchevron-right](https://shedaniel.gitbook.io/cloth-config/setup-cloth-config/cloth-config-fabric) Last updated 3 years ago --- # Setup with Fabric | Cloth Config Please DO NOT use Auto Config / Cloth Config for server mods [hashtag](https://shedaniel.gitbook.io/cloth-config/setup-cloth-config/cloth-config-fabric#adding-via-gradle) Adding Via Gradle ------------------------------------------------------------------------------------------------------------------------------------ Becoming a super hero is a fairly straight forward process: build.gradle Copy repositories { maven { url "https://maven.shedaniel.me/" } maven { url "https://maven.terraformersmc.com/releases/" } } dependencies { [...] modApi("me.shedaniel.cloth:cloth-config-fabric:ABC") { exclude(group: "net.fabricmc.fabric-api") } } circle-info Replace **ABC** with the version of Cloth Config desired, the versions of Cloth Config can be found at [Linkie Webarrow-up-right](https://linkie.shedaniel.me/dependencies) . [PreviousFrequently Asked Questionschevron-left](https://shedaniel.gitbook.io/cloth-config/frequently-asked-questions) [NextSetup with Forgechevron-right](https://shedaniel.gitbook.io/cloth-config/setup-cloth-config/setup-with-forge) Last updated 3 years ago --- # Setup with Forge | Cloth Config Please DO NOT use Auto Config / Cloth Config for server mods [hashtag](https://shedaniel.gitbook.io/cloth-config/setup-cloth-config/setup-with-forge#adding-via-gradle) Adding Via Gradle --------------------------------------------------------------------------------------------------------------------------------- Becoming a super hero is a fairly straight forward process: build.gradle Copy repositories { maven { url "https://maven.shedaniel.me/" } } dependencies { [...] api(fg.deobf("me.shedaniel.cloth:cloth-config-forge:ABC")) } circle-info Replace **ABC** with the version of Cloth Config desired, the versions of Cloth Config can be found at [Linkie Webarrow-up-right](https://linkie.shedaniel.me/dependencies) . [PreviousSetup with Fabricchevron-left](https://shedaniel.gitbook.io/cloth-config/setup-cloth-config/cloth-config-fabric) [NextCreating a Config Screenchevron-right](https://shedaniel.gitbook.io/cloth-config/using-cloth-config/creating-a-config-screen) Last updated 3 years ago --- # Creating a Config Screen | Cloth Config Call `ConfigBuilder.create()` to create a new config builder, from there you can **set the background**, **create new categories**, **disable smooth scrolling**, etc. The title will be **automatically translated** to the language the user selects, make sure you localize the language in the language file. circle-check Parent Screen is the screen when the user clicks done or cancel, you should put the current screen as the parent screen. Copy ConfigBuilder builder = ConfigBuilder.create() .setParentScreen(parent) .setTitle(new TranslatableText("title.examplemod.config")); circle-exclamation You have to create a new config screen builder **every single time** you open the config menu. [PreviousSetup with Forgechevron-left](https://shedaniel.gitbook.io/cloth-config/setup-cloth-config/setup-with-forge) [NextSaving the Configchevron-right](https://shedaniel.gitbook.io/cloth-config/using-cloth-config/saving-the-config) Last updated 5 years ago --- # Saving the Config | Cloth Config You can define the code that runs when the user clicks **"Save"** using the following method. Copy [...] builder.setSavingRunnable(() -> { // Serialise the config into the config file. This will be called last after all variables are updated. }); [PreviousCreating a Config Screenchevron-left](https://shedaniel.gitbook.io/cloth-config/using-cloth-config/creating-a-config-screen) [NextCreating a Config Categorychevron-right](https://shedaniel.gitbook.io/cloth-config/using-cloth-config/creating-a-config-category) Last updated 6 years ago --- # Creating a Dropdown Menu | Cloth Config This page has not been rewritten, please look at the old wiki: [https://github.com/shedaniel/ClothConfig/wiki/Dropdown-Menuarrow-up-right](https://github.com/shedaniel/ClothConfig/wiki/Dropdown-Menu) [PreviousBuilding the Config Screenchevron-left](https://shedaniel.gitbook.io/cloth-config/using-cloth-config/building-the-config-screen) [NextModMenu Integrationchevron-right](https://shedaniel.gitbook.io/cloth-config/advanced/modmenu-integration) Last updated 6 years ago --- # Building the Config Screen | Cloth Config Here is how you can get the finished screen from the builder. Copy [...] Screen screen = builder.build(); And you can show it to the player. Copy [...] MinecraftClient.getInstance().openScreen(screen); [PreviousCreating a Config Optionchevron-left](https://shedaniel.gitbook.io/cloth-config/using-cloth-config/creating-a-config-option) [NextCreating a Dropdown Menuchevron-right](https://shedaniel.gitbook.io/cloth-config/advanced/creating-a-dropdown-menu) Last updated 6 years ago --- # Creating a Config Option | Cloth Config You can create options easily with the help of `ConfigEntryBuilder`, firstly create a new `ConfigEntryBuilder`: Copy [...] ConfigEntryBuilder entryBuilder = builder.entryBuilder(); There is a lot of default provided option types that you can choose from, here is an example of adding a new String text field. Copy [...] general.addEntry(entryBuilder.startStrField(new TranslatableText("option.examplemod.optionA"), currentValue) .setDefaultValue("This is the default value") // Recommended: Used when user click "Reset" .setTooltip(new TranslatableText("This option is awesome!")) // Optional: Shown when the user hover over this option .setSaveConsumer(newValue -> currentValue = newValue) // Recommended: Called when user save the config .build()); // Builds the option entry for cloth config circle-info **currentValue** should be the field holding the value of the option, and the save consumer will save it back when the config is saved. [PreviousCreating a Config Categorychevron-left](https://shedaniel.gitbook.io/cloth-config/using-cloth-config/creating-a-config-category) [NextBuilding the Config Screenchevron-right](https://shedaniel.gitbook.io/cloth-config/using-cloth-config/building-the-config-screen) Last updated 5 years ago --- # Creating a Config Category | Cloth Config circle-info Category Tabs are shown **ONLY** when you have more than 1 category. You can create a new category by calling `getOrCreateCategory` with the builder: Copy [...] ConfigCategory general = builder.getOrCreateCategory(new TranslatableText("category.examplemod.general")); circle-check The category name will be **ignored** if you only have 1 category created, which means that you can choose to put a dummy placeholder into the category name instead of giving the category an actual name. [PreviousSaving the Configchevron-left](https://shedaniel.gitbook.io/cloth-config/using-cloth-config/saving-the-config) [NextCreating a Config Optionchevron-right](https://shedaniel.gitbook.io/cloth-config/using-cloth-config/creating-a-config-option) Last updated 5 years ago --- # ModMenu Integration | Cloth Config Now, you've created your config screen, you may want to add it to ModMenu. ### [hashtag](https://shedaniel.gitbook.io/cloth-config/advanced/modmenu-integration#adding-modmenu-with-gradle) Adding ModMenu with Gradle build.gradle Copy dependencies { [...] modApi "com.terraformersmc:modmenu:ABC" } circle-info Replace **ABC** with the version of ModMenu desired, the versions of ModMenu can be found at [Linkie Webarrow-up-right](https://linkie.shedaniel.me/dependencies) . ### [hashtag](https://shedaniel.gitbook.io/cloth-config/advanced/modmenu-integration#creating-the-modmenu-entrypoint) Creating the ModMenu entrypoint Create a class that is implementing `ModMenuApi` ExampleModMenuIntegration.class Copy public class ExampleModMenuIntegration implements ModMenuApi { } Override the config screen method to provide our screen. ExampleModMenuIntegration.class Copy public class ExampleModMenuIntegration implements ModMenuApi { [...] @Override public ConfigScreenFactory getModConfigScreenFactory() { return parent -> { // Return the screen here with the one you created from Cloth Config Builder }; } } Add your entrypoint to `fabric.mod.json`. fabric.mod.json Copy "entrypoints": { "modmenu": [\ "full.path.to.ExampleModMenuIntegration"\ ] } [PreviousCreating a Dropdown Menuchevron-left](https://shedaniel.gitbook.io/cloth-config/advanced/creating-a-dropdown-menu) [NextIntroduction to Auto Config 1uchevron-right](https://shedaniel.gitbook.io/cloth-config/auto-config/introduction-to-auto-config-1u) Last updated 3 years ago --- # Introduction to Auto Config 1u | Cloth Config Annotation based API for mod configs, with Cloth Config GUI integration, intended to be used by other mods. Simply add some annotations to your config class and this mod will take care of generating the config GUI for you. [PreviousModMenu Integrationchevron-left](https://shedaniel.gitbook.io/cloth-config/advanced/modmenu-integration) [NextSetup with Gradlechevron-right](https://shedaniel.gitbook.io/cloth-config/auto-config/setup-with-gradle) Last updated 3 years ago --- # Setup with Gradle | Cloth Config Auto Config is bundled with Cloth Config since version 4.9. Please DO NOT use Auto Config / Cloth Config for server mods [PreviousIntroduction to Auto Config 1uchevron-left](https://shedaniel.gitbook.io/cloth-config/auto-config/introduction-to-auto-config-1u) [NextCreating a Config Classchevron-right](https://shedaniel.gitbook.io/cloth-config/auto-config/creating-a-config-class) Last updated 4 years ago --- # Creating a Config Class | Cloth Config Copy @Config(name = "modid") class ModConfig implements ConfigData { boolean toggleA = true; boolean toggleB = false; @ConfigEntry.Gui.CollapsibleObject InnerStuff stuff = new InnerStuff(); @ConfigEntry.Gui.Excluded InnerStuff invisibleStuff = new InnerStuff(); static class InnerStuff { int a = 0; int b = 1; } } circle-check The Gui generator works with `boolean`, `int`, `long`, `double`, `float`, `String`, and `enum` types by default. You can also use it with nested objects by adding the `@CollapsibleObject` annotation to the object's field. You can register your own providers if those default ones aren't sufficient for you. [PreviousSetup with Gradlechevron-left](https://shedaniel.gitbook.io/cloth-config/auto-config/setup-with-gradle) [NextRegistering the Configchevron-right](https://shedaniel.gitbook.io/cloth-config/auto-config/registering-the-config) Last updated 5 years ago --- # Registering the Config | Cloth Config Serialization works with any types supported the following libraries: * [Jankson (Json5)arrow-up-right](https://github.com/falkreon/Jankson) * [GSON (Json)arrow-up-right](https://github.com/google/gson) * [TOML4J (Toml)arrow-up-right](https://github.com/mwanji/toml4j) If that's not sufficient, you can customize those serialization handlers the same way you would if you used them directly. circle-info Register the config before you use it, ideally in your mod's init function. There are three built-in serializers for you to choose from, or you can provide your own. Copy // Only choose one of these! AutoConfig.register(ModConfig.class, Toml4jConfigSerializer::new); AutoConfig.register(ModConfig.class, GsonConfigSerializer::new); AutoConfig.register(ModConfig.class, JanksonConfigSerializer::new); circle-exclamation Please read [Partitioning the Config](https://shedaniel.gitbook.io/cloth-config/auto-config/partitioning-the-config) if you want the split the config into multiple files. [PreviousCreating a Config Classchevron-left](https://shedaniel.gitbook.io/cloth-config/auto-config/creating-a-config-class) [NextReading the Configchevron-right](https://shedaniel.gitbook.io/cloth-config/auto-config/reading-the-config) Last updated 5 years ago --- # Reading the Config | Cloth Config Do the following wherever you want to use your config. This must be called **after** [registration](https://shedaniel.gitbook.io/cloth-config/auto-config/registering-the-config) . Copy ModConfig config = AutoConfig.getConfigHolder(ModConfig.class).getConfig(); [PreviousRegistering the Configchevron-left](https://shedaniel.gitbook.io/cloth-config/auto-config/registering-the-config) [NextGenerating a Cloth Config Screenchevron-right](https://shedaniel.gitbook.io/cloth-config/auto-config/generating-a-cloth-config-screen) Last updated 5 years ago --- # Generating a Cloth Config Screen | Cloth Config Integrate with ModMenu to generate the config gui. Don't forget to register this entrypoint in your _fabric.mod.json_. See [ModMenu Integration](https://shedaniel.gitbook.io/cloth-config/advanced/modmenu-integration) for details on how to do that. Copy @Environment(EnvType.CLIENT) class ModMenuIntegration implements ModMenuApi { @Override public ConfigScreenFactory getModConfigScreenFactory() { return parent -> AutoConfig.getConfigScreen(ModConfig.class, parent).get(); } } [PreviousReading the Configchevron-left](https://shedaniel.gitbook.io/cloth-config/auto-config/reading-the-config) [NextAnnotationschevron-right](https://shedaniel.gitbook.io/cloth-config/auto-config/annotations) Last updated 5 years ago --- # Annotations | Cloth Config ### [hashtag](https://shedaniel.gitbook.io/cloth-config/auto-config/annotations#config) **@Config** This **must** be attached to your config class. It defines the file name of your config, minus the extension. ### [hashtag](https://shedaniel.gitbook.io/cloth-config/auto-config/annotations#config.gui.background) **@Config.Gui.Background** This may be attached to your config class. If attached, it'll set the background texture for your config. ### [hashtag](https://shedaniel.gitbook.io/cloth-config/auto-config/annotations#config.gui.categorybackground) **@Config.Gui.CategoryBackground** Any number of these may be attached to your config class. If attached, it'll set the background texture for a specific category in your config. ### [hashtag](https://shedaniel.gitbook.io/cloth-config/auto-config/annotations#configentry.category) **@ConfigEntry.Category** This may be attached to a config field. If attached, it'll set the top level category of the config field. Categories are listed in the order they're first defined. ### [hashtag](https://shedaniel.gitbook.io/cloth-config/auto-config/annotations#configentry.boundeddiscrete) **@ConfigEntry.BoundedDiscrete** This may be attached to an `int` or `long` config field. If attached, it'll render that config entry as a slider instead of a free number field. It takes a required `max` argument, and an optional `min` which defaults to `0`. ### [hashtag](https://shedaniel.gitbook.io/cloth-config/auto-config/annotations#configentry.gui.excluded) **@ConfigEntry.Gui.Excluded** This may be attached to a config field. If attached, it'll exclude that field from the config gui. ### [hashtag](https://shedaniel.gitbook.io/cloth-config/auto-config/annotations#configentry.gui.transitiveobject) **@ConfigEntry.Gui.TransitiveObject** This may be attached to any Object config field. If attached, all of that inner object's fields will appear at the same level as this field. ### [hashtag](https://shedaniel.gitbook.io/cloth-config/auto-config/annotations#configentry.gui.collapsibleobject) **@ConfigEntry.Gui.CollapsibleObject** This may be attached to any Object config field. If attached, all of that inner object's fields will appear in a collapsible subcategory. It takes an optional `startExpanded` parameter to determine whether the subcategory is open or closed when the config screen is opened. It defaults to `false`. ### [hashtag](https://shedaniel.gitbook.io/cloth-config/auto-config/annotations#configentry.gui.tooltip) **@ConfigEntry.Gui.Tooltip** This may be attached to any config field. If attached, it'll set a tooltip for that field. The tooltip text is defined in your lang file. It takes an optional parameter `count`, which is the number of text rows in your tooltip. Default is `1`. ### [hashtag](https://shedaniel.gitbook.io/cloth-config/auto-config/annotations#configentry.gui.prefixtext) **@ConfigEntry.Gui.PrefixText** This may be attached to any config field. If attached, it'll inject a static text entry into the gui above that field's entry in the config. The text content is defined in your lang file. ### [hashtag](https://shedaniel.gitbook.io/cloth-config/auto-config/annotations#special-case-comment) **Special case: @Comment** If you attach Jankson's `@Comment` annotation to a field, the `String` you pass as a parameter will be applied directly as a tooltip, without lang key generation. If you're using the `JanksonConfigSerializer`, the comment will also appear in the serialized config. [PreviousGenerating a Cloth Config Screenchevron-left](https://shedaniel.gitbook.io/cloth-config/auto-config/generating-a-cloth-config-screen) [NextPost-Validationchevron-right](https://shedaniel.gitbook.io/cloth-config/auto-config/post-validation) Last updated 5 years ago --- # Custom Gui Handlers | Cloth Config These can only be done on the client, make sure this is only done on the client. Copy ConfigGuiRegistry registry = AutoConfig.getGuiRegistry(CONFIG_NAME); ### [hashtag](https://shedaniel.gitbook.io/cloth-config/auto-config/custom-gui-handlers#guiprovider) **GuiProvider** A `GuiProvider` is a handler that maps fields to gui entries. Copy registry.registerAnnotationProvider(...); // apply based on the presence of an annotation registry.registerPredicateProvider(...); // apply based on a certain Predicate registry.registerTypeProvider(...); // apply to a certain type If multiple registered providers apply to the same field, the priority is as follows: Annotation, then Predicate, then Type. If multiple providers of a single category apply, the first one that was registered will be used. Custom registered providers always take priority over the built-in providers. ### [hashtag](https://shedaniel.gitbook.io/cloth-config/auto-config/custom-gui-handlers#guitransformer) **GuiTransformer** A `GuiTransformer` is a handler that maps a generated gui entry to a new gui entry. It can also apply some modifications to the passed entry and return the same reference. Copy registry.registerAnnotationTransformer(...); // apply based on the presence of an annotation registry.registerPredicateTransformer(...); // apply based on a certain Predicate All matching transformers are applied in order of registration. Custom registered transformers always apply before built-in ones. [PreviousPartitioning the Configchevron-left](https://shedaniel.gitbook.io/cloth-config/auto-config/partitioning-the-config) Last updated 5 years ago --- # Post-Validation | Cloth Config Implement `validatePostLoad()` in your config class to correct and validate your fields after deserialization. Prefer correction over validation, but throw a `ValidationException` if the config can not be corrected. If a config fails to validate (`ValidationException` is thrown), the default config will be loaded but not saved and an error will be logged. [PreviousAnnotationschevron-left](https://shedaniel.gitbook.io/cloth-config/auto-config/annotations) [NextPartitioning the Configchevron-right](https://shedaniel.gitbook.io/cloth-config/auto-config/partitioning-the-config) Last updated 5 years ago --- # Partitioning the Config | Cloth Config There's a `PartitioningSerializer` included to partition your config into multiple files within a directory. When using `PartitioningSerializer`, your top level config class must inherit from `PartitioningSerializer.GlobalData` and every field in that top level class must be of a type that inherits from `ConfigData` and is annotated with `@Config`. ### [hashtag](https://shedaniel.gitbook.io/cloth-config/auto-config/partitioning-the-config#example) Example Copy @Config(name = "modid") class ModConfig extends PartitioningSerializer.GlobalData { @ConfigEntry.Category("module_a") @ConfigEntry.Gui.TransitiveObject ModuleAConfig moduleA = new ModuleAConfig(); @ConfigEntry.Category("module_b") @ConfigEntry.Gui.TransitiveObject ModuleBConfig moduleB = new ModuleBConfig(); } @Config(name = "module_a") class ModuleAConfig implements ConfigData { /* your config fields here */ } @Config(name = "module_b") class ModuleBConfig implements ConfigData { /* your config fields here */ } ### [hashtag](https://shedaniel.gitbook.io/cloth-config/auto-config/partitioning-the-config#registering-the-config) Registering the Config Copy AutoConfig.register( ModConfig.class, PartitioningSerializer.wrap(JanksonConfigSerializer::new) ); [PreviousPost-Validationchevron-left](https://shedaniel.gitbook.io/cloth-config/auto-config/post-validation) [NextCustom Gui Handlerschevron-right](https://shedaniel.gitbook.io/cloth-config/auto-config/custom-gui-handlers) Last updated 5 years ago --- # Setup with Fabric | Cloth Config Please DO NOT use Auto Config / Cloth Config for server mods [hashtag](https://shedaniel.gitbook.io/cloth-config/setup-cloth-config#adding-via-gradle) Adding Via Gradle ---------------------------------------------------------------------------------------------------------------- Becoming a super hero is a fairly straight forward process: build.gradle Copy repositories { maven { url "https://maven.shedaniel.me/" } maven { url "https://maven.terraformersmc.com/releases/" } } dependencies { [...] modApi("me.shedaniel.cloth:cloth-config-fabric:ABC") { exclude(group: "net.fabricmc.fabric-api") } } circle-info Replace **ABC** with the version of Cloth Config desired, the versions of Cloth Config can be found at [Linkie Webarrow-up-right](https://linkie.shedaniel.me/dependencies) . [PreviousFrequently Asked Questionschevron-left](https://shedaniel.gitbook.io/cloth-config/frequently-asked-questions) [NextSetup with Forgechevron-right](https://shedaniel.gitbook.io/cloth-config/setup-cloth-config/setup-with-forge) Last updated 3 years ago --- # Creating a Config Screen | Cloth Config Call `ConfigBuilder.create()` to create a new config builder, from there you can **set the background**, **create new categories**, **disable smooth scrolling**, etc. The title will be **automatically translated** to the language the user selects, make sure you localize the language in the language file. circle-check Parent Screen is the screen when the user clicks done or cancel, you should put the current screen as the parent screen. Copy ConfigBuilder builder = ConfigBuilder.create() .setParentScreen(parent) .setTitle(new TranslatableText("title.examplemod.config")); circle-exclamation You have to create a new config screen builder **every single time** you open the config menu. [PreviousSetup with Forgechevron-left](https://shedaniel.gitbook.io/cloth-config/setup-cloth-config/setup-with-forge) [NextSaving the Configchevron-right](https://shedaniel.gitbook.io/cloth-config/using-cloth-config/saving-the-config) Last updated 5 years ago --- # Introduction to Auto Config 1u | Cloth Config Annotation based API for mod configs, with Cloth Config GUI integration, intended to be used by other mods. Simply add some annotations to your config class and this mod will take care of generating the config GUI for you. [PreviousModMenu Integrationchevron-left](https://shedaniel.gitbook.io/cloth-config/advanced/modmenu-integration) [NextSetup with Gradlechevron-right](https://shedaniel.gitbook.io/cloth-config/auto-config/setup-with-gradle) Last updated 3 years ago --- # Creating a Dropdown Menu | Cloth Config This page has not been rewritten, please look at the old wiki: [https://github.com/shedaniel/ClothConfig/wiki/Dropdown-Menuarrow-up-right](https://github.com/shedaniel/ClothConfig/wiki/Dropdown-Menu) [PreviousBuilding the Config Screenchevron-left](https://shedaniel.gitbook.io/cloth-config/using-cloth-config/building-the-config-screen) [NextModMenu Integrationchevron-right](https://shedaniel.gitbook.io/cloth-config/advanced/modmenu-integration) Last updated 6 years ago ---