diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/Command.java b/src/main/java/meteordevelopment/meteorclient/commands/Command.java similarity index 90% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/Command.java rename to src/main/java/meteordevelopment/meteorclient/commands/Command.java index 973f001c74..72b7e4b971 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/Command.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/Command.java @@ -3,7 +3,7 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands; +package meteordevelopment.meteorclient.commands; import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.ArgumentType; @@ -12,8 +12,10 @@ import meteordevelopment.meteorclient.systems.config.Config; import meteordevelopment.meteorclient.utils.Utils; import meteordevelopment.meteorclient.utils.player.ChatUtils; -import net.minecraft.client.MinecraftClient; +import net.minecraft.command.CommandRegistryAccess; import net.minecraft.command.CommandSource; +import net.minecraft.registry.BuiltinRegistries; +import net.minecraft.server.command.CommandManager; import net.minecraft.text.Text; import java.util.ArrayList; @@ -21,7 +23,7 @@ import java.util.List; public abstract class Command { - protected static MinecraftClient mc; + protected static final CommandRegistryAccess REGISTRY_ACCESS = CommandManager.createRegistryAccess(BuiltinRegistries.createWrapperLookup()); private final String name; private final String title; @@ -33,7 +35,6 @@ public Command(String name, String description, String... aliases) { this.title = Utils.nameToTitle(name); this.description = description; Collections.addAll(this.aliases, aliases); - mc = MinecraftClient.getInstance(); } // Helper methods to painlessly infer the CommandSource generic type argument diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java b/src/main/java/meteordevelopment/meteorclient/commands/Commands.java similarity index 65% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java rename to src/main/java/meteordevelopment/meteorclient/commands/Commands.java index da885ad7dd..b118ff47aa 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/Commands.java @@ -3,19 +3,15 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands; +package meteordevelopment.meteorclient.commands; import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.ParseResults; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import meteordevelopment.meteorclient.systems.System; -import meteordevelopment.meteorclient.systems.Systems; -import meteordevelopment.meteorclient.systems.commands.commands.*; +import meteordevelopment.meteorclient.commands.commands.*; +import meteordevelopment.meteorclient.utils.PostInit; import net.minecraft.client.network.ClientCommandSource; -import net.minecraft.command.CommandRegistryAccess; import net.minecraft.command.CommandSource; -import net.minecraft.registry.BuiltinRegistries; -import net.minecraft.server.command.CommandManager; import java.util.ArrayList; import java.util.Comparator; @@ -23,24 +19,14 @@ import static meteordevelopment.meteorclient.MeteorClient.mc; -public class Commands extends System { - public static final CommandRegistryAccess REGISTRY_ACCESS = CommandManager.createRegistryAccess(BuiltinRegistries.createWrapperLookup()); - +public class Commands { public static final CommandDispatcher DISPATCHER = new CommandDispatcher<>(); public static final CommandSource COMMAND_SOURCE = new ClientCommandSource(null, mc); - private final List commands = new ArrayList<>(); - - public Commands() { - super(null); - } - - public static Commands get() { - return Systems.get(Commands.class); - } + private static final List COMMANDS = new ArrayList<>(); - @Override - public void init() { + @PostInit + public static void init() { add(new VClipCommand()); add(new HClipCommand()); add(new DismountCommand()); @@ -78,26 +64,26 @@ public void init() { add(new WaypointCommand()); add(new InputCommand()); - commands.sort(Comparator.comparing(Command::getName)); + COMMANDS.sort(Comparator.comparing(Command::getName)); } - public void add(Command command) { - commands.removeIf(existing -> existing.getName().equals(command.getName())); + public static void add(Command command) { + COMMANDS.removeIf(existing -> existing.getName().equals(command.getName())); command.registerTo(DISPATCHER); - commands.add(command); + COMMANDS.add(command); } - public void dispatch(String message) throws CommandSyntaxException { + public static void dispatch(String message) throws CommandSyntaxException { ParseResults results = DISPATCHER.parse(message, COMMAND_SOURCE); DISPATCHER.execute(results); } - public List getAll() { - return commands; + public static List getAll() { + return COMMANDS; } - public Command get(String name) { - for (Command command : commands) { + public static Command get(String name) { + for (Command command : COMMANDS) { if (command.getName().equals(name)) { return command; } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/CompoundNbtTagArgumentType.java b/src/main/java/meteordevelopment/meteorclient/commands/arguments/CompoundNbtTagArgumentType.java similarity index 96% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/CompoundNbtTagArgumentType.java rename to src/main/java/meteordevelopment/meteorclient/commands/arguments/CompoundNbtTagArgumentType.java index a0e0f58b9d..b31e69d7ae 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/CompoundNbtTagArgumentType.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/arguments/CompoundNbtTagArgumentType.java @@ -3,7 +3,7 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.arguments; +package meteordevelopment.meteorclient.commands.arguments; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.arguments.ArgumentType; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/DirectionArgumentType.java b/src/main/java/meteordevelopment/meteorclient/commands/arguments/DirectionArgumentType.java similarity index 88% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/DirectionArgumentType.java rename to src/main/java/meteordevelopment/meteorclient/commands/arguments/DirectionArgumentType.java index 80cdccf56e..8cb2cb1932 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/DirectionArgumentType.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/arguments/DirectionArgumentType.java @@ -3,7 +3,7 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.arguments; +package meteordevelopment.meteorclient.commands.arguments; import net.minecraft.command.argument.EnumArgumentType; import net.minecraft.util.math.Direction; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/FakePlayerArgumentType.java b/src/main/java/meteordevelopment/meteorclient/commands/arguments/FakePlayerArgumentType.java similarity index 87% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/FakePlayerArgumentType.java rename to src/main/java/meteordevelopment/meteorclient/commands/arguments/FakePlayerArgumentType.java index 97cbc85a3d..fde62bb80d 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/FakePlayerArgumentType.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/arguments/FakePlayerArgumentType.java @@ -1,4 +1,9 @@ -package meteordevelopment.meteorclient.systems.commands.arguments; +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.commands.arguments; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.arguments.ArgumentType; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/FriendArgumentType.java b/src/main/java/meteordevelopment/meteorclient/commands/arguments/FriendArgumentType.java similarity index 87% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/FriendArgumentType.java rename to src/main/java/meteordevelopment/meteorclient/commands/arguments/FriendArgumentType.java index 62052f6cc8..c306fdd51c 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/FriendArgumentType.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/arguments/FriendArgumentType.java @@ -1,4 +1,9 @@ -package meteordevelopment.meteorclient.systems.commands.arguments; +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.commands.arguments; import com.google.common.collect.Streams; import com.mojang.brigadier.StringReader; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/MacroArgumentType.java b/src/main/java/meteordevelopment/meteorclient/commands/arguments/MacroArgumentType.java similarity index 96% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/MacroArgumentType.java rename to src/main/java/meteordevelopment/meteorclient/commands/arguments/MacroArgumentType.java index d56bafb96a..9307451c6b 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/MacroArgumentType.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/arguments/MacroArgumentType.java @@ -3,7 +3,7 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.arguments; +package meteordevelopment.meteorclient.commands.arguments; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.arguments.ArgumentType; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/ModuleArgumentType.java b/src/main/java/meteordevelopment/meteorclient/commands/arguments/ModuleArgumentType.java similarity index 96% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/ModuleArgumentType.java rename to src/main/java/meteordevelopment/meteorclient/commands/arguments/ModuleArgumentType.java index bb3be33a2f..5c24f6c79b 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/ModuleArgumentType.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/arguments/ModuleArgumentType.java @@ -3,7 +3,7 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.arguments; +package meteordevelopment.meteorclient.commands.arguments; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.arguments.ArgumentType; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/NotebotSongArgumentType.java b/src/main/java/meteordevelopment/meteorclient/commands/arguments/NotebotSongArgumentType.java similarity index 96% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/NotebotSongArgumentType.java rename to src/main/java/meteordevelopment/meteorclient/commands/arguments/NotebotSongArgumentType.java index e0582073f2..a746f98de1 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/NotebotSongArgumentType.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/arguments/NotebotSongArgumentType.java @@ -3,7 +3,7 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.arguments; +package meteordevelopment.meteorclient.commands.arguments; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.arguments.ArgumentType; @@ -21,12 +21,10 @@ import java.util.concurrent.CompletableFuture; public class NotebotSongArgumentType implements ArgumentType { - public static NotebotSongArgumentType create() { return new NotebotSongArgumentType(); } - @Override public Path parse(StringReader reader) throws CommandSyntaxException { final String text = reader.getRemaining(); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/PlayerArgumentType.java b/src/main/java/meteordevelopment/meteorclient/commands/arguments/PlayerArgumentType.java similarity index 97% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/PlayerArgumentType.java rename to src/main/java/meteordevelopment/meteorclient/commands/arguments/PlayerArgumentType.java index 95ad38722e..b9ebc0b1e6 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/PlayerArgumentType.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/arguments/PlayerArgumentType.java @@ -3,7 +3,7 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.arguments; +package meteordevelopment.meteorclient.commands.arguments; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.arguments.ArgumentType; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/PlayerListEntryArgumentType.java b/src/main/java/meteordevelopment/meteorclient/commands/arguments/PlayerListEntryArgumentType.java similarity index 97% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/PlayerListEntryArgumentType.java rename to src/main/java/meteordevelopment/meteorclient/commands/arguments/PlayerListEntryArgumentType.java index 35a6c97d52..9bf46dee7c 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/PlayerListEntryArgumentType.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/arguments/PlayerListEntryArgumentType.java @@ -3,7 +3,7 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.arguments; +package meteordevelopment.meteorclient.commands.arguments; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.arguments.ArgumentType; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/ProfileArgumentType.java b/src/main/java/meteordevelopment/meteorclient/commands/arguments/ProfileArgumentType.java similarity index 96% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/ProfileArgumentType.java rename to src/main/java/meteordevelopment/meteorclient/commands/arguments/ProfileArgumentType.java index 20eb796bd2..6c996e42f5 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/ProfileArgumentType.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/arguments/ProfileArgumentType.java @@ -3,7 +3,7 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.arguments; +package meteordevelopment.meteorclient.commands.arguments; import com.google.common.collect.Streams; import com.mojang.brigadier.StringReader; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/SettingArgumentType.java b/src/main/java/meteordevelopment/meteorclient/commands/arguments/SettingArgumentType.java similarity index 96% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/SettingArgumentType.java rename to src/main/java/meteordevelopment/meteorclient/commands/arguments/SettingArgumentType.java index 8d09d5cc4d..0d3cc90204 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/SettingArgumentType.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/arguments/SettingArgumentType.java @@ -3,7 +3,7 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.arguments; +package meteordevelopment.meteorclient.commands.arguments; import com.google.common.collect.Streams; import com.mojang.brigadier.StringReader; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/SettingValueArgumentType.java b/src/main/java/meteordevelopment/meteorclient/commands/arguments/SettingValueArgumentType.java similarity index 96% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/SettingValueArgumentType.java rename to src/main/java/meteordevelopment/meteorclient/commands/arguments/SettingValueArgumentType.java index 58347ace59..a37297f637 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/SettingValueArgumentType.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/arguments/SettingValueArgumentType.java @@ -3,7 +3,7 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.arguments; +package meteordevelopment.meteorclient.commands.arguments; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.arguments.ArgumentType; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/WaypointArgumentType.java b/src/main/java/meteordevelopment/meteorclient/commands/arguments/WaypointArgumentType.java similarity index 96% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/WaypointArgumentType.java rename to src/main/java/meteordevelopment/meteorclient/commands/arguments/WaypointArgumentType.java index bd02b52700..d3dd5abd17 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/WaypointArgumentType.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/arguments/WaypointArgumentType.java @@ -3,7 +3,7 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.arguments; +package meteordevelopment.meteorclient.commands.arguments; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.arguments.ArgumentType; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/BindCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/BindCommand.java similarity index 82% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/BindCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/BindCommand.java index ce969333c0..9811963067 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/BindCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/BindCommand.java @@ -3,11 +3,11 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.arguments.ModuleArgumentType; +import meteordevelopment.meteorclient.commands.Command; +import meteordevelopment.meteorclient.commands.arguments.ModuleArgumentType; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.systems.modules.Modules; import net.minecraft.command.CommandSource; @@ -24,7 +24,6 @@ public void build(LiteralArgumentBuilder builder) { builder.then(argument("module", ModuleArgumentType.create()).executes(context -> { Module module = context.getArgument("module", Module.class); Modules.get().setModuleToBind(module); - module.info("Press a key to bind the module to."); return SINGLE_SUCCESS; })); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/BindsCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/BindsCommand.java similarity index 89% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/BindsCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/BindsCommand.java index 8e7b8c6dcb..fa4ee582b5 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/BindsCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/BindsCommand.java @@ -3,10 +3,10 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; +import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.utils.Utils; @@ -18,7 +18,6 @@ import net.minecraft.util.Formatting; import java.util.List; -import java.util.stream.Collectors; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; @@ -32,8 +31,8 @@ public void build(LiteralArgumentBuilder builder) { builder.executes(context -> { // Modules List modules = Modules.get().getAll().stream() - .filter(module -> module.keybind.isSet()) - .collect(Collectors.toList()); + .filter(module -> module.keybind.isSet()) + .toList(); ChatUtils.info("--- Bound Modules ((highlight)%d(default)) ---", modules.size()); @@ -61,7 +60,6 @@ public void build(LiteralArgumentBuilder builder) { private MutableText getTooltip(Module module) { MutableText tooltip = Text.literal(Utils.nameToTitle(module.title)).formatted(Formatting.BLUE, Formatting.BOLD).append("\n\n"); tooltip.append(Text.literal(module.description).formatted(Formatting.WHITE)); - return tooltip; } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/CommandsCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/CommandsCommand.java similarity index 75% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/CommandsCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/CommandsCommand.java index a93628e9df..e7ae078061 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/CommandsCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/CommandsCommand.java @@ -3,11 +3,11 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.Commands; +import meteordevelopment.meteorclient.commands.Command; +import meteordevelopment.meteorclient.commands.Commands; import meteordevelopment.meteorclient.systems.config.Config; import meteordevelopment.meteorclient.utils.Utils; import meteordevelopment.meteorclient.utils.player.ChatUtils; @@ -28,10 +28,10 @@ public CommandsCommand() { @Override public void build(LiteralArgumentBuilder builder) { builder.executes(context -> { - ChatUtils.info("--- Commands ((highlight)%d(default)) ---", Commands.get().getAll().size()); + ChatUtils.info("--- Commands ((highlight)%d(default)) ---", Commands.getAll().size()); MutableText commands = Text.literal(""); - Commands.get().getAll().forEach(command -> commands.append(getCommandText(command))); + Commands.getAll().forEach(command -> commands.append(getCommandText(command))); ChatUtils.sendMsg(commands); return SINGLE_SUCCESS; @@ -59,11 +59,12 @@ private MutableText getCommandText(Command command) { // Text MutableText text = Text.literal(Utils.nameToTitle(command.getName())); - if (command != Commands.get().getAll().get(Commands.get().getAll().size() - 1)) text.append(Text.literal(", ").formatted(Formatting.GRAY)); + if (command != Commands.getAll().get(Commands.getAll().size() - 1)) + text.append(Text.literal(", ").formatted(Formatting.GRAY)); text.setStyle(text - .getStyle() - .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip)) - .withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, Config.get().prefix.get() + command.getName())) + .getStyle() + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip)) + .withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, Config.get().prefix.get() + command.getName())) ); return text; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/DamageCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/DamageCommand.java similarity index 93% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/DamageCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/DamageCommand.java index 70b499bbbd..a334d17d67 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/DamageCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/DamageCommand.java @@ -3,12 +3,12 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; -import meteordevelopment.meteorclient.systems.commands.Command; +import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.movement.NoFall; import meteordevelopment.meteorclient.systems.modules.player.AntiHunger; @@ -18,6 +18,7 @@ import net.minecraft.util.math.Vec3d; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class DamageCommand extends Command { private final static SimpleCommandExceptionType INVULNERABLE = new SimpleCommandExceptionType(Text.literal("You are invulnerable.")); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/DismountCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/DismountCommand.java similarity index 82% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/DismountCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/DismountCommand.java index 705482873d..d399f619ba 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/DismountCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/DismountCommand.java @@ -3,14 +3,15 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; +import meteordevelopment.meteorclient.commands.Command; import net.minecraft.command.CommandSource; import net.minecraft.network.packet.c2s.play.PlayerInputC2SPacket; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class DismountCommand extends Command { public DismountCommand() { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/DropCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/DropCommand.java similarity index 88% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/DropCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/DropCommand.java index dd7eed6512..62bbbc5626 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/DropCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/DropCommand.java @@ -3,13 +3,12 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.Commands; +import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.utils.player.InvUtils; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.command.CommandSource; @@ -19,6 +18,7 @@ import net.minecraft.text.Text; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class DropCommand extends Command { private static final SimpleCommandExceptionType NOT_SPECTATOR = new SimpleCommandExceptionType(Text.literal("Can't drop items while in spectator.")); @@ -30,7 +30,6 @@ public DropCommand() { @Override public void build(LiteralArgumentBuilder builder) { - // Main Hand builder.then(literal("hand").executes(context -> drop(player -> player.dropSelectedItem(true)))); @@ -66,7 +65,7 @@ public void build(LiteralArgumentBuilder builder) { }))); // Specific item - builder.then(argument("item", ItemStackArgumentType.itemStack(Commands.REGISTRY_ACCESS)).executes(context -> drop(player -> { + builder.then(argument("item", ItemStackArgumentType.itemStack(REGISTRY_ACCESS)).executes(context -> drop(player -> { ItemStack stack = ItemStackArgumentType.getItemStackArgument(context, "item").createStack(1, false); if (stack == null || stack.getItem() == Items.AIR) throw NO_SUCH_ITEM.create(); @@ -80,12 +79,8 @@ public void build(LiteralArgumentBuilder builder) { } private int drop(PlayerConsumer consumer) throws CommandSyntaxException { - ClientPlayerEntity player = mc.player; - assert player != null; - - if (player.isSpectator()) throw NOT_SPECTATOR.create(); - - consumer.accept(player); + if (mc.player.isSpectator()) throw NOT_SPECTATOR.create(); + consumer.accept(mc.player); return SINGLE_SUCCESS; } @@ -94,5 +89,4 @@ private int drop(PlayerConsumer consumer) throws CommandSyntaxException { private interface PlayerConsumer { void accept(ClientPlayerEntity player) throws CommandSyntaxException; } - } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/EnchantCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/EnchantCommand.java similarity index 92% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/EnchantCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/EnchantCommand.java index 17e33d383a..c667d4c398 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/EnchantCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/EnchantCommand.java @@ -3,15 +3,14 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.Commands; +import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.utils.Utils; import net.minecraft.client.gui.screen.ingame.InventoryScreen; import net.minecraft.command.CommandSource; @@ -26,6 +25,7 @@ import java.util.function.Function; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class EnchantCommand extends Command { private final static SimpleCommandExceptionType NOT_IN_CREATIVE = new SimpleCommandExceptionType(Text.literal("You must be in creative mode to use this.")); @@ -37,7 +37,7 @@ public EnchantCommand() { @Override public void build(LiteralArgumentBuilder builder) { - builder.then(literal("one").then(argument("enchantment", RegistryEntryArgumentType.registryEntry(Commands.REGISTRY_ACCESS, RegistryKeys.ENCHANTMENT)) + builder.then(literal("one").then(argument("enchantment", RegistryEntryArgumentType.registryEntry(REGISTRY_ACCESS, RegistryKeys.ENCHANTMENT)) .then(literal("level").then(argument("level", IntegerArgumentType.integer()).executes(context -> { one(context, enchantment -> context.getArgument("level", Integer.class)); return SINGLE_SUCCESS; @@ -78,7 +78,7 @@ public void build(LiteralArgumentBuilder builder) { return SINGLE_SUCCESS; })); - builder.then(literal("remove").then(argument("enchantment", RegistryEntryArgumentType.registryEntry(Commands.REGISTRY_ACCESS, RegistryKeys.ENCHANTMENT)).executes(context -> { + builder.then(literal("remove").then(argument("enchantment", RegistryEntryArgumentType.registryEntry(REGISTRY_ACCESS, RegistryKeys.ENCHANTMENT)).executes(context -> { ItemStack itemStack = tryGetItemStack(); RegistryEntry.Reference enchantment = context.getArgument("enchantment", RegistryEntry.Reference.class); Utils.removeEnchantment(itemStack, enchantment.value()); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/EnderChestCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/EnderChestCommand.java similarity index 87% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/EnderChestCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/EnderChestCommand.java index 7736d9a998..f411ab5214 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/EnderChestCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/EnderChestCommand.java @@ -3,10 +3,10 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; +import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.utils.Utils; import net.minecraft.command.CommandSource; import net.minecraft.item.ItemStack; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FakePlayerCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/FakePlayerCommand.java similarity index 93% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FakePlayerCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/FakePlayerCommand.java index 92b777c00d..122e9a13c6 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FakePlayerCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/FakePlayerCommand.java @@ -3,12 +3,12 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.arguments.FakePlayerArgumentType; +import meteordevelopment.meteorclient.commands.Command; +import meteordevelopment.meteorclient.commands.arguments.FakePlayerArgumentType; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.player.FakePlayer; import meteordevelopment.meteorclient.utils.entity.fakeplayer.FakePlayerEntity; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FovCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/FovCommand.java similarity index 83% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FovCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/FovCommand.java index f81130b4a9..1a1fce9bd9 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FovCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/FovCommand.java @@ -3,15 +3,16 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.mixininterface.ISimpleOption; -import meteordevelopment.meteorclient.systems.commands.Command; import net.minecraft.command.CommandSource; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class FovCommand extends Command { public FovCommand() { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FriendsCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/FriendsCommand.java similarity index 89% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FriendsCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/FriendsCommand.java index b6562caaae..66a1228f06 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FriendsCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/FriendsCommand.java @@ -3,13 +3,13 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.authlib.GameProfile; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.arguments.FriendArgumentType; -import meteordevelopment.meteorclient.systems.commands.arguments.PlayerListEntryArgumentType; +import meteordevelopment.meteorclient.commands.Command; +import meteordevelopment.meteorclient.commands.arguments.FriendArgumentType; +import meteordevelopment.meteorclient.commands.arguments.PlayerListEntryArgumentType; import meteordevelopment.meteorclient.systems.friends.Friend; import meteordevelopment.meteorclient.systems.friends.Friends; import meteordevelopment.meteorclient.utils.player.ChatUtils; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/GamemodeCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/GamemodeCommand.java similarity index 83% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/GamemodeCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/GamemodeCommand.java index 121e7db02b..f2ec5840ec 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/GamemodeCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/GamemodeCommand.java @@ -3,14 +3,15 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; +import meteordevelopment.meteorclient.commands.Command; import net.minecraft.command.CommandSource; import net.minecraft.world.GameMode; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class GamemodeCommand extends Command { public GamemodeCommand() { @@ -22,7 +23,6 @@ public void build(LiteralArgumentBuilder builder) { for (GameMode gameMode : GameMode.values()) { builder.then(literal(gameMode.getName()).executes(context -> { mc.interactionManager.setGameMode(gameMode); - return SINGLE_SUCCESS; })); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/GiveCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/GiveCommand.java similarity index 89% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/GiveCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/GiveCommand.java index 02bdad752e..83ad311c21 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/GiveCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/GiveCommand.java @@ -3,15 +3,12 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; - -//Created by Octoham 16/04/2021 +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.Commands; +import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.utils.player.FindItemResult; import meteordevelopment.meteorclient.utils.player.InvUtils; import net.minecraft.command.CommandSource; @@ -21,6 +18,7 @@ import net.minecraft.text.Text; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class GiveCommand extends Command { private final static SimpleCommandExceptionType NOT_IN_CREATIVE = new SimpleCommandExceptionType(Text.literal("You must be in creative mode to use this.")); @@ -32,7 +30,7 @@ public GiveCommand() { @Override public void build(LiteralArgumentBuilder builder) { - builder.then(argument("item", ItemStackArgumentType.itemStack(Commands.REGISTRY_ACCESS)).executes(context -> { + builder.then(argument("item", ItemStackArgumentType.itemStack(REGISTRY_ACCESS)).executes(context -> { if (!mc.player.getAbilities().creativeMode) throw NOT_IN_CREATIVE.create(); ItemStack item = ItemStackArgumentType.getItemStackArgument(context, "item").createStack(1, false); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/HClipCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/HClipCommand.java similarity index 65% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/HClipCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/HClipCommand.java index 7c5c5ab1ac..2898560650 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/HClipCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/HClipCommand.java @@ -3,17 +3,17 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.arguments.DoubleArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; -import net.minecraft.client.network.ClientPlayerEntity; +import meteordevelopment.meteorclient.commands.Command; import net.minecraft.command.CommandSource; import net.minecraft.entity.Entity; import net.minecraft.util.math.Vec3d; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class HClipCommand extends Command { public HClipCommand() { @@ -23,16 +23,15 @@ public HClipCommand() { @Override public void build(LiteralArgumentBuilder builder) { builder.then(argument("blocks", DoubleArgumentType.doubleArg()).executes(context -> { - ClientPlayerEntity player = mc.player; - assert player != null; - double blocks = context.getArgument("blocks", Double.class); - Vec3d forward = Vec3d.fromPolar(0, player.getYaw()).normalize(); - if (player.hasVehicle()) { - Entity vehicle = player.getVehicle(); + Vec3d forward = Vec3d.fromPolar(0, mc.player.getYaw()).normalize(); + + if (mc.player.hasVehicle()) { + Entity vehicle = mc.player.getVehicle(); vehicle.setPosition(vehicle.getX() + forward.x * blocks, vehicle.getY(), vehicle.getZ() + forward.z * blocks); } - player.setPosition(player.getX() + forward.x * blocks, player.getY(), player.getZ() + forward.z * blocks); + + mc.player.setPosition(mc.player.getX() + forward.x * blocks, mc.player.getY(), mc.player.getZ() + forward.z * blocks); return SINGLE_SUCCESS; })); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/InputCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/InputCommand.java similarity index 86% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/InputCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/InputCommand.java index 9a2328d1aa..6e7b0f328b 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/InputCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/InputCommand.java @@ -1,10 +1,15 @@ -package meteordevelopment.meteorclient.systems.commands.commands; +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import meteordevelopment.meteorclient.MeteorClient; +import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.events.world.TickEvent; -import meteordevelopment.meteorclient.systems.commands.Command; import meteordevelopment.orbit.EventHandler; import net.minecraft.client.option.KeyBinding; import net.minecraft.command.CommandSource; @@ -12,6 +17,7 @@ import java.util.Map; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class InputCommand extends Command { private static final Map keys = Map.of( diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/InventoryCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/InventoryCommand.java similarity index 81% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/InventoryCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/InventoryCommand.java index 85e1dd6cdb..63c488a41b 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/InventoryCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/InventoryCommand.java @@ -3,11 +3,11 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.arguments.PlayerArgumentType; +import meteordevelopment.meteorclient.commands.Command; +import meteordevelopment.meteorclient.commands.arguments.PlayerArgumentType; import meteordevelopment.meteorclient.utils.Utils; import net.minecraft.client.gui.screen.ingame.InventoryScreen; import net.minecraft.command.CommandSource; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/LocateCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/LocateCommand.java similarity index 90% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/LocateCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/LocateCommand.java index 61b711e7df..2855c91581 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/LocateCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/LocateCommand.java @@ -3,13 +3,13 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import baritone.api.BaritoneAPI; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import meteordevelopment.meteorclient.MeteorClient; +import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.events.packets.PacketEvent; -import meteordevelopment.meteorclient.systems.commands.Command; import meteordevelopment.meteorclient.utils.player.ChatUtils; import meteordevelopment.meteorclient.utils.player.InvUtils; import meteordevelopment.orbit.EventHandler; @@ -33,28 +33,28 @@ import java.util.List; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class LocateCommand extends Command { - private Vec3d firstStart; private Vec3d firstEnd; private Vec3d secondStart; private Vec3d secondEnd; private final List netherFortressBlocks = Arrays.asList( - Blocks.NETHER_BRICKS, - Blocks.NETHER_BRICK_FENCE, - Blocks.NETHER_WART + Blocks.NETHER_BRICKS, + Blocks.NETHER_BRICK_FENCE, + Blocks.NETHER_WART ); private final List monumentBlocks = Arrays.asList( - Blocks.PRISMARINE_BRICKS, - Blocks.SEA_LANTERN, - Blocks.DARK_PRISMARINE + Blocks.PRISMARINE_BRICKS, + Blocks.SEA_LANTERN, + Blocks.DARK_PRISMARINE ); - private final List strongholdBlocks = Arrays.asList( - Blocks.END_PORTAL_FRAME + private final List strongholdBlocks = Arrays.asList( + Blocks.END_PORTAL_FRAME ); public LocateCommand() { @@ -82,7 +82,7 @@ public void build(LiteralArgumentBuilder builder) { return SINGLE_SUCCESS; } - Vec3d coords = new Vec3d(iconNBT.getDouble("x"),iconNBT.getDouble("y"),iconNBT.getDouble("z")); + Vec3d coords = new Vec3d(iconNBT.getDouble("x"), iconNBT.getDouble("y"), iconNBT.getDouble("z")); MutableText text = Text.literal("Buried Treasure located at "); text.append(ChatUtils.formatCoords(coords)); text.append("."); @@ -107,7 +107,7 @@ public void build(LiteralArgumentBuilder builder) { return SINGLE_SUCCESS; } - Vec3d coords = new Vec3d(nbt1.getDouble("X"),nbt1.getDouble("Y"),nbt1.getDouble("Z")); + Vec3d coords = new Vec3d(nbt1.getDouble("X"), nbt1.getDouble("Y"), nbt1.getDouble("Z")); MutableText text = Text.literal("Lodestone located at "); text.append(ChatUtils.formatCoords(coords)); text.append("."); @@ -134,7 +134,7 @@ public void build(LiteralArgumentBuilder builder) { return SINGLE_SUCCESS; } - Vec3d coords = new Vec3d(iconNBT.getDouble("x"),iconNBT.getDouble("y"),iconNBT.getDouble("z")); + Vec3d coords = new Vec3d(iconNBT.getDouble("x"), iconNBT.getDouble("y"), iconNBT.getDouble("z")); MutableText text = Text.literal("Mansion located at "); text.append(ChatUtils.formatCoords(coords)); text.append("."); @@ -169,7 +169,7 @@ public void build(LiteralArgumentBuilder builder) { builder.then(literal("nether_fortress").executes(s -> { Vec3d coords = findByBlockList(netherFortressBlocks); - if (coords == null ) { + if (coords == null) { error("No nether fortress found."); return SINGLE_SUCCESS; } @@ -189,7 +189,7 @@ public void build(LiteralArgumentBuilder builder) { if (nbt1 != null) { NbtCompound iconNBT = nbt1.getCompound(0); if (iconNBT != null) { - Vec3d coords = new Vec3d(iconNBT.getDouble("x"),iconNBT.getDouble("y"),iconNBT.getDouble("z")); + Vec3d coords = new Vec3d(iconNBT.getDouble("x"), iconNBT.getDouble("y"), iconNBT.getDouble("z")); MutableText text = Text.literal("Monument located at "); text.append(ChatUtils.formatCoords(coords)); text.append("."); @@ -200,7 +200,7 @@ public void build(LiteralArgumentBuilder builder) { } } Vec3d coords = findByBlockList(monumentBlocks); - if (coords == null ) { + if (coords == null) { error("No monument found. You can try using a (highlight)Ocean explorer map(default) for more success."); return SINGLE_SUCCESS; } @@ -223,22 +223,21 @@ private void cancel() { } private Vec3d findByBlockList(List blockList) { - List posList = BaritoneAPI.getProvider().getWorldScanner().scanChunkRadius(BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext(), - blockList,64,10,32); + List posList = BaritoneAPI.getProvider().getWorldScanner().scanChunkRadius(BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext(), blockList, 64, 10, 32); if (posList.isEmpty()) { return null; } if (posList.size() < 3) { warning("Only %d block(s) found. This search might be a false positive.", posList.size()); } - return new Vec3d(posList.get(0).getX(),posList.get(0).getY(),posList.get(0).getZ()); + return new Vec3d(posList.get(0).getX(), posList.get(0).getY(), posList.get(0).getZ()); } @EventHandler private void onReadPacket(PacketEvent.Receive event) { if (event.packet instanceof EntitySpawnS2CPacket packet) { if (packet.getEntityType() == EntityType.EYE_OF_ENDER) { - firstPosition(packet.getX(),packet.getY(),packet.getZ()); + firstPosition(packet.getX(), packet.getY(), packet.getZ()); } } if (event.packet instanceof PlaySoundS2CPacket packet) { @@ -287,7 +286,7 @@ private void findStronghold() { } BaritoneAPI.getProvider().getPrimaryBaritone().getCommandManager().execute("stop"); MeteorClient.EVENT_BUS.unsubscribe(this); - Vec3d coords = new Vec3d(intersection[0],0,intersection[1]); + Vec3d coords = new Vec3d(intersection[0], 0, intersection[1]); MutableText text = Text.literal("Stronghold roughly located at "); text.append(ChatUtils.formatCoords(coords)); text.append("."); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/MacroCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/MacroCommand.java similarity index 54% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/MacroCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/MacroCommand.java index 5a97a302e9..b7feaa6d0c 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/MacroCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/MacroCommand.java @@ -3,11 +3,11 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.arguments.MacroArgumentType; +import meteordevelopment.meteorclient.commands.Command; +import meteordevelopment.meteorclient.commands.arguments.MacroArgumentType; import meteordevelopment.meteorclient.systems.macros.Macro; import net.minecraft.command.CommandSource; @@ -20,12 +20,10 @@ public MacroCommand() { @Override public void build(LiteralArgumentBuilder builder) { - builder.then( - argument("macro", MacroArgumentType.create()) - .executes(context -> { - Macro macro = MacroArgumentType.get(context); - macro.onAction(); - return SINGLE_SUCCESS; - })); + builder.then(argument("macro", MacroArgumentType.create()).executes(context -> { + Macro macro = MacroArgumentType.get(context); + macro.onAction(); + return SINGLE_SUCCESS; + })); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ModulesCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/ModulesCommand.java similarity index 94% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ModulesCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/ModulesCommand.java index d0ed487f95..a343199ebb 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ModulesCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/ModulesCommand.java @@ -3,10 +3,10 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; +import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.utils.player.ChatUtils; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/NameHistoryCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/NameHistoryCommand.java similarity index 94% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/NameHistoryCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/NameHistoryCommand.java index 7fd402604b..144110182b 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/NameHistoryCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/NameHistoryCommand.java @@ -3,11 +3,11 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.arguments.PlayerListEntryArgumentType; +import meteordevelopment.meteorclient.commands.Command; +import meteordevelopment.meteorclient.commands.arguments.PlayerListEntryArgumentType; import meteordevelopment.meteorclient.utils.Utils; import meteordevelopment.meteorclient.utils.network.Http; import meteordevelopment.meteorclient.utils.network.MeteorExecutor; @@ -25,6 +25,7 @@ import java.util.UUID; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class NameHistoryCommand extends Command { public NameHistoryCommand() { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/NbtCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/NbtCommand.java similarity index 96% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/NbtCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/NbtCommand.java index 4a5030105c..b1890925f8 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/NbtCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/NbtCommand.java @@ -3,13 +3,13 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.arguments.CompoundNbtTagArgumentType; +import meteordevelopment.meteorclient.commands.Command; +import meteordevelopment.meteorclient.commands.arguments.CompoundNbtTagArgumentType; import meteordevelopment.meteorclient.systems.config.Config; import net.minecraft.command.CommandSource; import net.minecraft.command.argument.NbtPathArgumentType; @@ -24,6 +24,7 @@ import net.minecraft.util.Formatting; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class NbtCommand extends Command { public NbtCommand() { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/NotebotCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/NotebotCommand.java similarity index 97% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/NotebotCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/NotebotCommand.java index 737e568bb6..4f88fc3183 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/NotebotCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/NotebotCommand.java @@ -3,16 +3,16 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; import meteordevelopment.meteorclient.MeteorClient; +import meteordevelopment.meteorclient.commands.Command; +import meteordevelopment.meteorclient.commands.arguments.NotebotSongArgumentType; import meteordevelopment.meteorclient.events.packets.PacketEvent; import meteordevelopment.meteorclient.events.world.TickEvent; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.arguments.NotebotSongArgumentType; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.misc.Notebot; import meteordevelopment.meteorclient.utils.notebot.song.Note; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/PeekCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/PeekCommand.java similarity index 80% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/PeekCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/PeekCommand.java index dc6b860fa6..efffa35bd7 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/PeekCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/PeekCommand.java @@ -3,22 +3,22 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; -import meteordevelopment.meteorclient.systems.commands.Command; +import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.utils.Utils; import net.minecraft.command.CommandSource; import net.minecraft.item.ItemStack; import net.minecraft.text.Text; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class PeekCommand extends Command { private static final ItemStack[] ITEMS = new ItemStack[27]; - private static final SimpleCommandExceptionType NOT_HOLDING_SHULKER_BOX = - new SimpleCommandExceptionType(Text.literal("You must be holding a storage block with items in it.")); + private static final SimpleCommandExceptionType NOT_HOLDING_SHULKER_BOX = new SimpleCommandExceptionType(Text.literal("You must be holding a storage block with items in it.")); public PeekCommand() { super("peek", "Lets you see what's inside storage block items."); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ProfilesCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/ProfilesCommand.java similarity index 89% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ProfilesCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/ProfilesCommand.java index 47aca2fad1..baea74d22d 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ProfilesCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/ProfilesCommand.java @@ -3,11 +3,11 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.arguments.ProfileArgumentType; +import meteordevelopment.meteorclient.commands.Command; +import meteordevelopment.meteorclient.commands.arguments.ProfileArgumentType; import meteordevelopment.meteorclient.systems.profiles.Profile; import meteordevelopment.meteorclient.systems.profiles.Profiles; import net.minecraft.command.CommandSource; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ReloadCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/ReloadCommand.java similarity index 90% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ReloadCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/ReloadCommand.java index 59518330d3..2f2a56d417 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ReloadCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/ReloadCommand.java @@ -3,12 +3,12 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.renderer.Fonts; import meteordevelopment.meteorclient.systems.Systems; -import meteordevelopment.meteorclient.systems.commands.Command; import meteordevelopment.meteorclient.systems.friends.Friend; import meteordevelopment.meteorclient.systems.friends.Friends; import meteordevelopment.meteorclient.utils.network.Capes; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ResetCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/ResetCommand.java similarity index 92% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ResetCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/ResetCommand.java index 64467ded90..21d1f1b6d3 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ResetCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/ResetCommand.java @@ -3,14 +3,14 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import meteordevelopment.meteorclient.commands.Command; +import meteordevelopment.meteorclient.commands.arguments.ModuleArgumentType; import meteordevelopment.meteorclient.gui.GuiThemes; import meteordevelopment.meteorclient.settings.Setting; import meteordevelopment.meteorclient.systems.Systems; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.arguments.ModuleArgumentType; import meteordevelopment.meteorclient.systems.hud.Hud; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.systems.modules.Modules; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/RotationCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/RotationCommand.java similarity index 92% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/RotationCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/RotationCommand.java index 4e3c43b3f1..a0c513391d 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/RotationCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/RotationCommand.java @@ -3,17 +3,18 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.arguments.FloatArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.arguments.DirectionArgumentType; +import meteordevelopment.meteorclient.commands.Command; +import meteordevelopment.meteorclient.commands.arguments.DirectionArgumentType; import net.minecraft.command.CommandSource; import net.minecraft.util.math.Direction; import net.minecraft.util.math.MathHelper; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class RotationCommand extends Command { public RotationCommand() { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/SaveMapCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/SaveMapCommand.java similarity index 96% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/SaveMapCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/SaveMapCommand.java index 4f0bc903c3..3358133dad 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/SaveMapCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/SaveMapCommand.java @@ -3,13 +3,13 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; +import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.mixin.MapRendererAccessor; -import meteordevelopment.meteorclient.systems.commands.Command; import net.minecraft.client.render.MapRenderer; import net.minecraft.command.CommandSource; import net.minecraft.item.FilledMapItem; @@ -30,6 +30,7 @@ import java.nio.ByteBuffer; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class SaveMapCommand extends Command { private static final SimpleCommandExceptionType MAP_NOT_FOUND = new SimpleCommandExceptionType(Text.literal("You must be holding a filled map.")); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/SayCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/SayCommand.java similarity index 93% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/SayCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/SayCommand.java index 932aa6247e..0c09971bbd 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/SayCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/SayCommand.java @@ -3,12 +3,12 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.mixin.ClientPlayNetworkHandlerAccessor; -import meteordevelopment.meteorclient.systems.commands.Command; import meteordevelopment.meteorclient.utils.misc.MeteorStarscript; import meteordevelopment.starscript.Script; import net.minecraft.client.network.ClientPlayNetworkHandler; @@ -22,6 +22,7 @@ import java.time.Instant; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class SayCommand extends Command { public SayCommand() { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ServerCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/ServerCommand.java similarity index 98% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ServerCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/ServerCommand.java index 175dc2fa33..c825bb0469 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ServerCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/ServerCommand.java @@ -3,16 +3,16 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.suggestion.Suggestion; import com.mojang.brigadier.suggestion.Suggestions; import joptsimple.internal.Strings; import meteordevelopment.meteorclient.MeteorClient; +import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.events.packets.PacketEvent; import meteordevelopment.meteorclient.events.world.TickEvent; -import meteordevelopment.meteorclient.systems.commands.Command; import meteordevelopment.meteorclient.utils.world.TickRate; import meteordevelopment.orbit.EventHandler; import net.minecraft.client.network.ServerAddress; @@ -33,6 +33,7 @@ import java.util.*; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class ServerCommand extends Command { private static final List ANTICHEAT_LIST = Arrays.asList("nocheatplus", "negativity", "warden", "horizon", "illegalstack", "coreprotect", "exploitsx", "vulcan", "abc", "spartan", "kauri", "anticheatreloaded", "witherac", "godseye", "matrix", "wraith"); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/SettingCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/SettingCommand.java similarity index 87% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/SettingCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/SettingCommand.java index e6d92c2739..6facd73456 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/SettingCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/SettingCommand.java @@ -3,16 +3,16 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import meteordevelopment.meteorclient.commands.Command; +import meteordevelopment.meteorclient.commands.arguments.ModuleArgumentType; +import meteordevelopment.meteorclient.commands.arguments.SettingArgumentType; +import meteordevelopment.meteorclient.commands.arguments.SettingValueArgumentType; import meteordevelopment.meteorclient.gui.GuiThemes; import meteordevelopment.meteorclient.gui.WidgetScreen; import meteordevelopment.meteorclient.settings.Setting; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.arguments.ModuleArgumentType; -import meteordevelopment.meteorclient.systems.commands.arguments.SettingArgumentType; -import meteordevelopment.meteorclient.systems.commands.arguments.SettingValueArgumentType; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.utils.Utils; import net.minecraft.command.CommandSource; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/SpectateCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/SpectateCommand.java similarity index 87% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/SpectateCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/SpectateCommand.java index e1aedcbfba..9b8d70ce16 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/SpectateCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/SpectateCommand.java @@ -3,18 +3,19 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import meteordevelopment.meteorclient.MeteorClient; +import meteordevelopment.meteorclient.commands.Command; +import meteordevelopment.meteorclient.commands.arguments.PlayerArgumentType; import meteordevelopment.meteorclient.events.meteor.KeyEvent; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.arguments.PlayerArgumentType; import meteordevelopment.orbit.EventHandler; import net.minecraft.command.CommandSource; import net.minecraft.text.Text; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class SpectateCommand extends Command { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/SwarmCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/SwarmCommand.java similarity index 96% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/SwarmCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/SwarmCommand.java index 5a6793d988..8ce4ec004e 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/SwarmCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/SwarmCommand.java @@ -3,7 +3,7 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import baritone.api.BaritoneAPI; import baritone.api.pathing.goals.GoalXZ; @@ -12,10 +12,9 @@ import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.Commands; -import meteordevelopment.meteorclient.systems.commands.arguments.ModuleArgumentType; -import meteordevelopment.meteorclient.systems.commands.arguments.PlayerArgumentType; +import meteordevelopment.meteorclient.commands.Command; +import meteordevelopment.meteorclient.commands.arguments.ModuleArgumentType; +import meteordevelopment.meteorclient.commands.arguments.PlayerArgumentType; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.misc.swarm.Swarm; @@ -33,6 +32,7 @@ import java.util.Random; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class SwarmCommand extends Command { @@ -172,7 +172,7 @@ else if (swarm.isWorker()) { } return SINGLE_SUCCESS; }) - .then(argument("target", BlockStateArgumentType.blockState(Commands.REGISTRY_ACCESS)).executes(context -> { + .then(argument("target", BlockStateArgumentType.blockState(REGISTRY_ACCESS)).executes(context -> { Swarm swarm = Modules.get().get(Swarm.class); if (swarm.isActive()) { if (swarm.isHost()) { @@ -188,7 +188,7 @@ else if (swarm.isWorker()) { } return SINGLE_SUCCESS; }) - .then(argument("repair", BlockStateArgumentType.blockState(Commands.REGISTRY_ACCESS)).executes(context -> { + .then(argument("repair", BlockStateArgumentType.blockState(REGISTRY_ACCESS)).executes(context -> { Swarm swarm = Modules.get().get(Swarm.class); if (swarm.isActive()) { if (swarm.isHost()) { @@ -235,7 +235,7 @@ else if (swarm.isWorker()) { })))); builder.then(literal("mine") - .then(argument("block", BlockStateArgumentType.blockState(Commands.REGISTRY_ACCESS)).executes(context -> { + .then(argument("block", BlockStateArgumentType.blockState(REGISTRY_ACCESS)).executes(context -> { Swarm swarm = Modules.get().get(Swarm.class); if (swarm.isActive()) { if (swarm.isHost()) { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ToggleCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/ToggleCommand.java similarity index 93% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ToggleCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/ToggleCommand.java index 7e032161a1..96ae914310 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ToggleCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/ToggleCommand.java @@ -3,11 +3,11 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.arguments.ModuleArgumentType; +import meteordevelopment.meteorclient.commands.Command; +import meteordevelopment.meteorclient.commands.arguments.ModuleArgumentType; import meteordevelopment.meteorclient.systems.hud.Hud; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.systems.modules.Modules; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/VClipCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/VClipCommand.java similarity index 94% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/VClipCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/VClipCommand.java index b19e435b62..500fb7f5cb 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/VClipCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/VClipCommand.java @@ -3,16 +3,17 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.arguments.DoubleArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; +import meteordevelopment.meteorclient.commands.Command; import net.minecraft.command.CommandSource; import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class VClipCommand extends Command { public VClipCommand() { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/WaypointCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/WaypointCommand.java similarity index 93% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/WaypointCommand.java rename to src/main/java/meteordevelopment/meteorclient/commands/commands/WaypointCommand.java index b8220ba765..2de5b39fb3 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/WaypointCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/WaypointCommand.java @@ -3,12 +3,12 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.commands.commands; +package meteordevelopment.meteorclient.commands.commands; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.arguments.WaypointArgumentType; +import meteordevelopment.meteorclient.commands.Command; +import meteordevelopment.meteorclient.commands.arguments.WaypointArgumentType; import meteordevelopment.meteorclient.systems.waypoints.Waypoint; import meteordevelopment.meteorclient.systems.waypoints.Waypoints; import meteordevelopment.meteorclient.utils.player.PlayerUtils; @@ -16,6 +16,7 @@ import net.minecraft.util.Formatting; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class WaypointCommand extends Command { public WaypointCommand() { diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ChatInputSuggestorMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ChatInputSuggestorMixin.java index 517767018d..a6e75f91f9 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ChatInputSuggestorMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ChatInputSuggestorMixin.java @@ -8,7 +8,7 @@ import com.mojang.brigadier.ParseResults; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.suggestion.Suggestions; -import meteordevelopment.meteorclient.systems.commands.Commands; +import meteordevelopment.meteorclient.commands.Commands; import meteordevelopment.meteorclient.systems.config.Config; import net.minecraft.client.gui.screen.ChatInputSuggestor; import net.minecraft.client.gui.widget.TextFieldWidget; diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java index fc9413f4f8..57bc791247 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java @@ -8,6 +8,7 @@ import baritone.api.BaritoneAPI; import com.mojang.brigadier.exceptions.CommandSyntaxException; import meteordevelopment.meteorclient.MeteorClient; +import meteordevelopment.meteorclient.commands.Commands; import meteordevelopment.meteorclient.events.entity.EntityDestroyEvent; import meteordevelopment.meteorclient.events.entity.player.PickItemsEvent; import meteordevelopment.meteorclient.events.game.GameJoinedEvent; @@ -18,7 +19,6 @@ import meteordevelopment.meteorclient.events.packets.PlaySoundPacketEvent; import meteordevelopment.meteorclient.events.world.ChunkDataEvent; import meteordevelopment.meteorclient.mixininterface.IExplosionS2CPacket; -import meteordevelopment.meteorclient.systems.commands.Commands; import meteordevelopment.meteorclient.systems.config.Config; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.movement.Velocity; @@ -144,7 +144,7 @@ private void onSendChatMessage(String message, CallbackInfo ci) { if (message.startsWith(Config.get().prefix.get())) { try { - Commands.get().dispatch(message.substring(Config.get().prefix.get().length())); + Commands.dispatch(message.substring(Config.get().prefix.get().length())); } catch (CommandSyntaxException e) { ChatUtils.error(e.getMessage()); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ScreenMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ScreenMixin.java index dd3042c8fc..1b5837aad9 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ScreenMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ScreenMixin.java @@ -6,7 +6,7 @@ package meteordevelopment.meteorclient.mixin; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import meteordevelopment.meteorclient.systems.commands.Commands; +import meteordevelopment.meteorclient.commands.Commands; import meteordevelopment.meteorclient.systems.config.Config; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.render.NoRender; @@ -45,7 +45,7 @@ private static void onComponentConstruct(List list, TooltipDat private void onRunCommand(Style style, CallbackInfoReturnable cir) { if (style.getClickEvent().getValue().startsWith(Config.get().prefix.get())) { try { - Commands.get().dispatch(style.getClickEvent().getValue().substring(Config.get().prefix.get().length())); + Commands.dispatch(style.getClickEvent().getValue().substring(Config.get().prefix.get().length())); cir.setReturnValue(true); cir.cancel(); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/Systems.java b/src/main/java/meteordevelopment/meteorclient/systems/Systems.java index 8b7a06bb31..c1c5d6549d 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/Systems.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/Systems.java @@ -8,7 +8,6 @@ import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.events.game.GameLeftEvent; import meteordevelopment.meteorclient.systems.accounts.Accounts; -import meteordevelopment.meteorclient.systems.commands.Commands; import meteordevelopment.meteorclient.systems.config.Config; import meteordevelopment.meteorclient.systems.friends.Friends; import meteordevelopment.meteorclient.systems.hud.Hud; @@ -41,7 +40,6 @@ public static void init() { add(new Modules()); add(new Macros()); - add(new Commands()); add(new Friends()); add(new Accounts()); add(new Waypoints()); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterChat.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterChat.java index 6bdb3d0add..4fb3db1673 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterChat.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterChat.java @@ -7,11 +7,11 @@ import it.unimi.dsi.fastutil.chars.Char2CharMap; import it.unimi.dsi.fastutil.chars.Char2CharOpenHashMap; +import meteordevelopment.meteorclient.commands.Commands; import meteordevelopment.meteorclient.events.game.ReceiveMessageEvent; import meteordevelopment.meteorclient.events.game.SendMessageEvent; import meteordevelopment.meteorclient.mixin.ChatHudAccessor; import meteordevelopment.meteorclient.settings.*; -import meteordevelopment.meteorclient.systems.commands.Commands; import meteordevelopment.meteorclient.systems.modules.Categories; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.utils.Utils; @@ -421,7 +421,7 @@ private MutableText getSendButton(String message) { .withFormatting(Formatting.DARK_RED) .withClickEvent(new ClickEvent( ClickEvent.Action.RUN_COMMAND, - Commands.get().get("say").toString(message) + Commands.get("say").toString(message) )) .withHoverEvent(new HoverEvent( HoverEvent.Action.SHOW_TEXT, diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmWorker.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmWorker.java index 0946071251..55852e2c8f 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmWorker.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmWorker.java @@ -6,7 +6,7 @@ package meteordevelopment.meteorclient.systems.modules.misc.swarm; import baritone.api.BaritoneAPI; -import meteordevelopment.meteorclient.systems.commands.Commands; +import meteordevelopment.meteorclient.commands.Commands; import meteordevelopment.meteorclient.utils.player.ChatUtils; import net.minecraft.block.Block; @@ -45,7 +45,7 @@ public void run() { ChatUtils.infoPrefix("Swarm", "Received command: (highlight)%s", read); try { - Commands.get().dispatch(read); + Commands.dispatch(read); } catch (Exception e) { ChatUtils.error("Error fetching command."); e.printStackTrace();