HUD Basics
Learn about the HUD system OneConfig has to offer
What are HUDs?
Creating a HUD
public class MyHud extends SingleTextHud {
// you can use this to add additional saved config values to your HUD class,
// just like a normal config.
int times = 0;
@Switch(
name = "Custom Option"
)
public boolean yes;
public MyHud() {
// this is the name of the HUD as shown in the config,
// and if it is enabled by default
super("Time", true);
}
// this method is called every ingame tick. It is used to update the text shown
// on the hud. If you need to update this every render tick, you can override
// getTextFrequent() instead (not recommended)
@Override
public String getText(boolean example) {
// example determines whether or not the HUD is in 'example' mode, which
// means the user has the Edit HUD screen open. This should ideally be static
// so that it does not change while the user is moving around their huds,
// and should give an accurate representation of how the hud will look ingame.
if(example) return "I'm in Example mode";
times++;
return String.valueOf(times);
}
}Using a HUD
Last updated
Was this helpful?