HUDs
A HUD is a small panel that stays on the player's screen while he plays, next to Minecraft's own hotbar and health: his money and level, the quest he follows, his coordinates. It belongs to the screen, not to the world, so it keeps its place while he walks, turns, jumps, flies or changes worlds.
Every HUD is one YAML file in plugins/Reticle/huds/. The file name is the HUD's name: quest.yml holds the HUD quest. Name HUDs with lowercase letters, digits, _ and -, at most 32 of them. Reticle creates the folder empty, so a new server shows no HUD until you add one; the templates are a quick start.
Run /reticle reload after you change a file. HUDs saved in the editor take effect at once.
This is the quest template, with comments added:
# Where the HUD sits: top_left, top, top_right, left, center, right, bottom_left, bottom or bottom_right.
Anchor: top_left
# The distance from the screen edges it sits against, in HUD pixels.
Offset: [6, 58]
# The HUD's size in HUD pixels. Together with its Offset it must fit a screen of 320 by 240.
Size: [160, 36]
Theme: dark
# Shown as a boss bar to players who cannot draw the HUD. Remove the line to show them nothing.
Fallback: "<gold>The lost village <gray>Follow the river north"
Elements:
icon:
Type: item
Position: [6, 4]
Size: [28, 28]
Icon: WRITABLE_BOOK
Icon_Background: "#FF9F0A"
quest:
Type: text
Position: [40, 7]
Size: [114, 9]
Text: "The lost village"
Align: left
step:
Type: text
Position: [40, 20]
Size: [114, 9]
Text: "Follow the river north"
Align: left
Color: "#98989D"HUD keys
| Key | Default | What it does |
|---|---|---|
Anchor | required | The corner, edge or center of the screen the HUD keeps to, see Where a HUD sits |
Offset | [0, 0] | [x, y] in HUD pixels from the screen edges the HUD sits against |
Size | required | [width, height] in HUD pixels, from 8 by 8 up to 320 by 240. With its Offset it must fit a screen of 320 by 240 |
Title | none | Text centered at the top, as in menus. The HUD must be tall enough for it |
Title_Scale | 1 | The size of the title, a whole number from 1 to 4. It needs Title |
Theme | dark | dark or light, the same colors as in menus |
Permission | none | The permission a player needs to see the HUD. Without it, every player may see it |
Order | 0 | A whole number from 0 to 7. Where two HUDs overlap, the one with the higher Order draws on top |
Auto_Show | true | true shows the HUD to every player who may see it, from the moment he joins. false shows it only when a command, the editor or a plugin shows it to him |
Refresh | none | Ticks between redraws of texts that hold placeholders, from 2 to 72000 (one hour) |
Fallback | none | One line of text with MiniMessage tags and placeholders, shown as a boss bar to players who cannot draw the HUD, see Who sees a HUD |
Elements | required | The elements, each under a name you choose |
Keys are case sensitive, and Reticle refuses any other key. Command is refused with its own message, because players turn HUDs off and on with /reticle hud.
Elements
A HUD takes four of the menu's element types, with the same keys and rules as in menu files:
| Type | What it is |
|---|---|
panel | A filled rectangle. A HUD holds at most 4 panels, or 3 beside a map |
text | One or more lines of text, with Text, Text_Scale, Align, Color and Background |
item | One icon, with Icon, Icon_Background and Background |
map | A minimap that follows the player, with Shape, Zoom, Markers, Background, Frame, Compass and Rotate, see Maps |
Nothing on a HUD can be clicked, so Reticle refuses the types button and input and the keys Hover and Actions. Texts take {player}, the coordinates {x}, {y} and {z}, and PlaceholderAPI placeholders as in menus. With Refresh: 20 every text that holds % or { is read again each second, and the player's game receives a text only when its value changed.
Where a HUD sits
Sizes and positions on a HUD are counted in HUD pixels. A HUD pixel is a GUI pixel at Minecraft's automatic GUI scale: the largest whole number at which a screen of 320 by 240 still fits the window. In a window of 1920 by 1080 that number is 4, so one HUD pixel takes 4 by 4 screen pixels; 2560 by 1440 gives 6 and 1280 by 720 gives 3. On the default GUI scale a HUD pixel is therefore exactly as large as a pixel of the hotbar, and a HUD with Anchor: bottom and Offset: [0, 22] ends right on top of the hotbar.
A player who chose a smaller GUI scale in his video settings types /reticle hud scale with the same number, such as /reticle hud scale 2, and his HUDs shrink to match. Reticle remembers his choice, and /reticle hud scale auto goes back to the automatic scale.
Anchor picks the point of the screen the HUD keeps to, and Offset moves it away from the edges it touches there:
- At a corner,
Offset: [6, 6]puts the HUD 6 pixels in from the side and 6 pixels in from the top or bottom edge. topandbottomcenter the HUD from left to right, andleftandrightcenter it from top to bottom. On such a centered axis a positiveOffsetmoves the HUD right or down.centercenters it both ways.
Every HUD must fit a screen of 320 by 240 HUD pixels, the smallest screen Minecraft gives at the automatic scale, so no part of it ever leaves the screen. On a wider screen the HUDs at the sides simply stand further apart. When a HUD does not fit, Reticle refuses it and says where it reaches:
HUD quest is not loaded: HUD 'quest' does not fit the smallest screen: at Anchor top_left with Offset [200, 6] it spans 200,6 to 350,46, but it must stay inside 320x240. Make it smaller or change its Offset. Fix huds/quest.yml, then run /reticle reload.Who sees a HUD
Reticle's resource pack draws HUDs, on Minecraft 1.21.11 and newer. A player gets the HUD itself when his game loaded the pack, and the Fallback line instead in these cases:
- He declined the pack, or its download failed.
- Another plugin sends a pack that replaces a shader Reticle's pack needs, see Beside other packs.
- He plays 1.21.10 or older.
Pack.Enabledisfalse.
He also gets the fallback when he has not answered the pack question 30 seconds after joining, until his pack loads. A HUD without Fallback shows him nothing in all these cases.
The fallback is one boss bar per HUD: the Fallback line above an empty white bar. Boss bars stack at the top of the screen, so the bars of other plugins move down while Reticle's are there. With Refresh, the fallback line updates as often as the HUD.
A HUD with a map gives such a player on 1.21.9 or newer a vanilla map in his empty off hand as well, see Players without the resource pack.
With Auto_Show: true, every player who has the HUD's Permission, or every player when it has none, sees it from the moment he joins. A player who gains or loses the permission sees the change within a second. With Auto_Show: false, the HUD shows only when /reticle hud show, the editor's Show in game or a plugin shows it, and it stays until it is hidden or the player leaves.
What to keep in mind
Minecraft draws a HUD into the world just in front of the player's eyes, so a few things of the game draw over it:
- His hand and what he holds. In a window of 1920 by 1080 a held sword covers up to 112 HUD pixels in from the right edge and 186 up from the bottom, a bow a little less and a map a little more to the left. The editor marks that corner as Hand, and the templates keep it free.
- Minecraft's own HUD: the hotbar, health and food, the action bar, boss bars, titles, chat and the scoreboard sidebar of other plugins. The editor draws where the first four appear.
- Overlays of the game: a carved pumpkin on his head, the spyglass, powder snow, the swirl of a nether portal, fire and the view under water.
- A Reticle menu in shader mode. The HUDs stay visible around it, at full brightness while the world behind the menu goes dark.
F1 hides Minecraft's own HUD but not Reticle's HUDs. A player who wants clean screenshots types /reticle hud off first and /reticle hud on afterwards.
At night and in caves Minecraft darkens the corners of the screen, and HUDs in the corners darken with them: at midnight a pixel in a corner keeps a quarter of its brightness, one at the middle of an edge a little under two thirds. Pack.Vignette: off in settings.yml removes that darkening for every player with the pack, and with it the red tint that warns of the world border. See Configuration.
A shader pack for Iris replaces the shaders of Reticle's pack, as it does for menus. Reticle cannot see whether a player uses one, so expect him to see no HUD and no fallback while his shader pack is on.
Commands
| Command | What it does | Permission |
|---|---|---|
/reticle hud off | Hides all of the player's HUDs. Reticle remembers it until he types /reticle hud on | reticle.command.hud |
/reticle hud on | Shows them again | reticle.command.hud |
/reticle hud scale <auto|1 to 8> | Sets the scale of his HUDs, see Where a HUD sits | reticle.command.hud |
/reticle hud show <hud> [player] | Shows a HUD, also one with Auto_Show: false | reticle.command.hud.show |
/reticle hud hide <hud> [player] | Hides a HUD. Reticle remembers it by its name across joins until the HUD is shown again, so a HUD you delete and make again under the same name stays hidden for him | reticle.command.hud.show |
/reticle hud toggle <hud> [player] | Shows the HUD when it is hidden and hides it when it shows | reticle.command.hud.show |
Every player has reticle.command.hud. With a player name, show, hide and toggle also need reticle.command.hud.others, and from the console the name is required. off, on and scale work for players only, each on his own HUDs. show still respects the HUD's Permission: a player without it does not see the HUD, and the answer says which permission he lacks. The answer also says when he cannot see the HUD yet, because his game has not loaded Reticle's pack, or not at all, because his game cannot draw HUDs and the HUD has no Fallback line.
Templates
Reticle ships four HUDs inside its jar. They stay out of your huds folder until you choose one. The first three sit at the left edge, which nothing of Minecraft covers for long, and stack 6 pixels apart when you use them together.
| Template | Where | What it shows |
|---|---|---|
stats | top left | The player's money, level and player kills, each beside an icon, read again every second. It needs PlaceholderAPI with the Vault, Player and Statistic expansions, and an economy plugin for the money |
quest | top left, under stats | A quest and its next step beside a book on an orange tile. Write your own lines in place of the example |
coordinates | top left, under quest | The block he stands on, his world and the number of players online, read again four times a second. It needs PlaceholderAPI with the Player and Server expansions |
minimap | top right, below the potion effect icons | A round map of 64 by 64 pixels at 2 pixels per block inside a thin ring with an N for north, the block he stands on in a line under it as wide as five digit coordinates, and his waypoints, the server's pins and the players and mobs near him |
In the editor, click New beside HUDs, choose a template, keep or change the name and click Create. Without the editor, open the Reticle jar as a zip file, copy hud-templates/stats.yml or another template into plugins/Reticle/huds/ and run /reticle reload.
When a HUD does not load
Reticle checks every HUD file when the server starts and on /reticle reload, as it checks menus. A file with a mistake stays out, the other HUDs load, and the console names the problem and the file. Besides the menu messages listed under When a menu does not load, HUDs have these:
| Message | Fix |
|---|---|
Missing 'Anchor' in HUD 'quest', one of top_left, top, top_right, left, center, right, bottom_left, bottom or bottom_right. | Add an Anchor |
Type 'button' in element 'buy' of HUD 'quest' cannot be used on a HUD: nothing on a HUD can be clicked. Available: panel, text, item, map. | Use a text or an item |
'Hover' in element 'note' of HUD 'quest' cannot be used on a HUD: nothing on a HUD can be clicked. Remove it. | Remove the key, as for Actions |
A HUD has no command: players turn HUDs off and on with /reticle hud. Remove 'Command' from HUD 'quest'. | Remove Command |
'Order' in HUD 'quest' must be a whole number from 0 to 7, got '9'. Where two HUDs overlap, the higher Order draws on top. | Use a number from 0 to 7 |
'Fallback' in HUD 'quest' is empty. Write the line players without the pack see, or remove the key to show them nothing. | Write the line, or remove the key |
The API lets plugins show and hide HUDs and build HUDs in code.
