Improvements (#2)

This commit is contained in:
Cloudburst 2021-06-16 16:32:43 +02:00 committed by GitHub
parent c99482c9e6
commit 4448cc21b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 4 deletions

View File

@ -1,14 +1,18 @@
package meteordevelopment.addons.template; package meteordevelopment.addons.template;
import meteordevelopment.addons.template.commands.ExampleCommand; import meteordevelopment.addons.template.commands.*;
import meteordevelopment.addons.template.modules.AnotherExample; import meteordevelopment.addons.template.modules.*;
import meteordevelopment.addons.template.modules.Example; import meteordevelopment.addons.template.modules.hud.*;
import meteordevelopment.meteorclient.MeteorAddon; import meteordevelopment.meteorclient.MeteorAddon;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.systems.commands.Commands; import meteordevelopment.meteorclient.systems.commands.Commands;
import meteordevelopment.meteorclient.systems.modules.Category; import meteordevelopment.meteorclient.systems.modules.Category;
import meteordevelopment.meteorclient.systems.modules.Modules; 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.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import java.lang.invoke.MethodHandles;
public class TemplateAddon extends MeteorAddon { public class TemplateAddon extends MeteorAddon {
public static final Logger LOG = LogManager.getLogger(); public static final Logger LOG = LogManager.getLogger();
@ -18,12 +22,19 @@ public class TemplateAddon extends MeteorAddon {
public void onInitialize() { public void onInitialize() {
LOG.info("Initializing Meteor Addon Template"); 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
Modules.get().add(new Example()); Modules.get().add(new Example());
Modules.get().add(new AnotherExample()); Modules.get().add(new AnotherExample());
// Commands // Commands
Commands.get().add(new ExampleCommand()); Commands.get().add(new ExampleCommand());
// HUD
HUD hud = Modules.get().get(HUD.class);
hud.elements.add(new HudExample(hud));
} }
@Override @Override

View File

@ -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";
}
}