diff --git a/src/main/java/meteordevelopment/addons/template/TemplateAddon.java b/src/main/java/meteordevelopment/addons/template/TemplateAddon.java index fd7c982..f62bf2b 100644 --- a/src/main/java/meteordevelopment/addons/template/TemplateAddon.java +++ b/src/main/java/meteordevelopment/addons/template/TemplateAddon.java @@ -1,14 +1,18 @@ package meteordevelopment.addons.template; -import meteordevelopment.addons.template.commands.ExampleCommand; -import meteordevelopment.addons.template.modules.AnotherExample; -import meteordevelopment.addons.template.modules.Example; +import meteordevelopment.addons.template.commands.*; +import meteordevelopment.addons.template.modules.*; +import meteordevelopment.addons.template.modules.hud.*; import meteordevelopment.meteorclient.MeteorAddon; +import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.systems.commands.Commands; import meteordevelopment.meteorclient.systems.modules.Category; import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.render.hud.HUD; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import java.lang.invoke.MethodHandles; public class TemplateAddon extends MeteorAddon { public static final Logger LOG = LogManager.getLogger(); @@ -18,16 +22,23 @@ public class TemplateAddon extends MeteorAddon { public void onInitialize() { LOG.info("Initializing Meteor Addon Template"); + // Required when using @EventHandler + MeteorClient.EVENT_BUS.registerLambdaFactory("meteordevelopment.addons.template", (lookupInMethod, klass) -> (MethodHandles.Lookup) lookupInMethod.invoke(null, klass, MethodHandles.lookup())); + // Modules Modules.get().add(new Example()); Modules.get().add(new AnotherExample()); // Commands Commands.get().add(new ExampleCommand()); + + // HUD + HUD hud = Modules.get().get(HUD.class); + hud.elements.add(new HudExample(hud)); } @Override public void onRegisterCategories() { Modules.registerCategory(CATEGORY); } -} \ No newline at end of file +} diff --git a/src/main/java/meteordevelopment/addons/template/modules/hud/HudExample.java b/src/main/java/meteordevelopment/addons/template/modules/hud/HudExample.java new file mode 100644 index 0000000..e0f95b7 --- /dev/null +++ b/src/main/java/meteordevelopment/addons/template/modules/hud/HudExample.java @@ -0,0 +1,15 @@ +package meteordevelopment.addons.template.modules.hud; + +import meteordevelopment.meteorclient.systems.modules.render.hud.HUD; +import meteordevelopment.meteorclient.systems.modules.render.hud.modules.DoubleTextHudElement; + +public class HudExample extends DoubleTextHudElement { + public HudExample(HUD hud) { + super(hud, "hud-example", "Description", "Static left text: ", false); + } + + @Override + protected String getRight() { + return "Dynamic right text"; + } +}