Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/qualk/take-care/llms.txt

Use this file to discover all available pages before exploring further.

Meteor’s HUD system lets you overlay text, shapes, and graphics on the game screen. HUD elements appear in the Meteor HUD editor (accessed via the GUI screen) and can be repositioned and configured by the user. Each element extends meteordevelopment.meteorclient.systems.hud.HudElement, declares a public static final HudElementInfo descriptor field, and is registered with Hud.get().register() in TakeCare.onInitialize(). Take Care declares a shared HUD_GROUP constant in TakeCare.java that all elements in the addon should use.

Creating a HUD element

1

Create a class extending HudElement

Add a new Java class inside the hud/ package (kpn.qualk.takecare.hud). The class must extend meteordevelopment.meteorclient.systems.hud.HudElement:
hud/YourHudElement.java
package kpn.qualk.takecare.hud;

import kpn.qualk.takecare.TakeCare;
import meteordevelopment.meteorclient.systems.hud.HudElement;
import meteordevelopment.meteorclient.systems.hud.HudElementInfo;
import meteordevelopment.meteorclient.systems.hud.HudRenderer;

public class YourHudElement extends HudElement {
    public static final HudElementInfo<YourHudElement> INFO =
        new HudElementInfo<>(TakeCare.HUD_GROUP, "your-element",
            "A short description.", YourHudElement::new);

    public YourHudElement() {
        super(INFO);
    }

    @Override
    public void render(HudRenderer renderer) {
        // draw content here
    }
}
2

Define the static INFO field using TakeCare.HUD_GROUP

Every HUD element requires a public static final HudElementInfo<T> descriptor. The HudElementInfo constructor takes four arguments:
ArgumentValue
groupTakeCare.HUD_GROUP — the shared Take Care HUD group
nameA kebab-case string, e.g. "example"
descriptionA plain-text sentence shown in the HUD editor
factoryA method reference to the no-arg constructor, e.g. YourHudElement::new
TakeCare.HUD_GROUP is declared as public static final HudGroup HUD_GROUP = new HudGroup("Take Care") in TakeCare.java and acts as the shared group for all Take Care HUD elements.
The name parameter in HudElementInfo must be in kebab-case (e.g. "example", not "Example" or "example_element"). Meteor uses it as the element’s unique identifier in the HUD editor.
3

Call super(INFO) in the constructor

The constructor must call super(INFO) to pass the descriptor to the parent HudElement class. This registers the element’s name, description, and default size with the HUD system:
hud/YourHudElement.java
public YourHudElement() {
    super(INFO);
}
4

Override render() to draw content

Override render(HudRenderer renderer) to define what is drawn each frame. Use setSize(width, height) to tell the HUD editor the bounding box of your element so it can be selected and moved correctly.The HudRenderer provides these drawing primitives:
MethodDescription
renderer.text(text, x, y, color, shadow)Draws a string at (x, y)
renderer.textWidth(text, shadow)Returns the pixel width of a string
renderer.textHeight(shadow)Returns the pixel height of a line of text
renderer.quad(x, y, width, height, color)Draws a filled rectangle
The fields x and y (inherited from HudElement) always contain the current top-left position of the element on screen:
hud/HudExample.java
@Override
public void render(HudRenderer renderer) {
    setSize(renderer.textWidth("Example element", true), renderer.textHeight(true));
    renderer.quad(x, y, getWidth(), getHeight(), Color.LIGHT_GRAY);
    renderer.text("Example element", x, y, Color.WHITE, true);
}
5

Register the element in TakeCare.onInitialize()

Open TakeCare.java and call Hud.get().register(YourHudElement.INFO) inside onInitialize():
TakeCare.java
import meteordevelopment.meteorclient.systems.hud.Hud;

@Override
public void onInitialize() {
    LOG.info("Initialising Meteor addon: " + getPackage());

    Modules.get().add(new AssetProtection());
    Modules.get().add(new ParrotDeadener());

    Hud.get().register(YourHudElement.INFO);
}

Full working example

Below is the complete HudExample class from the Take Care source (shown uncommented and ready to use):
hud/HudExample.java
package kpn.qualk.takecare.hud;

import kpn.qualk.takecare.TakeCare;
import meteordevelopment.meteorclient.systems.hud.HudElement;
import meteordevelopment.meteorclient.systems.hud.HudElementInfo;
import meteordevelopment.meteorclient.systems.hud.HudRenderer;
import meteordevelopment.meteorclient.utils.render.color.Color;

public class HudExample extends HudElement {
    public static final HudElementInfo<HudExample> INFO =
        new HudElementInfo<>(TakeCare.HUD_GROUP, "example",
            "HUD element example.", HudExample::new);

    public HudExample() {
        super(INFO);
    }

    @Override
    public void render(HudRenderer renderer) {
        setSize(renderer.textWidth("Example element", true), renderer.textHeight(true));
        renderer.quad(x, y, getWidth(), getHeight(), Color.LIGHT_GRAY);
        renderer.text("Example element", x, y, Color.WHITE, true);
    }
}

Build docs developers (and LLMs) love