Skip to content

What is TemporalEngine

Maksym Uimanov edited this page Jan 29, 2026 · 1 revision

What is TemporalEngine

This page explains the architecture of the Temporal Engine and how to configure its execution layers.


Core Concepts

TemporalEngine

TemporalEngine is the main entry point responsible for bootstrapping the Temporal API and orchestrating the execution of all engine layers.

EngineLayer

EngineLayer is a single, ordered processing stage that performs a specific category of tasks during mod initialization.

LayerContainer

LayerContainer is a registry that stores, orders, and provides access to all active EngineLayer instances.


Built-in Engine Layers

InitializationLayer

The InitializationLayer prepares the engine context, resolves the mod class, and registers external sources such as the IEventBus and ModContainer.

RegistryLayer

The RegistryLayer handles registration of objects (items, blocks, etc.) using factories.

MetadataLayer

The MetadataLayer processes metadata-related annotations (f.e, datagen annotations).

ConfigLayer

The ConfigLayer manages NeoForge Config-related processing.

EventLayer

The EventLayer connects Temporal API logic to the NeoForge Event Bus and registers event-driven behaviors.

FinalizationLayer

The FinalizationLayer performs cleanup and final validation after all other layers have been processed.


Default Engine Configuration

The simplest and recommended way to start the engine is:

TemporalEngine.run(ExampleMod.class, modEventBus, modContainer);

This method:

  • prints the Temporal API banner
  • initializes logging and mod context
  • builds and executes the default layer pipeline

Default Layer Pipeline

Internally, TemporalEngine.run(...) uses the following configuration:

TemporalEngine.defaultBuilder(modClass, eventBus, modContainer)

Which registers layers in this order:

  1. InitializationLayer
  2. RegistryLayer
  3. MetadataLayer
  4. ConfigLayer
  5. EventLayer
  6. FinalizationLayer

This order defines the exact execution sequence.


Custom Engine Configuration

Creating a Custom Builder

To customize the engine, use an empty builder:

EngineBuilder builder = TemporalEngine.emptyBuilder();

You may then selectively configure layers.


Disabling a Layer

To remove a layer from the pipeline:

builder.disableLayer(EventLayer.class);

This completely excludes the layer from execution.


Adding a Custom Layer

You can manually register your own layer:

builder.addLayer(new CustomEngineLayer());

Custom layers must extend EngineLayer and implement task processing logic.


Layer Execution

Each layer is processed sequentially using:

engineLayer.processAllTasks();

The engine logs:

  • when a layer starts processing
  • when it finishes processing

This ensures deterministic and traceable execution.


LayerContainer Behavior

  • LayerContainer is a global singleton
  • layers are stored in insertion order
  • layers can be retrieved by index or class
  • duplicate layer classes are not automatically prevented

When Should You Customize the Engine?

You should customize TemporalEngine if:

  • you want to disable unnecessary layers
  • you need a custom processing stage
  • you require strict control over execution order

For most mods, the default configuration is sufficient.

Clone this wiki locally