Download Lexiconfig — Minecraft Mods — MetaMods

Lexiconfig

Active

Downloads

12

Last update

5 months ago

Versions

1.18 — 1.20.6
Client and server
Fabric
Forge
Neoforge
Game mechanics
Libraries
Utils

Lexiconfig

Lexiconfig is a configuration file API designed to provide compatibility with various configuration libraries. The main goal of the project is to simplify the creation of multi-platform mods with a convenient settings system.

Key Features

The system uses a simple annotation-based syntax that significantly facilitates the process of creating new configuration files. If you are a regular mod user, this information may not be very useful. However, for developers who want to integrate Lexiconfig into their projects, detailed usage instructions are provided below.

Compatibility

Currently, not all configuration libraries are supported, but development continues, and more compatibilities are planned to be added in the future for seamless integration between different systems.

Current integration status with popular libraries:

  • ✅ Configured — integrated
  • ❌ Cloth Config — not integrated
  • ❌ oωo config — not integrated
  • ❌ Forge Config Screens — not integrated

For Developers

The mod provides an API for creating custom lexicons, listening to events, and other operations.

Dependency

Add to build.gradle file:

repositories {
  maven { url 'https://maven.codinglitch.com/repository/releases' }
}

dependencies {
  implementation "com.codinglitch.lexiconfig:lexiconfig-api:API_VERSION_HERE"
}

Current API versions can be viewed on the corresponding website.

Usage

To create your own lexicons, you first need to create a library. Create a new class extending the Library class and add the @LexiconLibrary annotation:

@LexiconLibrary
public class MyNewLibrary extends Library {
  @Override
  public void shelveLexicons() {

  }
}

In a Forge environment, no additional changes are required. For Fabric, you need to add this class as an entry point in fabric.mod.json:

//...
"entrypoints": {
  "lexiconfig": [
    "com.path.to.MyNewLibrary"
  ]
}
//...

Next, create a class for the lexicon with appropriate annotations:

@Lexicon(name = MY_LEXICON_TITLE) // it is recommended to use your mod identifier as the name
public class MyLexicon extends LexiconData {
  @LexiconEntry(comment = "This is a comment for a simple field!")
  public String mySimpleField = "content";

  @LexiconPage(comment = "This is a new comment for the new category!")
  public MyNewPage myNewPage = new MyNewPage();

  public static class MyNewPage extends LexiconPageData {
    @LexiconEntry(comment = "This field is inside a lexicon page!")
    public Boolean myPageField = true;
  }
}

The final step is adding the lexicon to the library and registering it:

@LexiconLibrary
public class MyNewLibrary extends Library {
  public static MyLexicon MY_LEXICON = new MyLexicon();

  @Override
  public void shelveLexicons() {
    LexiconfigApi.shelveLexicon(MY_LEXICON);
  }
}
Project members
CodinGlitch

CodinGlitch

Developer

Created: 21 May 2024

ID: 2453