Download Fiber2Cloth — Minecraft Mods — MetaMods

Fiber2Cloth

Active

Downloads

8

Last update

3 years ago
Client
Fabric
Quilt
Forge
Neoforge
Control

Fiber2Cloth

Configuration Image

Fiber2Cloth is a convenient library that allows converting Fiber configuration nodes into Cloth Config interfaces with just one line of code.

Compatibility and Requirements

The library requires Cloth Config 2 version 1.1.1 or higher. Please note that this is an experimental version with a limited set of features. The developer is actively testing it in their own projects.

Supported Data Types

The library automatically works with the following types:

  • Integer values (Integer, Long)
  • Floating-point numbers (Float, Double)
  • Boolean values
  • Strings
  • Arrays of various types

API Usage

The main functionality is implemented with one line of code:

Fiber2Cloth.create(screen, modid, configNode, configScreenTitleKey).setSaveRunnable(() -> {
    // Here the node serialization into configuration file is performed
}).build().getScreen();

The system automatically creates categories for values without parent nodes, supports multi-level nesting, and forms subcategories starting from the second level.

Extending Functionality

To work with unsupported data types, use the Fiber2Cloth#registerConfigEntryFunction method, which accepts the object class and a conversion function from ConfigValue to AbstractConfigListEntry.

Interface Customization

To change the default "Yes/No" texts in boolean toggles, add translations to language files with keys in the format config.{modid}.{valueName}.boolean.{true/false}.

Project members
shedaniel

shedaniel

Created: 14 Jun 2021

ID: 15707