

Description
<div style="font-family: 'JetBrains Mono', monospace; background: #f0e4db; border-left: 4px solid #aa998f; padding: 16px 20px; border-radius: 0 8px 8px 0; margin-bottom: 16px;"><p style="font-size: 0.8em; text-transform: uppercase; letter-spacing: 2px; color: #aa998f; margin-bottom: 8px;">Overview</p> <p>HudUI replaces the vanilla hotbar, world interaction help, block info with a custom UI built on <a href="https://mods.vintagestory.at/libgui">libGUI</a>.</p> <p>If your mod adds a new stat, you can register a bar into the edge-bar system — no patching required.</p> </div> <details style="font-family: 'JetBrains Mono', monospace; background: #f0e4db; border-left: 4px solid #8b9e7d; border-radius: 0 8px 8px 0; margin-bottom: 16px; overflow: hidden;"> <summary style="padding: 16px 20px; cursor: pointer; font-size: 0.8em; text-transform: uppercase; letter-spacing: 2px; color: #8b9e7d; user-select: none;">Theming</summary> <div style="padding: 0 20px 16px 20px;"> <p>To switch themes, set <code>"theme"</code> in <code>ModConfig/libgui.json</code>. The UI redraws the moment you save the file — no game restart, no reload command.</p> <p>Looking for more looks? Check <a style="color: #7d4f50;" href="https://discord.com/channels/302152934249070593/1506510064616341514">here</a>.</p> </div> </details><details style="font-family: 'JetBrains Mono', monospace; background: #f0e4db; border-left: 4px solid #7d4f50; border-radius: 0 8px 8px 0; margin-bottom: 16px; overflow: hidden;" open="open"> <summary style="padding: 16px 20px; cursor: pointer; font-size: 0.8em; text-transform: uppercase; letter-spacing: 2px; color: #7d4f50; user-select: none;">For Mod Authors — Adding a Bar</summary> <div style="padding: 0 20px 16px 20px;"> <p>HudUI exposes <code>EdgeBarController.Instance</code> — initialized during <code>StartClientSide</code>.</p> <p style="font-size: 0.8em; text-transform: uppercase; letter-spacing: 2px; color: #aa998f; margin: 16px 0 6px 0;">1. Register the bar</p> <p>Create two <code>ValueNotifier<float></code> fields and call <code>AddBar</code> in <code>StartClientSide</code>. Update <code>.Value</code> whenever your stat changes — the GUI redraws automatically.</p> <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<float>(1f); _myStatDisplay = new ValueNotifier<float>(0f);
api.Event.RegisterGameTickListener(_ => { float current = /* your current value */; float max = /* your max value */; if (max <= 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: (_, _) => new BarTooltipContent("My Stat", _currentMyStat, _maxMyStat), iconDomain: "mymod", iconPath: "textures/hud/mystat.svg" ) ); }</pre> <p style="font-size: 0.8em; text-transform: uppercase; letter-spacing: 2px; color: #aa998f; margin: 20px 0 6px 0;">2. Dynamic bars (optional)</p> <p>Show a bar only when needed — add and remove it on the fly:</p> <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 && !hasBar) controller.AddBar("mymod:mystat", ...); if (!isActive && hasBar) controller.RemoveBar("mymod:mystat");</pre> <p style="font-size: 0.8em; text-transform: uppercase; letter-spacing: 2px; color: #aa998f; margin: 20px 0 6px 0;">3. Cleanup</p> <p>Dispose your notifiers in <code>ModSystem.Dispose</code>:</p> <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> </div> </details> <div style="font-family: 'JetBrains Mono', monospace; background: #f0e4db; border-left: 4px solid #d1be9c; padding: 16px 20px; border-radius: 0 8px 8px 0;"> <p style="font-size: 0.8em; text-transform: uppercase; letter-spacing: 2px; color: #cc8b86; margin-bottom: 8px;">Compatible mods</p> <p><a href="https://mods.vintagestory.at/hydrateordiedrate">HydrateOrDiedrate</a> — thirst bar</p> <p><a href="https://mods.vintagestory.at/show/mod/26142">Vigor</a> — stamina bar</p></div>
Ratings & reviews
Sign in to leave a rating or comment.


