Custom HUD
Package: com.hypixel.hytale.server.core.entity.entities.player.hud
Custom HUD overlays let you add persistent on-screen UI that stays visible while playing — scores, timers, minimaps, or any server-driven display.
Creating a Custom HUD
Section titled “Creating a Custom HUD”Extend CustomUIHud and implement build():
public class ScoreHud extends CustomUIHud {
private int score = 0;
public ScoreHud(PlayerRef playerRef) { super(playerRef); }
@Override public void build(UICommandBuilder cmd) { cmd.append("Hud/Score.ui"); cmd.set("#Score.Text", String.valueOf(this.score)); }
public void setScore(int score) { this.score = score;
UICommandBuilder cmd = new UICommandBuilder(); cmd.set("#Score.Text", String.valueOf(this.score)); this.update(false, cmd); }}Showing
Section titled “Showing”Player player = store.getComponent(ref, Player.getComponentType());PlayerRef playerRef = store.getComponent(ref, PlayerRef.getComponentType());HudManager hud = player.getHudManager();
ScoreHud scoreHud = new ScoreHud(playerRef);hud.setCustomHud(playerRef, scoreHud);Updating
Section titled “Updating”// incremental update (only changes specified fields)UICommandBuilder cmd = new UICommandBuilder();cmd.set("#Timer.Text", "2:30");scoreHud.update(false, cmd);
// full rebuild (clears and re-runs build())scoreHud.show();Removing
Section titled “Removing”hud.setCustomHud(playerRef, null);
// or reset everything (HUD components + custom HUD)hud.resetHud(playerRef);UICommandBuilder Operations
Section titled “UICommandBuilder Operations”The UICommandBuilder sends UI manipulation commands to the client:
| Method | Description |
|---|---|
append(documentPath) | Add a UI document as a child of root |
append(selector, documentPath) | Add a UI document as a child of selector |
appendInline(selector, document) | Add inline UI markup as a child |
insertBefore(selector, documentPath) | Insert a UI document before an element |
insertBeforeInline(selector, document) | Insert inline UI markup before an element |
remove(selector) | Remove an element |
clear(selector) | Clear an element’s children |
set(selector, value) | Set data on an element (String, int, float, boolean, Message) |
See Markup and Styling for building .ui files.
Packets
Section titled “Packets”See CustomHud for the wire format.