Skip to main content

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​

WhereWhat
Top rightThe 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
BottomThe 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 compact style, the numbers 15/20 and 30/50 are 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 (plain in hud.yml).
  • The game's own boss bars stay where they are: the HUD does not use them.

Settings​

hud: in config.yml:

SettingDefaultWhat it is
enabledtruefalse: no HUD, and nothing of it in the pack.
stylecompactcompact: the zone and the position. full: those and the card.
shadertrueAdds 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.
manaBartrueThe bar of mana drops in place of the hunger bar, and no hunger. Needs the shader.
gaugesfalseWith 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.
assumePackfalseShows 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.
mockSkinemptyThe 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:

ElementWhat it draws
icon: map or compassA 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 manaA continuous gauge (112 pixels), with label: "<template>" to write a text in its middle.
head: trueThe face of the player, 8 x 8 squares.
plate: true, portrait: trueThe 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 manaThe older bar of segments, with segments: <n>.
panel: trueThe 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).

VariableValue
{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​

SettingWhat it is
markercompact or full: the colour its lines have, for the shader to find them. It also decides how many lines there can be.
includeAnother 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, yWhere the style starts, in pixels from the corner of the screen: compact from the top right, full from the top left.
scaleIts size, 1 as drawn.
widthWhat every line is padded to. A line wider than that still works.
lifeText, manaTextA text above the hearts and above the mana drops. None by default.
plainWhat 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.