When developing client-side Minecraft mods, developers often spend more time building and maintaining infrastructure than writing actual features.
Starting each mod requires re-implementing JSON serialization and settings menus from scratch. Whenever Minecraft updates its graphics pipeline, existing UI rendering code frequently breaks across versions.
As a mod expands to dozens of modules, runtime overhead adds up. Multiple on-screen HUDs repeat expensive vector calculations every frame, and unused event listeners execute on every tick, degrading performance.
Lucent is a core Fabric library designed to reduce this repetitive work. Here is an overview of how Lucent minimizes rendering overhead and manages configs and profiles.
Do We Need to Redraw Every HUD on Every Frame?
In-game overlays such as FPS counters, player coordinates, and keystroke displays are active throughout gameplay. Most mods recalculate background boxes, borders, shadows, and text strings on every frame refresh.
However, if the player is stationary and the displayed text has not changed, repeating identical vector draws hundreds of times per second is unnecessary.
In version 26.2, Lucent integrates an offscreen compositor built on Skija (Java bindings for Skia) with a two-tier caching pipeline.
Developers only need to return the values affecting visual output in their HUD class:
@Override
public Object getRenderCacheKey() {
// The HUD is redrawn only when these values change.
return List.of(mc.getFps(), mc.player.position());
}
The HUD manager combines this key with coordinates, scale, alignment, and screen dimensions. While these values remain static, vector drawing operations do not occur, preventing frame drops even with multiple active HUDs.
Supporting OpenGL and Vulkan with Lightweight Downloads
Minecraft's rendering stack is evolving toward Vulkan while maintaining support for OpenGL environments.
However, bundling native Skia binaries for Windows, macOS, and Linux across CPU architectures inside a mod JAR would inflate its size by tens of megabytes.
Lucent handles this through runtime environment detection and on-demand native provisioning.
Mod file sizes remain minimal, while the appropriate native acceleration libraries are provisioned on first run.
Binding Only the Events You Actually Implement
Client mods handle game ticks, network packets, chat messages, world rendering, and block interactions. Lucent's base Mod class defines over 60 event hooks.
With 50 active modules, iterating through all 50 modules on every tick to invoke empty methods causes unnecessary virtual call overhead.
Lucent uses reflection at module registration to identify only the methods that the subclass actually overrides.
getDeclaringClass() != Mod.class once on startup and registers listeners only for implemented callbacks.Tick hooks are also divided into four cadences for logic that does not require per-tick execution:
- onTick (1 tick): Real-time updates and input handling
- onMediumTick (5 ticks): Short-interval state checks
- onHighTick (10 ticks): Entity scanning
- onEverySecond (20 ticks): 1-second interval statistics and timers
Moving non-urgent checks to larger intervals substantially reduces the frequency of event executions.
Annotation-Driven Configs and Profile Storage
Building settings UI layouts and writing serialization logic is a repetitive task. In Lucent, annotating fields with @ModConfig builds the settings screen and handles JSON storage automatically:
@ModConfig.CategoryPriority(name = "General", priority = 1000)
public class ExampleMod extends Mod {
@ModConfig(
type = ConfigType.SWITCH,
name = "Enable Highlight",
description = "Renders an outline around targeted blocks."
)
public static boolean useHighlight = false;
@ModConfig(
type = ConfigType.COLOR,
name = "Highlight Color",
parent = "useHighlight"
)
public static Color highlightColor = new Color(85, 255, 85, 255);
}
Using the parent property automatically creates a hierarchical UI where child options appear only when their parent setting is enabled.
Why Store Configs in OS Application Data?
Most mods store settings inside the .minecraft/config folder. When using multi-instance launchers or installing new Minecraft versions, players must reconfigure keybinds and HUD positions from scratch.
Lucent stores configurations in the operating system's application data directory (%APPDATA%/Lucent on Windows).
Integrating Lucent in Third-Party Mods
Connecting a mod to Lucent requires only a few lines using the LucentAPI class:
public class MyClientMod implements ClientModInitializer {
public static final ModManager CONFIG = LucentAPI.createModManager("mymod");
@Override
public void onInitializeClient() {
CONFIG.register(new ExampleMod());
LucentAPI.registerHUD(CONFIG, new ExampleHUD());
}
}
Translations placed under assets/<modid>/lucent/lang/ inside dependent mod JARs are discovered and merged automatically on startup. The full source code is available in the Lucent GitHub repository.