Showing server data on the HUD
A server or script can send data to the HUD only through text channels (title, subtitle, action bar, sidebar scoreboard). The resource pack's ui/hud_screen.json reads that text with bindings and expressions, turns it into text, bars or icons, and hides the vanilla display when the data is its own. This page uses the title channel as the base and gives only the selection criteria for the other channels.
When to use it
| What to show | Channel and method | Rules |
|---|---|---|
| A notification or one latest value (status, toast) | Title + a hud_title_text_factory in my own layer | HOST-14, HOST-27, PAT-08 |
| One number that changes often (progress, angle) | Show a title, then change only the subtitle with updateSubtitle. The control is not created again | BND-40 |
| A last value that must stay when the next title arrives | Title + a value-preserving latch | BND-18 |
| Action bar text drawn my way | A second hud_actionbar_text_factory, variable $actionbar_text | HOST-30, HOST-48 |
| Several lines that must always be visible (quests, scores) | Split the sidebar scoreboard by section markers (up to 15 lines) | HOST-45 |
| Notifications that pile up at the same time | A second chat_item_factory on chat | HOST-14, HOST-29, PAT-09 |
Cases where it does not fit, and the alternative:
| Case | Alternative |
|---|---|
| The player must choose or type something | A server form host (Reskinning a server form, HOST-01) |
| It must follow a 3D position | Not JSON UI (When JSON UI does not fit, HOST-01) |
| Text must show while a chest menu is open | The chest screen cannot read the title or the sidebar. Send it as slot item names (#hover_text) (HOST-53, HOST-17) |
| Drawing item icons without knowing numeric item IDs (Script API add-on) | A texture path image or an inventory mirror (HUD item icons) |
Minimal example
Source: the example in section 10 of HUD and title channels. It worked on Windows 1.26.65 with the code below as is {measured} (2026-11-27). It shows a HUD label only while the title starts with the prefix hudlabel_demo:, draws the text after the prefix in the label, and hides the vanilla title.
hud_label_example/
manifest.json
ui/
_ui_defs.json
hud_screen.json
hudlabel.json
manifest.json (make new UUIDs):
{
"format_version": 3,
"header": {
"name": "HUD label example",
"description": "Shows a HUD label while the title starts with a fixed prefix",
"uuid": "5d1c8b0e-3f42-4a6b-9c71-0e2a7b9d4f13",
"version": "1.0.0",
"min_engine_version": "1.26.40"
},
"modules": [
{ "type": "resources", "uuid": "b7e94a21-6c3d-4f58-8a0b-1d5e2c7f9a64", "version": "1.0.0" }
],
"metadata": { "authors": ["Example"] }
}
ui/_ui_defs.json registers only the new file:
{
"ui_defs": [
"ui/hudlabel.json"
]
}
ui/hudlabel.json:
{
"namespace": "hudlabel",
"label_box": {
"type": "panel",
"size": [ 160, 16 ],
"anchor_from": "top_middle",
"anchor_to": "top_middle",
"offset": [ 0, 24 ],
"anims": [ "@hudlabel.stay" ],
"controls": [
{
"text": {
"type": "label",
"text": "#body",
"localize": false,
"bindings": [
{ "binding_type": "global", "binding_name": "#hud_title_text_string", "binding_name_override": "#raw" },
{ "binding_type": "view", "source_property_name": "(('%.14s' * #raw) = 'hudlabel_demo:')", "target_property_name": "#visible" },
{ "binding_type": "view", "source_property_name": "(#raw - 'hudlabel_demo:')", "target_property_name": "#body" }
]
}
}
]
},
"stay": { "anim_type": "wait", "duration": 3.0, "next": "@hudlabel.leave" },
"leave": {
"anim_type": "offset",
"easing": "in_back",
"duration": 0.5,
"from": [ 0, 0 ],
"to": [ 0, -40 ],
"destroy_at_end": "hud_title_text"
}
}
ui/hud_screen.json (same path as vanilla):
{
"hud_title_text": {
"modifications": [
{
"array_name": "bindings",
"operation": "insert_back",
"value": [
{ "binding_type": "global", "binding_name": "#hud_title_text_string" },
{
"binding_type": "view",
"source_property_name": "(not (('%.14s' * #hud_title_text_string) = 'hudlabel_demo:'))",
"target_property_name": "#visible"
}
]
}
]
},
"root_panel": {
"modifications": [
{
"array_name": "controls",
"operation": "insert_back",
"value": [
{
"hudlabel_factory": {
"type": "panel",
"size": [ "100%", "100%" ],
"factory": {
"name": "hud_title_text_factory",
"control_ids": { "hud_title_text": "hud_title_text@hudlabel.label_box" }
}
}
}
]
}
]
}
}
The sending side calls player.onScreenDisplay.setTitle("hudlabel_demo:Welcome"). Welcome showed at the top center and disappeared within about 4 seconds, and the factory-created control was gone too. The vanilla title did not appear for this prefix, and a title without the prefix appeared as in vanilla {measured}. The label's position, size and animation times are example values.
Variant: keeping the last value
To show the last hudlabel_demo: value after the label is gone, add a latch. The latch structure is copied from juc_hud.json of the measurement add-on json-ui-claims and worked on Windows 1.26.65.1 {measured} (BND-18). This exact combination, with the keyword changed to the example prefix and a reading expression that removes the prefix, was not measured in game {inferred}.
Add one more definition to ui/hudlabel.json:
{
"keep_host": {
"type": "panel",
"size": [ "100%", "100%" ],
"controls": [
{
"keep_latch": {
"type": "panel",
"size": [ 0, 0 ],
"property_bag": { "#saved": "" },
"bindings": [
{ "binding_name": "#hud_title_text_string" },
{ "binding_name": "#hud_title_text_string", "binding_name_override": "#saved", "binding_condition": "visibility_changed" },
{
"binding_type": "view",
"source_property_name": "((not ((#hud_title_text_string - 'hudlabel_demo:') = #hud_title_text_string)) and (not (#hud_title_text_string = #saved)))",
"target_property_name": "#visible"
}
]
}
},
{
"keep_text": {
"type": "label",
"size": [ 200, 8 ],
"anchor_from": "top_left",
"anchor_to": "top_left",
"offset": [ 4, 40 ],
"localize": false,
"text": "#text",
"bindings": [
{ "binding_type": "view", "source_control_name": "keep_latch", "source_property_name": "('Last: ' + (#saved - 'hudlabel_demo:'))", "target_property_name": "#text" }
]
}
}
]
}
}
Add one more item, { "keep_host@hudlabel.keep_host": {} }, to the root_panel value array in ui/hud_screen.json. When a new title contains the prefix and differs from the saved value, keep_latch is visible for one frame, and at that moment the visibility_changed binding copies the title into #saved. Other titles do not change #saved.
Must match
Files and wiring:
ui/hud_screen.jsonmust be at the same path as vanilla for itsmodificationsto apply (MOD-02). This file is not listed in_ui_defs.json; only new files are (FILE-01).- The binding that hides the vanilla title goes on the whole
hud_title_text. Ontitle_framealone, the subtitle can flash briefly (HOST-27).hud_title_texthas nobindingsto begin with, soinsert_backis safe (MOD-04). - The second factory's
factory.nameishud_title_text_factoryand thecontrol_idskey ishud_title_text(COL-14, HOST-27). For the action bar they arehud_actionbar_text_factoryand the keyhud_actionbar_text(HOST-30). - A factory-created control stays after the title ends unless an animation removes it. The value of
destroy_at_endmust be thecontrol_idskeyhud_title_text. An instance name or definition name did not remove it{measured}(claim measurements 6.2). - Make the prefix long and unique, and let one prefix decide both hiding the vanilla display and showing mine (HOST-15).
Expressions and bindings:
- N in
'%.Ns'is the UTF-8 byte count of the prefix. Letters and digits are 1 byte,§2, Korean 3, most emoji 4 (EXP-09, EXP-24). Fields cut by position use ASCII only, and multibyte characters go at the end. - The only working format is
'%.Ns'. Padding formats such as'%7.4s'return the input unchanged (EXP-25). The sending side does the padding. - A view binding expression must contain at least one
#property. Without one, the control's wholebindingsarray is dropped. An expression with only$variablescounts too (BND-05, BND-42). - A control that uses a global value in an expression binds that value itself (
{ "binding_name": "#hud_title_text_string" }). Another control's bound value is read only throughsource_control_name(BND-04, BND-08). #visibletakes only JSON booleans. An integer or string put in as is becomes the default true, so build a comparison such as(#n > 0)(BND-27).- Give labels
"localize": false. Through translation, tokens containing%disappear (TXT-01, TXT-17). - Numbers are not drawn by a label as is. Join them to a string as in
('n=' + #v); a float stays empty even when joined (TXT-06, EXP-22). - A latch needs all four: a size 0 panel, a default in
property_bag, the copy withbinding_condition: "visibility_changed", and a#visiblecondition of "contains the keyword and differs from the saved value" (BND-18). - Inside a factory-created control,
$title_textand$subtitle_textare strings, so they go straight intoignoredandvariablesrequiresexpressions.$actionbar_textis an object, so a direct comparison inside an expression is always false. Copy it with"$copy": "$actionbar_text"and compare the copy (HOST-28, HOST-48, FILE-17).
Common expressions (#s is the bound title string):
| Goal | Expression | Rules |
|---|---|---|
| Prefix check | (('%.14s' * #s) = 'hudlabel_demo:') | EXP-08 |
| Contains check at any position | (not ((#s - 'KEY') = #s)) | EXP-07 |
| Remove the prefix | (#s - 'hudlabel_demo:'). The same text later in the body is removed too | EXP-12 |
| Skip the first N bytes and take L bytes | ('%.11s' * (#s - ('%.20s' * #s))) | EXP-11 |
| String to number | ((#s - 'hp:') - 0). * 1 gives an empty string, + 0 appends a 0 | EXP-16, EXP-31 |
| Greater than or equal | ((#v > 10) or (#v = 10)), (not (#v < 10)). There is no >=, <=, != or % | EXP-02, EXP-03 |
| Range | ((#v > 5) and (#v < 17)). Do not chain comparisons | EXP-04, EXP-28 |
| A 0 to 100 value as a bar ratio | ((100 - (#v - 0)) * .01) into #clip_ratio. 0.01 is the integer 0 | EXP-27, PAT-10 |
| Pick a texture from text | ('textures/wiki/ui/example_' + #s) into #texture | HUD and title channels 3.1 |
A bar is an image with "clip_direction": "left" and a bound #clip_ratio (the ratio cut away, 0 to 1) (PAT-10). Integer division gives an integer, so (#cur / #max) gives only 0 or 1 (EXP-18).
When drawing item icons (inventory_item_renderer) from the subtitle:
- Put
runtime ID x 65536in the subtitle as fixed-width fields, with a letter at the very start to keep it a string (HUD item icons 3.1). - The renderer reads
#item_id_auxonly when it is a JSON integer, so end the expression with- 0. Put numeric fields after a letter marker{code (binary)}(EXP-47). - To read through a binding, give the icon's
property_bag"#item_id_aux": 0and set the view binding tobinding_condition: "always". To read through a variable, cut it from$subtitle_textand put it in#item_id_auxofproperty_bag{measured}(HUD item icons 3.4).
Common mistakes
| Symptom | Cause | Fix |
|---|---|---|
| The vanilla title appears together with my label | No hiding binding, or N in '%.Ns' differs from the prefix byte count | A hiding binding on hud_title_text; count N again in bytes (HOST-27, EXP-08, EXP-24) |
| Text flashes briefly in the center | Hiding was put on title_frame only | Put it on the whole hud_title_text (HOST-27) |
| My label is always visible | The expression failed and #visible took the default true (>=, !=, % and so on) | Fix the expression. A failed expression may leave no log (BND-09, EXP-02, EXP-03) |
None of a control's bindings work, and the log has Must define a source property name in the binding! | One expression has no #property | Add a #property. For constant math, put "#z": 0 in property_bag and add + #z (BND-05, BND-42) |
| A number label is blank | Only a number was put into #text, or it is a float | ('n=' + #v); send floats as integers (TXT-06, EXP-22) |
| A number comparison is always false | Title pieces are strings, and = between a string and a number is false | ((#v - 0) = 35) (EXP-16, EXP-34) |
(#v * 1) is empty | String * number is an empty string | (#v - 0) (EXP-31) |
Text starting with Info: ... or nan... disappears | The result was read again as a float | Send it starting with a letter prefix such as §r (EXP-48, EXP-15) |
| A numeric field after the prefix breaks | An intermediate result starting with a digit dropped the text after it | Put numeric fields after a letter marker (EXP-44, EXP-30) |
| Fields with Korean text break or shift | '%.Ns' counts bytes | ASCII for fields cut by position, Korean at the end (EXP-09, TXT-13) |
| The label stays after the title ends | No removing animation, or a wrong destroy_at_end name | destroy_at_end: "hud_title_text" (claim measurements 6.2) |
| My HUD disappears when another add-on sends a title | There is only one title channel | Put values that must stay in a latch or the sidebar, and design assuming they can be overwritten (HOST-14, BND-18, HOST-45) |
| The client stops responding when the screen opens | A string was divided by a number | Convert with (#v - 0) before dividing (EXP-49, EXP-21) |
| An action bar variable comparison is always false | $actionbar_text is an object | Compare a copy variable (HOST-48) |
| HUD values are not visible while a server form is open | The HUD is not drawn while a form is open | "force_render_below": true on third_party_server_screen (HOST-44) |
Gray cells and an expected a string warning | The subtitle was sent as digits only | Put a letter at the start (HUD item icons 4) |
| A HUD with many cells is slow | A fixed expression per cell was chosen with requires | Keep one expression in the definition and pass only the position to each cell as a variable (BND-33, binding expression caching) |
Performance and limits:
- Send only when the content changes. For a data title, send fade in and fade out as 0 and a long stay, and send again before it ends (HUD item icons 3.5).
- Each title creates the factory control again and restarts its animation (ANI-12, COL-17). Send values that change often as the subtitle (BND-40).
- Parse strings in one place, a parent or a size 0 data control, and let children read only the result with
source_control_name(BND-10, BND-11). Values that are decided once usebinding_condition: "once"(BND-06). - At 64 cells the two expression layouts showed no difference; at 256 cells screen frames were about 4 to 5 against about 22
{measured}(mobile, binding expression caching). - There is a community report that titles and the action bar keep being processed while the HUD is covered (inventory, chat, F1), and heavy bindings can then stall (JSON UI optimization 3).
- Integers in expressions are 32-bit (EXP-18). Large numbers such as 64-bit IDs are not handled as numbers in expressions (EXP-50).
#hud_title_text_stringkept the last value after the title left the screen, and was empty after rejoining the world{measured}(claim measurements 6.5).- Hiding the vanilla HUD with
setHudVisibility(SetHud) leaves elements the pack added{record}(HUD and title channels).
Version conditions
- An expression dividing a string by a number froze the Windows 1.26.65 client and did not freeze mobile 1.26.63. On every version, convert with
(#v - 0)before dividing (EXP-49). - The 26.70 preview (26.70.20) reports wrong binding expressions and view binding loops as content log errors
{docs}(26.70 preview). Expressions that fail silently on release can appear in the log on the preview.
How to check
- Turn on Content Log GUI under Creator in the settings. On Windows the file is
%APPDATA%/Minecraft Bedrock/logs/ContentLog<date>.txt(DBG-01, DBG-33). - If the pack is new, restart the game and enable it in the world's resource pack list (DBG-18).
- Enter the world and search the log for
Must define a source property name in the binding!,Invalid expression,JSON UI parse failure - expected a string.,Expected variable not foundandUnknown propertylines (DBG-34). An empty log does not prove an expression is right (DBG-33). - Send a title with the prefix:
setTitlefrom a script, or/title @s title hudlabel_demo:Welcomein chat. Check that my label shows and the vanilla title does not. - Send a title without the prefix (
/title @s title plain). The vanilla title must appear and my label must not. With the latch, check that theLast:line keeps the previous value. - If hiding does not work, draw the expression and its negation at the same spot, or print
('V' + #property)in a label, to tell whether the expression itself failed (DBG-03). - After editing a development resource pack, run
/reload all./reload allrereads development resource packs, and/reloadreloads only scripts and functions (Diagnosing load failures). If the UI still does not change, restart the game (Debugging and versions).
Further reading
- HUD and title channels:
ScreenDisplaymethods, toasts, block info panel, sidebar channel - Screen hosts and data channels: HOST-14, HOST-15, HOST-17, HOST-27, HOST-28, HOST-29, HOST-30, HOST-44, HOST-45, HOST-48, HOST-53
- Expressions and operators: EXP-02~04, EXP-07~09, EXP-11, EXP-12, EXP-15, EXP-16, EXP-18, EXP-22, EXP-24, EXP-25, EXP-27, EXP-28, EXP-30, EXP-31, EXP-34, EXP-44, EXP-47~50
- Bindings: BND-04~06, BND-08~11, BND-18, BND-27, BND-33, BND-40, BND-42
- Text and localization: TXT-01, TXT-06, TXT-13, TXT-17
- Pattern recipes (2): PAT-08 title toast, PAT-09 chat toast, PAT-10 progress bar
- Drawing item icons and counts dynamically on the HUD
- Binding expression caching, JSON UI optimization
- Debugging and versions: DBG-01, DBG-03, DBG-18, DBG-33, DBG-34
- Other rules used: MOD-02, MOD-04, FILE-01, FILE-17, COL-14, COL-17, ANI-12, HOST-01
| id | Source | License | Commit | Accessed |
|---|---|---|---|---|
ms-learn | Minecraft Creator documentation (Microsoft Learn) | CC BY 4.0 (documentation), MIT (code) | a9fd1c0 | 2026-11-13 |
bedrock-wiki | Bedrock Wiki | CC BY 4.0 (docs/licenses/CC-BY-4.0.md in the repository) | 0930b39 | 2026-11-13 |
private-research | Private research (-) | - | 2026-11-13 | |
repo-guide | JSON UI comprehensive guide (this repository) (guide/) | This project's material | 2026-11-13 | |
repo-bedrock-core | bedrock-core UI analysis (this repository) (bedrock-core/) | This project's material | 2026-11-13 | |
bedrock-core | bedrock-core UI (@bedrock-core/ui) | MIT (confirmed in the repository LICENSE, Copyright 2026 bedrock-core) | aee2bbd (analysis baseline, clone HEAD 51d5cf2) | 2026-11-13 |
advancementpack | AdvancementPack (r4isen1920) | MIT (confirmed in the repository LICENSE, Copyright 2024 r4isen1920) | 0a79929 (analyzed v4.2, researched 2026-10-20) | 2026-11-13 |
bedrock-samples | Mojang bedrock-samples | Minecraft EULA applies, (c) Mojang AB. All rights reserved | 15701fa9 (guide baseline 46ba6ea) | 2026-11-13 |
cinnabar | Cinnabar (json-ui crate) | PolyForm Noncommercial License 1.0.0 (confirmed in the repository LICENSE). Used only to check behavior and as an implementation reference; the original text is not copied | ceb0fb6 (analysis baseline, clone HEAD df826f5) | 2026-11-13 |
minecraft-feedback-mojira | Minecraft Feedback posts and Mojira issues | Each author's work. Facts only, rewritten | 2026-11-13 |