Back to NxLabs

NxLabs / Vintage Story

HudUI

RBy ripls

Hotbar and world interaction hud remake. Now with theming available!

HudUI

Description

Overview

HudUI replaces the vanilla hotbar, world interaction help, block info with a custom UI built on libGUI.

If your mod adds a new stat, you can register a bar into the edge-bar system — no patching required.

Theming

To switch themes, set "theme" in ModConfig/libgui.json. The UI redraws the moment you save the file — no game restart, no reload command.

Looking for more looks? Check here.

For Mod Authors — Adding a Bar

HudUI exposes EdgeBarController.Instance — initialized during StartClientSide.

1. Register the bar

Create two ValueNotifier<float> fields and call AddBar in StartClientSide. Update .Value whenever your stat changes — the GUI redraws automatically.

<pre style="font-family: 'JetBrains Mono', monospace; background: #e8d8ce; border-left: 3px solid #7d4f50; padding: 14px 18px; font-size: 0.85em; border-radius: 0 4px 4px 0; margin: 8px 0; line-height: 1.6;">public override void StartClientSide(ICoreClientAPI api) { if (!api.ModLoader.IsModEnabled("hudui")) return;

_myStatNotifier = new ValueNotifier&lt;float&gt;(1f); _myStatDisplay = new ValueNotifier&lt;float&gt;(0f);

api.Event.RegisterGameTickListener(_ =&gt; { float current = / your current value /; float max = / your max value /; if (max &lt;= 0) return;

_myStatNotifier!.Value = current / max; _myStatDisplay!.Value = current; }, 20);

EdgeBarController.Instance!.AddBar( "mymod:mystat", EdgeBarSide.Right, new EdgeBarConfig( "#48cae4".FromHex(), _myStatNotifier, displayValueSource: _myStatDisplay, flashThreshold: 0.2f, tooltipBuilder: (_, _) =&gt; new BarTooltipContent("My Stat", _currentMyStat, _maxMyStat), iconDomain: "mymod", iconPath: "textures/hud/mystat.svg" ) ); }</pre>

2. Dynamic bars (optional)

Show a bar only when needed — add and remove it on the fly:

<pre style="font-family: 'JetBrains Mono', monospace; background: #e8d8ce; border-left: 3px solid #7d4f50; padding: 14px 18px; font-size: 0.85em; border-radius: 0 4px 4px 0; margin: 8px 0; line-height: 1.6;">var controller = EdgeBarController.Instance!; bool isActive = / your condition /; bool hasBar = controller.HasBar("mymod:mystat");

if (isActive &amp;&amp; !hasBar) controller.AddBar("mymod:mystat", ...); if (!isActive &amp;&amp; hasBar) controller.RemoveBar("mymod:mystat");</pre>

3. Cleanup

Dispose your notifiers in ModSystem.Dispose:

<pre style="font-family: 'JetBrains Mono', monospace; background: #e8d8ce; border-left: 3px solid #7d4f50; padding: 14px 18px; font-size: 0.85em; border-radius: 0 4px 4px 0; margin: 8px 0; line-height: 1.6;">public override void Dispose() { _myStatNotifier?.Dispose(); _myStatDisplay?.Dispose(); base.Dispose(); }</pre>

Compatible mods

HydrateOrDiedrate — thirst bar

Vigor — stamina bar

Ratings & reviews

No ratings yet

Sign in to leave a rating or comment.