HUD
The HUD is drawn with the resource pack: a font and a shader are added to BetterModel's pack, and the whole HUD is sent to each player as one message of the action bar.
What players see
| Where | What |
|---|---|
| Top right | The zone, with its parents (Capital - Market), and the position, each text against the edge of the screen and its icon after it. In both styles. |
Top left (style: full) | A card: the head of the player in a frame, `level |
| Bottom | The hearts of the game, and a bar of ten mana drops in place of the hunger bar. |
- There is no hunger while the mana bar is on (
hud.manaBar): food stays full, so nobody starves and sprinting always works. - In the
compactstyle, the numbers15/20and30/50are written above the hearts and the mana drops. - Walking into a zone is announced in a subtitle, because the action bar is the HUD's.
- A player whose game has not loaded the pack gets a line of plain text on the action bar instead (
plaininhud.yml). - The game's own boss bars stay where they are: the HUD does not use them.
Settings
hud: in config.yml:
| Setting | Default | What it is |
|---|---|---|
enabled | true | false: no HUD, and nothing of it in the pack. |
style | compact | compact: the zone and the position. full: those and the card. |
shader | true | Adds the shader to the pack. It is written for Minecraft 26.3: if the HUD is not where it should be, or the game complains, set it to false: everyone then reads the line of plain text. |
manaBar | true | The bar of mana drops in place of the hunger bar, and no hunger. Needs the shader. |
gauges | false | With manaBar: the life and the mana as two wide gauges at the bottom of the screen, in place of the hearts and the hunger bar. The hearts of the game are then hidden, and the effects shown on them (poison, absorption, hardcore...) are not seen. |
assumePack | false | Shows the HUD to every player as if their game had the pack. For trying files from a pack of your own game, see the developer page. |
mockSkin | empty | The Minecraft name of an account whose skin is shown in the card instead of the player's own. For a server that does not know skins (one without authentication, such as the dev stack). |
A change of style, of the texts or of the lines applies at the next refresh. A change of what is in the pack (shader,
manaBar, gauges, the place, size or colours in hud.yml) makes the plugin publish the pack again, which connected
players load again.
hud.yml: the lines
Next to config.yml, written from the plugin's defaults when missing, read again by /gcadmin reload.
colors: # the texts above the hearts and the mana drops
life: "#FF5555"
mana: "#55AAFF"
styles:
compact:
marker: compact
x: 6 # compact: from the right edge of the screen
y: 2 # from the top
scale: 1
width: 220 # what every line is padded to
lifeText: "{health}/{maxHealth}"
manaText: "{mana}/{maxMana}"
plain: "{zone.name|No zone} | {x}, {y}, {z}"
lines:
- [ { text: "{zone.path|No zone}", right: 208, fit: 206 }, { gap: 2 }, { icon: map } ]
- [ { text: "{x}, {y}, {z}", right: 208 }, { gap: 2 }, { icon: compass } ]
A style is lines, from the top. A line is a list of elements, from left to right, each exactly one of:
| Element | What it draws |
|---|---|
icon: map or compass | A picture of the pack. |
gap: <pixels> | Nothing, that wide. |
text: "<template>" | Text. With fit: <pixels> it is cut with an ellipsis to that width, with at: <pixel> it starts at that pixel of the line, with right: <pixel> it ends there. |
gauge: life or mana | A continuous gauge (112 pixels), with label: "<template>" to write a text in its middle. |
head: true | The face of the player, 8 x 8 squares. |
plate: true, portrait: true | The card behind the rows and the frame of the head. Drawn at the cursor, which does not move. |
back: <pixels> | Moves the cursor back, to draw over what is already there. |
bar: life or mana | The older bar of segments, with segments: <n>. |
panel: true | The framed panel of the first version of the HUD. No style uses it. |
Pixels are those of the HUD. The compact style is up to 4 lines and the full one up to 8.
A template is text with variables in braces. {variable|text} writes the text when the variable has no value (a player in no
zone has no zone).
| Variable | Value |
|---|---|
{name}, {level} | The player's name and level. |
{health}, {maxHealth}, {mana}, {maxMana} | Life and mana. |
{zone} | The name of the zone with its levels. |
{zone.name}, {zone.path} | The name of the zone, and the names of the zone and of those it is in (Capital - Market). |
{zone.min}, {zone.max} | The recommended levels. |
{x}, {y}, {z} | The block of the player. |
Per style
| Setting | What it is |
|---|---|
marker | compact or full: the colour its lines have, for the shader to find them. It also decides how many lines there can be. |
include | Another style whose lines are drawn too, in its own place. full includes compact: the card at the top left, the zone and the position at the top right. |
x, y | Where the style starts, in pixels from the corner of the screen: compact from the top right, full from the top left. |
scale | Its size, 1 as drawn. |
width | What every line is padded to. A line wider than that still works. |
lifeText, manaText | A text above the hearts and above the mana drops. None by default. |
plain | What a game without the pack reads. |
Changing the pictures
The icons, the gauges and the card are pictures in samples/rpg-sample/hud-art/ of the repository, turned into the pack's files by
a script. How to change them is on the developer page.