Updated to new HUD

This commit is contained in:
MineGame159 2022-07-06 17:07:12 +02:00
parent 705cea4048
commit 79d5ce169e
2 changed files with 17 additions and 8 deletions

View File

@ -7,7 +7,8 @@ import dummy.addon.template.modules.hud.HudExample;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.addons.MeteorAddon;
import meteordevelopment.meteorclient.systems.commands.Commands;
import meteordevelopment.meteorclient.systems.hud.HUD;
import meteordevelopment.meteorclient.systems.hud.Hud;
import meteordevelopment.meteorclient.systems.hud.HudGroup;
import meteordevelopment.meteorclient.systems.modules.Category;
import meteordevelopment.meteorclient.systems.modules.Modules;
import org.slf4j.Logger;
@ -18,6 +19,7 @@ import java.lang.invoke.MethodHandles;
public class TemplateAddon extends MeteorAddon {
public static final Logger LOG = LoggerFactory.getLogger(TemplateAddon.class);
public static final Category CATEGORY = new Category("Example");
public static final HudGroup HUD_GROUP = new HudGroup("Template");
@Override
public void onInitialize() {
@ -34,7 +36,7 @@ public class TemplateAddon extends MeteorAddon {
Commands.get().add(new ExampleCommand());
// HUD
HUD.get().elements.add(new HudExample());
Hud.get().register(HudExample.INFO);
}
@Override

View File

@ -1,15 +1,22 @@
package dummy.addon.template.modules.hud;
import meteordevelopment.meteorclient.systems.hud.HUD;
import meteordevelopment.meteorclient.systems.hud.modules.DoubleTextHudElement;
import dummy.addon.template.TemplateAddon;
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<>(TemplateAddon.HUD_GROUP, "example", "HUD element example.", HudExample::new);
public class HudExample extends DoubleTextHudElement {
public HudExample() {
super(HUD.get(), "hud-example", "Description", "Static left text: ", false);
super(INFO);
}
@Override
protected String getRight() {
return "Dynamic right text";
public void render(HudRenderer renderer) {
setSize(renderer.textWidth("Example element", true), renderer.textHeight(true));
renderer.text("Example element", x, y, Color.WHITE, true);
}
}