Skip to content

Overlay

DJ edited this page Jul 17, 2025 · 12 revisions

Overlay "API"

The link.getOverlay() will give you a table full of the functions listed down below.

All "Keys" are for updating the element later so you dont need to clear the element every time.

Do note that the x and y aren't exactly related to your resolution, so x=1920 y=1080 will not put it in the corner, it will put it like much much further outside of the screen. It does change depending on your resolution though.

For text, the max is

3440x1440 - 852x352

1920x1080 - 472x262

For Rectangle:

3440x1440 - 860x360

1920x1080 - 480x270

For Item:

3440x1440 - 844x344

1920x1080 - 464x254

these are all for fullscreen.

this WILL be different for yours if you have a different resolution.

NOTE: After the v4 update, im not sure if the resolutions are still correct, since i rewrote the entire system.

addOrUpdateTextElement(String key, String newText, int newX, int newY, int newColor, float scale)

Adds text on the screen, you can also scale it.

ex: addOrUpdateTextElement("simpletext","hello!",1,1,0xFF0000,1)

removeTextElement(String key)

Removes the text element related to the key.

addOrUpdateRightboundTextElement(String key, String newText, int newX, int newY, int newColor, float scale)

Same as the normal text, just rightbound. Adds a rightbound text on the screen, you can also scale it.

ex: addOrUpdateTextElement("simplerighttext","hello! but right",1,1,0x00FF00,1)

removeRightboundTextElement(String key)

This will remove the rightbound text element related to the key.

addOrUpdateRectElement(String key, int x1, int y1, int x2, int y2, int color, int transparency)

Adds a rectangle element, transparency is 0 to 100, above 10 its hard to see a difference but its there.

ex: addOrUpdateRectElement("testsquare",1,1,50,50,0xFFFFFF,1)

removeRightboundTextElement(String key)

Removes a rectangle element related to the key.

addOrUpdateItemElement(String key, String itemId, int x, int y)

Adds a item display to your screen.

ex: addOrUpdateItemElement("dirt","minecraft:dirt",1,1)

removeItemElement(String key)

Removes a item element related to the key.

clearText()

Clears all text elements.

clearRightboundText()

Clears all rightbound text elements.

clearRect()

Clears all rectangle elements.

clearItem()

Clears all item elements

clearAll()

Clears every element, canvas reset.

send()

Sends the packet to update your hud, this is needed everytime you want to update your hud.

I will update the wiki if some of the examples aren't correct.