API reference Obsidian.API.Client.Screens
ModOverlay class
Widgets a mod draws on the HUD, like a NeoForge mod's GUI layer: a box of ModOverlay.Width by ModOverlay.Height pixels placed at its ModOverlay.Anchor, moved by ModOverlay.X and ModOverlay.Y, with the widgets the mod adds, placed from the box's top left. Register it with IClientRegistry.RegisterOverlay.
public abstract class ModOverlay : WidgetGroup
In Obsidian.API.Client.
Remarks
Overlays only show: they draw Labels, Images, ProgressBars and ItemGrids (without clicks or tooltips), and leave out widgets that take input. They're drawn with the rest of the HUD while the player is in a world: under screens, like vanilla's HUD, and not while the player hides the HUD (F1).
The client calls ModOverlay.Tick on the game's thread, inside a call into the mod; if it throws, it's logged and the overlay is removed. Widgets are drawn as they are each frame, so the overlay changes them whenever it likes, typically in ModOverlay.Tick. When the mod unloads, its overlays go.
Constructors
protected ModOverlay();Properties
Anchor
public OverlayAnchor Anchor { get; set; }The point of the screen the overlay is placed at, which is the same point of its box: a corner, the middle of an edge, or the centre.
Height
public int Height { get; set; }The box's height, in the GUI's pixels, which placing it by its bottom edge or middle takes into account.
Layer
public OverlayLayer Layer { get; set; }Which of vanilla's HUD the overlay is drawn over. Overlays in the same layer are drawn in the order they were registered.
Width
public int Width { get; set; }The box's width, in the GUI's pixels, which placing it by its right edge or middle takes into account.
X
public int X { get; set; }How far the box is moved right from its anchor, in the GUI's pixels; negative moves it left.
Y
public int Y { get; set; }How far the box is moved down from its anchor, in the GUI's pixels; negative moves it up.
Methods
Tick()
protected internal virtual void Tick();Runs every client tick, 20 times a second, while the player is in a world, like vanilla's HUD's tick: update the widgets from what changed, like the client's world (see IClientConnection.World).