Skip to content

Config Layer

Maksym Uimanov edited this page Jan 30, 2026 · 2 revisions

Config Layer

Overview

The Config Layer is responsible for NeoForge configuration support for a mod.

If earlier layers handle:

  • structure (Initialization),
  • registration (Registry),
  • semantics (Metadata),

then the Config Layer answers:

“How does NeoForge Config become visible, usable, and integrated?”

This layer is the bridge between configuration metadata and user-facing configuration UX/UI.


Core Responsibility

The Config Layer is responsible for:

  • Executing configuration-related annotation processors
  • Registering configuration screens / UI
  • Exposing configuration through NeoForge extension points
  • Allowing mods to extend or replace config presentation logic

ConfigLayer

Definition

public class ConfigLayer implements EngineLayer

Static Processor

private static final AnnotationProcessor CONFIG_PROCESSOR = new ConfigAnnotationProcessor();

This processor is always executed, regardless of configuration.

Interpretation: Configuration annotations are mandatory metadata - they are not optional or lazy.


processAllTasks()

@Override
public void processAllTasks()

Execution order

  1. Run configuration annotation processing
  2. Run default config showcasers
  3. Run dynamically injected config showcasers

Step-by-step behavior

1. Process configuration annotations

CONFIG_PROCESSOR.process();

This step:

  • Interprets configuration-related annotations
  • Prepares config structures for later usage

This relies on work done in the Metadata Layer.


2. Run default ConfigShowcasers

configShowcasers.forEach(ConfigShowcaser::showcase);

These are provided by the framework.


3. Run dynamic ConfigShowcasers

objectPool.getAll(ConfigShowcaser.class)

This allows:

  • Mods to inject custom config UIs
  • Libraries to extend configuration behavior
  • Replacement without forking core code

ConfigLayerBuilder

Default configuration

private static final List<ConfigShowcaser> DEFAULT_CONFIG_SHOWCASERS = List.of(new SimpleConfigShowcaser());

By default, one config presentation mechanism is registered.


Builder execution

this.engineBuilder.processLayer(this.configLayer);

Like other layers, ConfigLayer executes immediately when configured.

This ensures:

  • Config screens are available early
  • UI is registered before game load completes

ConfigShowcaser

Role

A ConfigShowcaser is responsible for:

Making configuration visible to the user

It does not:

  • Define config values
  • Parse annotations
  • Store config state

It only exposes configuration.


SimpleConfigShowcaser

Definition

public class SimpleConfigShowcaser implements ConfigShowcaser

Behavior

ModContainer modContainer = InjectionPool.getFromInstance(ModContainer.class);

modContainer.registerExtensionPoint(
    IConfigScreenFactory.class,
    ConfigurationScreen::new
);

This registers a NeoForge configuration screen.


What this means

  • The mod gains a config screen in the Mods UI
  • The screen is generated via ConfigurationScreen
  • NeoForge handles lifecycle and rendering

Interpretation: Temporal API does not replace NeoForge config — it integrates with it.


Extending the Config Layer

Custom ConfigShowcaser

You can provide your own implementation:

public class MyConfigShowcaser implements ConfigShowcaser {
    @Override
    public void showcase() {
        // custom UI / logic
    }
}

Register it via:

  • InjectionPool
  • or ConfigLayerBuilder

Replacing defaults

.configureConfigLayer()
.configShowcasers(List.of(new MyConfigShowcaser()))
.and()

This fully replaces the default behavior.


Summary

The Config Layer:

  • Registers configuration UI
  • Integrates with NeoForge Config
  • Supports extension and override

It is the presentation layer of configuration in Temporal API.

Clone this wiki locally