From c0318e4bf5f03af749ca1b8cc62f4b51d2a3cdbe Mon Sep 17 00:00:00 2001 From: AndrexYT Date: Tue, 27 Aug 2024 22:33:20 +0200 Subject: [PATCH] Update --- gradle.properties | 9 +-- .../java/com/example/addon/AddonTemplate.java | 49 -------------- .../addon/commands/CommandExample.java | 34 ---------- .../com/example/addon/hud/HudExample.java | 29 -------- .../com/example/addon/mixin/ExampleMixin.java | 31 --------- .../example/addon/modules/ModuleExample.java | 66 ------------------- src/main/resources/addon-template.mixins.json | 6 +- src/main/resources/fabric.mod.json | 12 ++-- 8 files changed, 13 insertions(+), 223 deletions(-) delete mode 100644 src/main/java/com/example/addon/AddonTemplate.java delete mode 100644 src/main/java/com/example/addon/commands/CommandExample.java delete mode 100644 src/main/java/com/example/addon/hud/HudExample.java delete mode 100644 src/main/java/com/example/addon/mixin/ExampleMixin.java delete mode 100644 src/main/java/com/example/addon/modules/ModuleExample.java diff --git a/gradle.properties b/gradle.properties index 7728107..f2d4488 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,16 +1,17 @@ org.gradle.jvmargs=-Xmx2G # Fabric Properties (https://fabricmc.net/develop) -minecraft_version=1.21 -yarn_mappings=1.21+build.8 +minecraft_version=1.20.4 +yarn_mappings=1.20.4+build.3 loader_version=0.15.11 # Mod Properties mod_version=0.1.0 -maven_group=com.example -archives_base_name=addon-template +maven_group=com.AndrexYT.AutoAdvertiser +archives_base_name=AutoAdvertiser # Dependencies # Meteor (https://maven.meteordev.org) meteor_version=0.5.8-SNAPSHOT + diff --git a/src/main/java/com/example/addon/AddonTemplate.java b/src/main/java/com/example/addon/AddonTemplate.java deleted file mode 100644 index 3bd07af..0000000 --- a/src/main/java/com/example/addon/AddonTemplate.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.example.addon; - -import com.example.addon.commands.CommandExample; -import com.example.addon.hud.HudExample; -import com.example.addon.modules.ModuleExample; -import com.mojang.logging.LogUtils; -import meteordevelopment.meteorclient.addons.GithubRepo; -import meteordevelopment.meteorclient.addons.MeteorAddon; -import meteordevelopment.meteorclient.commands.Commands; -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; - -public class AddonTemplate extends MeteorAddon { - public static final Logger LOG = LogUtils.getLogger(); - public static final Category CATEGORY = new Category("Example"); - public static final HudGroup HUD_GROUP = new HudGroup("Example"); - - @Override - public void onInitialize() { - LOG.info("Initializing Meteor Addon Template"); - - // Modules - Modules.get().add(new ModuleExample()); - - // Commands - Commands.add(new CommandExample()); - - // HUD - Hud.get().register(HudExample.INFO); - } - - @Override - public void onRegisterCategories() { - Modules.registerCategory(CATEGORY); - } - - @Override - public String getPackage() { - return "com.example.addon"; - } - - @Override - public GithubRepo getRepo() { - return new GithubRepo("MeteorDevelopment", "meteor-addon-template"); - } -} diff --git a/src/main/java/com/example/addon/commands/CommandExample.java b/src/main/java/com/example/addon/commands/CommandExample.java deleted file mode 100644 index 06ec3ae..0000000 --- a/src/main/java/com/example/addon/commands/CommandExample.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.example.addon.commands; - -import com.mojang.brigadier.arguments.StringArgumentType; -import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.commands.Command; -import net.minecraft.command.CommandSource; - -import static com.mojang.brigadier.Command.SINGLE_SUCCESS; - -/** - * The Meteor Client command API uses the same command system as Minecraft does. - */ -public class CommandExample extends Command { - /** - * The {@code name} parameter should be in kebab-case. - */ - public CommandExample() { - super("example", "Sends a message."); - } - - @Override - public void build(LiteralArgumentBuilder builder) { - builder.executes(context -> { - info("hi"); - return SINGLE_SUCCESS; - }); - - builder.then(literal("name").then(argument("nameArgument", StringArgumentType.word()).executes(context -> { - String argument = StringArgumentType.getString(context, "nameArgument"); - info("hi, " + argument); - return SINGLE_SUCCESS; - }))); - } -} diff --git a/src/main/java/com/example/addon/hud/HudExample.java b/src/main/java/com/example/addon/hud/HudExample.java deleted file mode 100644 index bdf5928..0000000 --- a/src/main/java/com/example/addon/hud/HudExample.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.example.addon.hud; - -import com.example.addon.AddonTemplate; -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 { - /** - * The {@code name} parameter should be in kebab-case. - */ - public static final HudElementInfo INFO = new HudElementInfo<>(AddonTemplate.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)); - - // Render background - renderer.quad(x, y, getWidth(), getHeight(), Color.LIGHT_GRAY); - - // Render text - renderer.text("Example element", x, y, Color.WHITE, true); - } -} diff --git a/src/main/java/com/example/addon/mixin/ExampleMixin.java b/src/main/java/com/example/addon/mixin/ExampleMixin.java deleted file mode 100644 index a5556c2..0000000 --- a/src/main/java/com/example/addon/mixin/ExampleMixin.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.example.addon.mixin; - -import com.example.addon.AddonTemplate; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.RunArgs; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -/** - * Example Mixin class. - * For more resources, visit: - * - */ -@Mixin(MinecraftClient.class) -public abstract class ExampleMixin { - /** - * Example Mixin injection targeting the {@code } method (the constructor) at {@code TAIL} (end of method). - */ - @Inject(method = "", at = @At("TAIL")) - private void onGameLoaded(RunArgs args, CallbackInfo ci) { - AddonTemplate.LOG.info("Hello from ExampleMixin!"); - } -} diff --git a/src/main/java/com/example/addon/modules/ModuleExample.java b/src/main/java/com/example/addon/modules/ModuleExample.java deleted file mode 100644 index 10a4bb6..0000000 --- a/src/main/java/com/example/addon/modules/ModuleExample.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.example.addon.modules; - -import com.example.addon.AddonTemplate; -import meteordevelopment.meteorclient.events.render.Render3DEvent; -import meteordevelopment.meteorclient.renderer.ShapeMode; -import meteordevelopment.meteorclient.settings.ColorSetting; -import meteordevelopment.meteorclient.settings.DoubleSetting; -import meteordevelopment.meteorclient.settings.Setting; -import meteordevelopment.meteorclient.settings.SettingGroup; -import meteordevelopment.meteorclient.systems.modules.Module; -import meteordevelopment.meteorclient.utils.render.color.Color; -import meteordevelopment.meteorclient.utils.render.color.SettingColor; -import meteordevelopment.orbit.EventHandler; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; - -public class ModuleExample extends Module { - private final SettingGroup sgGeneral = this.settings.getDefaultGroup(); - private final SettingGroup sgRender = this.settings.createGroup("Render"); - - /** - * Example setting. - * The {@code name} parameter should be in kebab-case. - * If you want to access the setting from another class, simply make the setting {@code public}, and use - * {@link meteordevelopment.meteorclient.systems.modules.Modules#get(Class)} to access the {@link Module} object. - */ - private final Setting scale = sgGeneral.add(new DoubleSetting.Builder() - .name("scale") - .description("The size of the marker.") - .defaultValue(2.0d) - .range(0.5d, 10.0d) - .build() - ); - - private final Setting color = sgRender.add(new ColorSetting.Builder() - .name("color") - .description("The color of the marker.") - .defaultValue(Color.MAGENTA) - .build() - ); - - /** - * The {@code name} parameter should be in kebab-case. - */ - public ModuleExample() { - super(AddonTemplate.CATEGORY, "world-origin", "An example module that highlights the center of the world."); - } - - /** - * Example event handling method. - * Requires {@link AddonTemplate#getPackage()} to be setup correctly, will fail silently otherwise. - */ - @EventHandler - private void onRender3d(Render3DEvent event) { - // Create & stretch the marker object - Box marker = new Box(BlockPos.ORIGIN); - marker.stretch( - scale.get() * marker.getLengthX(), - scale.get() * marker.getLengthY(), - scale.get() * marker.getLengthZ() - ); - - // Render the marker based on the color setting - event.renderer.box(marker, color.get(), color.get(), ShapeMode.Both, 0); - } -} diff --git a/src/main/resources/addon-template.mixins.json b/src/main/resources/addon-template.mixins.json index 39d1c99..99e0722 100644 --- a/src/main/resources/addon-template.mixins.json +++ b/src/main/resources/addon-template.mixins.json @@ -1,10 +1,8 @@ { "required": true, - "package": "com.example.addon.mixin", + "package": "com.AndrexYT.AutoAdvertiser.addon.mixin", "compatibilityLevel": "JAVA_21", - "client": [ - "ExampleMixin" - ], + "client": [], "injectors": { "defaultRequire": 1 } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index bb8c721..4410de6 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,20 +1,20 @@ { "schemaVersion": 1, - "id": "addon-template", + "id": "autoadvertiser", "version": "${version}", - "name": "Addon Template", - "description": "An addon template for Meteor Client addons.", + "name": "Auto Advertiser", + "description": "Advertise your stuff on servers.", "authors": [ - "seasnail" + "AndrexYT" ], "contact": { - "repo": "https://github.com/MeteorDevelopment/meteor-addon-template" + "repo": "https://github.com/AndrexYT/AutoAdvertiser" }, "icon": "assets/template/icon.png", "environment": "client", "entrypoints": { "meteor": [ - "com.example.addon.AddonTemplate" + "com.AndrexYT.AutoAdvertiser.addon.AddonTemplate" ] }, "mixins": [