From 3b409b8215ddfbe6e263a2a96d786519fb7770f3 Mon Sep 17 00:00:00 2001 From: Soda5601 <62250232+Soda5601@users.noreply.github.com> Date: Tue, 2 May 2023 15:04:37 +0800 Subject: [PATCH] Re-added AimAssist (#246) --- README.md | 3 +- .../anticope/rejects/MeteorRejectsAddon.java | 62 ++++--- .../arguments/ClientPosArgumentType.java | 14 +- .../rejects/arguments/EnumArgumentType.java | 11 +- .../arguments/EnumStringArgumentType.java | 7 +- .../rejects/commands/CenterCommand.java | 3 +- .../rejects/commands/ClearChatCommand.java | 3 +- .../rejects/commands/GhostCommand.java | 7 +- .../rejects/commands/GiveCommand.java | 33 ++-- .../rejects/commands/HeadsCommand.java | 8 +- .../rejects/commands/KickCommand.java | 48 +++--- .../rejects/commands/LocateCommand.java | 3 +- .../rejects/commands/PanicCommand.java | 2 +- .../rejects/commands/ReconnectCommand.java | 3 +- .../rejects/commands/SaveSkinCommand.java | 15 +- .../rejects/commands/SeedCommand.java | 14 +- .../rejects/commands/ServerCommand.java | 98 +++++------ .../rejects/commands/SetBlockCommand.java | 8 +- .../rejects/commands/SetVelocityCommand.java | 5 +- .../rejects/commands/TeleportCommand.java | 7 +- .../rejects/commands/TerrainExport.java | 8 +- .../mixin/meteor/AccountsScreenMixin.java | 4 +- .../mixin/meteor/modules/AimAssistMixin.java | 39 ----- .../anticope/rejects/modules/AimAssist.java | 163 ++++++++++++++++++ .../AddCustomYggdrasilAccountScreen.java | 4 +- .../meteor-rejects-meteor.mixins.json | 1 - 26 files changed, 344 insertions(+), 229 deletions(-) delete mode 100644 src/main/java/anticope/rejects/mixin/meteor/modules/AimAssistMixin.java create mode 100644 src/main/java/anticope/rejects/modules/AimAssist.java diff --git a/README.md b/README.md index a50e11d..c75d729 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ # Features ## Modules +- AimAssist (Removed from Meteor in [ee391](https://github.com/MeteorDevelopment/meteor-client/commit/ee391e431f345f253447f425dbc0de8625f88e65)) - AntiBot (Removed from Meteor in [166fc](https://github.com/MeteorDevelopment/meteor-client/commit/166fccc73e53de6cfdbe41ea58dc593a2f5011f6)) - AntiCrash (Ported from [Anti-ClientCrasher](https://github.com/wagyourtail/Anti-ClientCrasher)) - AntiSpawnpoint @@ -93,8 +94,6 @@ - KillAura - `Fov and invisible filter` - `Random Teleport, Hit Chance, Random Delay` (Removed from Meteor in [8722e](https://github.com/MeteorDevelopment/meteor-client/commit/8722ef565afa02ca4b6d9710a20fc9fcfd97bf05)) -- AimAssist - - `Fov filter` - Alts - `Yggdrasil Login` diff --git a/src/main/java/anticope/rejects/MeteorRejectsAddon.java b/src/main/java/anticope/rejects/MeteorRejectsAddon.java index 1efcec5..0dc127e 100644 --- a/src/main/java/anticope/rejects/MeteorRejectsAddon.java +++ b/src/main/java/anticope/rejects/MeteorRejectsAddon.java @@ -1,22 +1,20 @@ package anticope.rejects; import anticope.rejects.commands.*; -import anticope.rejects.gui.hud.*; +import anticope.rejects.gui.hud.RadarHud; import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme; import anticope.rejects.modules.*; import meteordevelopment.meteorclient.addons.GithubRepo; import meteordevelopment.meteorclient.addons.MeteorAddon; +import meteordevelopment.meteorclient.commands.Commands; import meteordevelopment.meteorclient.gui.GuiThemes; import meteordevelopment.meteorclient.systems.Systems; -import meteordevelopment.meteorclient.systems.commands.Commands; import meteordevelopment.meteorclient.systems.hud.Hud; import meteordevelopment.meteorclient.systems.hud.HudGroup; import meteordevelopment.meteorclient.systems.modules.Category; import meteordevelopment.meteorclient.systems.modules.Modules; import net.fabricmc.loader.api.FabricLoader; - import net.minecraft.item.Items; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -24,13 +22,14 @@ public class MeteorRejectsAddon extends MeteorAddon { public static final Logger LOG = LoggerFactory.getLogger("Rejects"); public static final Category CATEGORY = new Category("Rejects", Items.BARRIER.getDefaultStack()); public static final HudGroup HUD_GROUP = new HudGroup("Rejects"); - + @Override public void onInitialize() { LOG.info("Initializing Meteor Rejects Addon"); - + // Modules Modules modules = Modules.get(); + modules.add(new AimAssist()); modules.add(new AntiBot()); modules.add(new AntiCrash()); modules.add(new AntiSpawnpoint()); @@ -79,34 +78,33 @@ public class MeteorRejectsAddon extends MeteorAddon { modules.add(new SkeletonESP()); modules.add(new SoundLocator()); modules.add(new TreeAura()); - + // Commands - Commands commands = Commands.get(); - commands.add(new CenterCommand()); - commands.add(new ClearChatCommand()); - commands.add(new GhostCommand()); - commands.add(new GiveCommand()); - commands.add(new HeadsCommand()); - commands.add(new KickCommand()); - commands.add(new LocateCommand()); - commands.add(new PanicCommand()); - commands.add(new ReconnectCommand()); - commands.add(new ServerCommand()); - commands.add(new SaveSkinCommand()); - commands.add(new SeedCommand()); - commands.add(new SetBlockCommand()); - commands.add(new SetVelocityCommand()); - commands.add(new TeleportCommand()); - commands.add(new TerrainExport()); - + Commands.add(new CenterCommand()); + Commands.add(new ClearChatCommand()); + Commands.add(new GhostCommand()); + Commands.add(new GiveCommand()); + Commands.add(new HeadsCommand()); + Commands.add(new KickCommand()); + Commands.add(new LocateCommand()); + Commands.add(new PanicCommand()); + Commands.add(new ReconnectCommand()); + Commands.add(new ServerCommand()); + Commands.add(new SaveSkinCommand()); + Commands.add(new SeedCommand()); + Commands.add(new SetBlockCommand()); + Commands.add(new SetVelocityCommand()); + Commands.add(new TeleportCommand()); + Commands.add(new TerrainExport()); + // HUD Hud hud = Systems.get(Hud.class); hud.register(RadarHud.INFO); - + // Themes GuiThemes.add(new MeteorRoundedGuiTheme()); } - + @Override public void onRegisterCategories() { Modules.registerCategory(CATEGORY); @@ -125,11 +123,11 @@ public class MeteorRejectsAddon extends MeteorAddon { @Override public String getCommit() { String commit = FabricLoader - .getInstance() - .getModContainer("meteor-rejects") - .get().getMetadata() - .getCustomValue("github:sha") - .getAsString(); + .getInstance() + .getModContainer("meteor-rejects") + .get().getMetadata() + .getCustomValue("github:sha") + .getAsString(); LOG.info(String.format("Rejects version: %s", commit)); return commit.isEmpty() ? null : commit.trim(); } diff --git a/src/main/java/anticope/rejects/arguments/ClientPosArgumentType.java b/src/main/java/anticope/rejects/arguments/ClientPosArgumentType.java index fea1116..12a79e6 100644 --- a/src/main/java/anticope/rejects/arguments/ClientPosArgumentType.java +++ b/src/main/java/anticope/rejects/arguments/ClientPosArgumentType.java @@ -8,20 +8,18 @@ import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; import net.minecraft.client.MinecraftClient; import net.minecraft.command.CommandSource; -import net.minecraft.command.argument.*; +import net.minecraft.command.argument.CoordinateArgument; +import net.minecraft.command.argument.Vec3ArgumentType; import net.minecraft.server.command.CommandManager; import net.minecraft.util.math.Vec3d; -import java.util.*; +import java.util.Arrays; +import java.util.Collection; import java.util.concurrent.CompletableFuture; public class ClientPosArgumentType implements ArgumentType { - private static final Collection EXAMPLES = Arrays.asList("0 0 0", "~ ~ ~", "~0.5 ~1 ~-5"); private static final MinecraftClient mc = MinecraftClient.getInstance(); - public ClientPosArgumentType() { - } - public static ClientPosArgumentType pos() { return new ClientPosArgumentType(); } @@ -31,9 +29,9 @@ public class ClientPosArgumentType implements ArgumentType { return Suggestions.empty(); } else { String string = builder.getRemaining(); - Object collection2 = ((CommandSource)context.getSource()).getBlockPositionSuggestions(); + Collection collection2 = ((CommandSource)context.getSource()).getBlockPositionSuggestions(); - return CommandSource.suggestPositions(string, (Collection)collection2, builder, CommandManager.getCommandValidator(this::parse)); + return CommandSource.suggestPositions(string, collection2, builder, CommandManager.getCommandValidator(this::parse)); } } diff --git a/src/main/java/anticope/rejects/arguments/EnumArgumentType.java b/src/main/java/anticope/rejects/arguments/EnumArgumentType.java index 4d8c141..32b7f5d 100644 --- a/src/main/java/anticope/rejects/arguments/EnumArgumentType.java +++ b/src/main/java/anticope/rejects/arguments/EnumArgumentType.java @@ -1,8 +1,5 @@ package anticope.rejects.arguments; -import java.util.Arrays; -import java.util.concurrent.CompletableFuture; - import com.mojang.brigadier.StringReader; import com.mojang.brigadier.arguments.ArgumentType; import com.mojang.brigadier.context.CommandContext; @@ -10,11 +7,13 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; -import java.lang.reflect.InvocationTargetException; - import net.minecraft.command.CommandSource; import net.minecraft.text.Text; +import java.lang.reflect.InvocationTargetException; +import java.util.Arrays; +import java.util.concurrent.CompletableFuture; + public class EnumArgumentType> implements ArgumentType { private static final DynamicCommandExceptionType NO_SUCH_TYPE = new DynamicCommandExceptionType(o -> Text.literal(o + " is not a valid argument.")); @@ -32,7 +31,7 @@ public class EnumArgumentType> implements ArgumentType { } public static > EnumArgumentType enumArgument(T defaultValue) { - return new EnumArgumentType(defaultValue); + return new EnumArgumentType<>(defaultValue); } public static > T getEnum(CommandContext context, String name, T defaultValue) { diff --git a/src/main/java/anticope/rejects/arguments/EnumStringArgumentType.java b/src/main/java/anticope/rejects/arguments/EnumStringArgumentType.java index 1117d97..bd8e828 100644 --- a/src/main/java/anticope/rejects/arguments/EnumStringArgumentType.java +++ b/src/main/java/anticope/rejects/arguments/EnumStringArgumentType.java @@ -1,8 +1,5 @@ package anticope.rejects.arguments; -import java.util.Collection; -import java.util.concurrent.CompletableFuture; - import com.mojang.brigadier.StringReader; import com.mojang.brigadier.arguments.ArgumentType; import com.mojang.brigadier.context.CommandContext; @@ -10,10 +7,12 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; - import net.minecraft.command.CommandSource; import net.minecraft.text.Text; +import java.util.Collection; +import java.util.concurrent.CompletableFuture; + public class EnumStringArgumentType implements ArgumentType { private Collection EXAMPLES; diff --git a/src/main/java/anticope/rejects/commands/CenterCommand.java b/src/main/java/anticope/rejects/commands/CenterCommand.java index 55f0721..5ddf84f 100644 --- a/src/main/java/anticope/rejects/commands/CenterCommand.java +++ b/src/main/java/anticope/rejects/commands/CenterCommand.java @@ -1,12 +1,13 @@ package anticope.rejects.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.PlayerMoveC2SPacket; import net.minecraft.util.math.MathHelper; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class CenterCommand extends Command { public CenterCommand() { diff --git a/src/main/java/anticope/rejects/commands/ClearChatCommand.java b/src/main/java/anticope/rejects/commands/ClearChatCommand.java index c081d7c..94be30c 100644 --- a/src/main/java/anticope/rejects/commands/ClearChatCommand.java +++ b/src/main/java/anticope/rejects/commands/ClearChatCommand.java @@ -1,10 +1,11 @@ package anticope.rejects.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; +import meteordevelopment.meteorclient.commands.Command; import net.minecraft.command.CommandSource; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class ClearChatCommand extends Command { public ClearChatCommand() { diff --git a/src/main/java/anticope/rejects/commands/GhostCommand.java b/src/main/java/anticope/rejects/commands/GhostCommand.java index e31decd..6b033d1 100644 --- a/src/main/java/anticope/rejects/commands/GhostCommand.java +++ b/src/main/java/anticope/rejects/commands/GhostCommand.java @@ -1,8 +1,8 @@ package anticope.rejects.commands; +import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; - +import meteordevelopment.meteorclient.commands.Command; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.command.CommandSource; import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket; @@ -10,8 +10,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; - -import com.mojang.brigadier.arguments.IntegerArgumentType; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class GhostCommand extends Command { public GhostCommand() { diff --git a/src/main/java/anticope/rejects/commands/GiveCommand.java b/src/main/java/anticope/rejects/commands/GiveCommand.java index 5cc58eb..2f95af2 100644 --- a/src/main/java/anticope/rejects/commands/GiveCommand.java +++ b/src/main/java/anticope/rejects/commands/GiveCommand.java @@ -1,28 +1,33 @@ package anticope.rejects.commands; import anticope.rejects.arguments.EnumStringArgumentType; +import anticope.rejects.utils.GiveUtils; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; - +import meteordevelopment.meteorclient.commands.Command; import net.minecraft.command.CommandSource; -import net.minecraft.item.*; -import net.minecraft.nbt.*; - -import anticope.rejects.utils.GiveUtils; -import meteordevelopment.meteorclient.systems.commands.Command; +import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.nbt.NbtDouble; +import net.minecraft.nbt.NbtList; +import net.minecraft.nbt.NbtString; import net.minecraft.registry.Registries; import net.minecraft.text.Text; -import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import java.util.Collection; -import java.util.*; +import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class GiveCommand extends Command { + private final Collection PRESETS = GiveUtils.PRESETS.keySet(); + public GiveCommand() { super("give", "Gives items in creative", "item", "kit"); } - private final Collection PRESETS = GiveUtils.PRESETS.keySet(); @Override public void build(LiteralArgumentBuilder builder) { @@ -31,7 +36,7 @@ public class GiveCommand extends Command { ItemStack item = new ItemStack(Items.STRIDER_SPAWN_EGG); NbtCompound ct = new NbtCompound(); if (inHand.getItem() instanceof BlockItem) { - ct.putInt("Time",1); + ct.putInt("Time", 1); ct.putString("id", "minecraft:falling_block"); ct.put("BlockState", new NbtCompound()); ct.getCompound("BlockState").putString("Name", Registries.ITEM.getId(inHand.getItem()).toString()); @@ -45,11 +50,11 @@ public class GiveCommand extends Command { ct.putString("id", "minecraft:item"); NbtCompound it = new NbtCompound(); it.putString("id", Registries.ITEM.getId(inHand.getItem()).toString()); - it.putInt("Count",inHand.getCount()); + it.putInt("Count", inHand.getCount()); if (inHand.hasNbt()) { it.put("tag", inHand.getNbt()); } - ct.put("Item",it); + ct.put("Item", it); } NbtCompound t = new NbtCompound(); t.put("EntityTag", ct); @@ -94,8 +99,8 @@ public class GiveCommand extends Command { return SINGLE_SUCCESS; }))); - builder.then(literal("head").then(argument("owner",StringArgumentType.greedyString()).executes(ctx -> { - String playerName = ctx.getArgument("owner",String.class); + builder.then(literal("head").then(argument("owner", StringArgumentType.greedyString()).executes(ctx -> { + String playerName = ctx.getArgument("owner", String.class); ItemStack itemStack = new ItemStack(Items.PLAYER_HEAD); NbtCompound tag = new NbtCompound(); tag.putString("SkullOwner", playerName); diff --git a/src/main/java/anticope/rejects/commands/HeadsCommand.java b/src/main/java/anticope/rejects/commands/HeadsCommand.java index ea6667a..2101860 100644 --- a/src/main/java/anticope/rejects/commands/HeadsCommand.java +++ b/src/main/java/anticope/rejects/commands/HeadsCommand.java @@ -2,8 +2,8 @@ package anticope.rejects.commands; import anticope.rejects.gui.screens.HeadScreen; import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.gui.GuiThemes; -import meteordevelopment.meteorclient.systems.commands.Command; import meteordevelopment.meteorclient.utils.Utils; import net.minecraft.command.CommandSource; @@ -21,8 +21,8 @@ public class HeadsCommand extends Command { Utils.screenToOpen = new HeadScreen(GuiThemes.get()); return SINGLE_SUCCESS; }); - + } - - + + } diff --git a/src/main/java/anticope/rejects/commands/KickCommand.java b/src/main/java/anticope/rejects/commands/KickCommand.java index 2a1f7a1..7d55e52 100644 --- a/src/main/java/anticope/rejects/commands/KickCommand.java +++ b/src/main/java/anticope/rejects/commands/KickCommand.java @@ -1,7 +1,7 @@ package anticope.rejects.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; - +import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.utils.player.ChatUtils; import net.minecraft.client.util.GlfwUtil; import net.minecraft.command.CommandSource; @@ -11,9 +11,8 @@ import net.minecraft.network.packet.s2c.play.DisconnectS2CPacket; import net.minecraft.text.Text; import org.apache.commons.lang3.SystemUtils; -import meteordevelopment.meteorclient.systems.commands.Command; - import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class KickCommand extends Command { @@ -21,10 +20,30 @@ public class KickCommand extends Command { super("kick", "Kick or disconnect yourself from the server", "disconnect", "quit"); } + private static void shutdown() throws Exception { + String cmd; + if (SystemUtils.IS_OS_AIX) + cmd = "shutdown -Fh 0"; + else if (SystemUtils.IS_OS_FREE_BSD || SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX || SystemUtils.IS_OS_NET_BSD || SystemUtils.IS_OS_OPEN_BSD || SystemUtils.IS_OS_UNIX) + cmd = "shutdown -h now"; + else if (SystemUtils.IS_OS_HP_UX) + cmd = "shutdown -hy 0"; + else if (SystemUtils.IS_OS_IRIX) + cmd = "shutdown -y -g 0"; + else if (SystemUtils.IS_OS_SOLARIS || SystemUtils.IS_OS_SUN_OS) + cmd = "shutdown -y -i5 -g 0"; + else if (SystemUtils.IS_OS_WINDOWS) + cmd = "shutdown.exe /s /t 0"; + else + throw new Exception("Unsupported operating system."); + + Runtime.getRuntime().exec(cmd); + } + @Override public void build(LiteralArgumentBuilder builder) { builder.then(literal("disconnect").executes(ctx -> { - mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(Text.literal("Disconnected via .kick command"))); + mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(Text.literal("Disconnected via .kick command"))); return SINGLE_SUCCESS; })); builder.then(literal("pos").executes(ctx -> { @@ -52,25 +71,4 @@ public class KickCommand extends Command { return SINGLE_SUCCESS; })); } - - - private static void shutdown() throws Exception { - String cmd = ""; - if (SystemUtils.IS_OS_AIX) - cmd = "shutdown -Fh 0"; - else if (SystemUtils.IS_OS_FREE_BSD || SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX || SystemUtils.IS_OS_NET_BSD || SystemUtils.IS_OS_OPEN_BSD || SystemUtils.IS_OS_UNIX) - cmd = "shutdown -h now"; - else if (SystemUtils.IS_OS_HP_UX) - cmd = "shutdown -hy 0"; - else if (SystemUtils.IS_OS_IRIX) - cmd = "shutdown -y -g 0"; - else if (SystemUtils.IS_OS_SOLARIS || SystemUtils.IS_OS_SUN_OS) - cmd = "shutdown -y -i5 -g 0"; - else if (SystemUtils.IS_OS_WINDOWS) - cmd = "shutdown.exe /s /t 0"; - else - throw new Exception("Unsupported operating system."); - - Runtime.getRuntime().exec(cmd); - } } diff --git a/src/main/java/anticope/rejects/commands/LocateCommand.java b/src/main/java/anticope/rejects/commands/LocateCommand.java index c01b64a..b1d131e 100644 --- a/src/main/java/anticope/rejects/commands/LocateCommand.java +++ b/src/main/java/anticope/rejects/commands/LocateCommand.java @@ -4,7 +4,7 @@ import anticope.rejects.arguments.EnumArgumentType; import anticope.rejects.utils.WorldGenUtils; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; -import meteordevelopment.meteorclient.systems.commands.Command; +import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.utils.Utils; import meteordevelopment.meteorclient.utils.player.ChatUtils; import net.minecraft.command.CommandSource; @@ -14,6 +14,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class LocateCommand extends Command { diff --git a/src/main/java/anticope/rejects/commands/PanicCommand.java b/src/main/java/anticope/rejects/commands/PanicCommand.java index dd222f1..a802505 100644 --- a/src/main/java/anticope/rejects/commands/PanicCommand.java +++ b/src/main/java/anticope/rejects/commands/PanicCommand.java @@ -1,7 +1,7 @@ package anticope.rejects.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 net.minecraft.command.CommandSource; diff --git a/src/main/java/anticope/rejects/commands/ReconnectCommand.java b/src/main/java/anticope/rejects/commands/ReconnectCommand.java index 51d9150..9f7f48e 100644 --- a/src/main/java/anticope/rejects/commands/ReconnectCommand.java +++ b/src/main/java/anticope/rejects/commands/ReconnectCommand.java @@ -1,7 +1,7 @@ package anticope.rejects.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; +import meteordevelopment.meteorclient.commands.Command; import net.minecraft.client.gui.screen.ConnectScreen; import net.minecraft.client.gui.screen.TitleScreen; import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen; @@ -10,6 +10,7 @@ import net.minecraft.client.network.ServerInfo; import net.minecraft.command.CommandSource; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class ReconnectCommand extends Command { public ReconnectCommand() { diff --git a/src/main/java/anticope/rejects/commands/SaveSkinCommand.java b/src/main/java/anticope/rejects/commands/SaveSkinCommand.java index 1a3b1fd..b220a5c 100644 --- a/src/main/java/anticope/rejects/commands/SaveSkinCommand.java +++ b/src/main/java/anticope/rejects/commands/SaveSkinCommand.java @@ -1,14 +1,15 @@ package anticope.rejects.commands; -import com.google.gson.*; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; 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.arguments.PlayerListEntryArgumentType; +import meteordevelopment.meteorclient.commands.Command; +import meteordevelopment.meteorclient.commands.arguments.PlayerListEntryArgumentType; import meteordevelopment.meteorclient.utils.network.Http; import net.minecraft.command.CommandSource; -import net.minecraft.entity.player.PlayerEntity; import net.minecraft.text.Text; import org.apache.commons.codec.binary.Base64; import org.lwjgl.BufferUtils; @@ -32,7 +33,7 @@ public class SaveSkinCommand extends Command { private final Gson GSON = new Gson(); public SaveSkinCommand() { - super("save-skin","Download a player's skin by name.", "skin","skinsteal"); + super("save-skin", "Download a player's skin by name.", "skin", "skinsteal"); filters = BufferUtils.createPointerBuffer(1); @@ -50,9 +51,9 @@ public class SaveSkinCommand extends Command { if (path == null) IO_EXCEPTION.create(); if (path != null) { if (!path.endsWith(".png")) path += ".png"; - saveSkin(id.toString(),path); + saveSkin(id.toString(), path); } - + return SINGLE_SUCCESS; })); } diff --git a/src/main/java/anticope/rejects/commands/SeedCommand.java b/src/main/java/anticope/rejects/commands/SeedCommand.java index f5789f8..1e66390 100644 --- a/src/main/java/anticope/rejects/commands/SeedCommand.java +++ b/src/main/java/anticope/rejects/commands/SeedCommand.java @@ -1,17 +1,15 @@ package anticope.rejects.commands; import anticope.rejects.arguments.EnumArgumentType; -import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import com.mojang.brigadier.arguments.StringArgumentType; -import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; - -import net.minecraft.command.CommandSource; - -import com.seedfinding.mccore.version.MCVersion; -import meteordevelopment.meteorclient.systems.commands.Command; import anticope.rejects.utils.seeds.Seed; import anticope.rejects.utils.seeds.Seeds; +import com.mojang.brigadier.arguments.StringArgumentType; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; +import com.seedfinding.mccore.version.MCVersion; +import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.utils.Utils; +import net.minecraft.command.CommandSource; import net.minecraft.text.MutableText; import net.minecraft.text.Text; diff --git a/src/main/java/anticope/rejects/commands/ServerCommand.java b/src/main/java/anticope/rejects/commands/ServerCommand.java index 7b5aa8c..67f51aa 100644 --- a/src/main/java/anticope/rejects/commands/ServerCommand.java +++ b/src/main/java/anticope/rejects/commands/ServerCommand.java @@ -1,32 +1,27 @@ package anticope.rejects.commands; +import anticope.rejects.utils.portscanner.PScanRunner; +import anticope.rejects.utils.portscanner.PortScannerManager; +import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; - +import meteordevelopment.meteorclient.commands.Command; import net.minecraft.client.network.ServerInfo; import net.minecraft.command.CommandSource; import net.minecraft.text.ClickEvent; -import net.minecraft.text.HoverEvent; import net.minecraft.text.ClickEvent.Action; +import net.minecraft.text.HoverEvent; import net.minecraft.text.MutableText; import net.minecraft.text.Text; import net.minecraft.util.Formatting; -import anticope.rejects.utils.portscanner.PScanRunner; -import anticope.rejects.utils.portscanner.PortScannerManager; -import meteordevelopment.meteorclient.systems.commands.Command; - -import static com.mojang.brigadier.Command.SINGLE_SUCCESS; - import java.net.InetAddress; import java.net.UnknownHostException; -import java.util.Collection; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; +import java.util.*; -import com.mojang.brigadier.arguments.IntegerArgumentType; +import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; /* Ported from Cornos @@ -37,7 +32,7 @@ public class ServerCommand extends Command { private final static SimpleCommandExceptionType ADDRESS_ERROR = new SimpleCommandExceptionType(Text.literal("Couldn't obtain server address")); private final static SimpleCommandExceptionType INVALID_RANGE = new SimpleCommandExceptionType(Text.literal("Invalid range")); - private final static HashMap ports = new HashMap(); + private final static HashMap ports = new HashMap<>(); public ServerCommand() { super("server", "Prints server information"); @@ -68,7 +63,7 @@ public class ServerCommand extends Command { }))); builder.then(literal("ports").then(argument("from", IntegerArgumentType.integer(0)).then(argument("to", IntegerArgumentType.integer(1)).executes(ctx -> { scanRange(getAddress(), IntegerArgumentType.getInteger(ctx, "from"), - IntegerArgumentType.getInteger(ctx, "to")); + IntegerArgumentType.getInteger(ctx, "to")); return SINGLE_SUCCESS; })))); } @@ -80,8 +75,7 @@ public class ServerCommand extends Command { } catch (UnknownHostException e) { throw ADDRESS_ERROR.create(); } - } - else { + } else { ServerInfo server = mc.getCurrentServerEntry(); if (server == null) throw ADDRESS_ERROR.create(); try { @@ -92,7 +86,7 @@ public class ServerCommand extends Command { } } - private void scanPorts(InetAddress address, Collection port_list){ + private void scanPorts(InetAddress address, Collection port_list) { info("Started scanning %d ports", port_list.size()); PScanRunner pScanRunner = new PScanRunner(address, 5, 3, 200, port_list, scanResults -> { int open_ports = 0; @@ -113,7 +107,7 @@ public class ServerCommand extends Command { } private void scanRange(InetAddress address, int min, int max) throws CommandSyntaxException { - if (max port_list = new LinkedList<>(); for (int i = min; i <= max; i++) port_list.add(i); scanPorts(address, port_list); @@ -125,48 +119,48 @@ public class ServerCommand extends Command { text.append(ports.get(port)); if (ports.get(port).startsWith("HTTP") || ports.get(port).startsWith("FTP")) { text.setStyle(text.getStyle() - .withClickEvent(new ClickEvent( - Action.OPEN_URL, - String.format("%s://%s:%d", ports.get(port).toLowerCase(), address.getHostAddress(), port) - )) - .withHoverEvent(new HoverEvent( - HoverEvent.Action.SHOW_TEXT, - Text.literal("Open in browser") - )) + .withClickEvent(new ClickEvent( + Action.OPEN_URL, + String.format("%s://%s:%d", ports.get(port).toLowerCase(), address.getHostAddress(), port) + )) + .withHoverEvent(new HoverEvent( + HoverEvent.Action.SHOW_TEXT, + Text.literal("Open in browser") + )) ); - } else if (ports.get(port) == "DynMap") { + } else if (Objects.equals(ports.get(port), "DynMap")) { text.setStyle(text.getStyle() - .withClickEvent(new ClickEvent( - ClickEvent.Action.OPEN_URL, - String.format("http://%s:%d", address.getHostAddress(), port) - )) - .withHoverEvent(new HoverEvent( - HoverEvent.Action.SHOW_TEXT, - Text.literal("Open in browser") - )) + .withClickEvent(new ClickEvent( + ClickEvent.Action.OPEN_URL, + String.format("http://%s:%d", address.getHostAddress(), port) + )) + .withHoverEvent(new HoverEvent( + HoverEvent.Action.SHOW_TEXT, + Text.literal("Open in browser") + )) ); } else { text.setStyle(text.getStyle() - .withClickEvent(new ClickEvent( - ClickEvent.Action.COPY_TO_CLIPBOARD, - String.format("%s:%d", address.getHostAddress(), port) - )) - .withHoverEvent(new HoverEvent( - HoverEvent.Action.SHOW_TEXT, - Text.literal("Copy") - )) + .withClickEvent(new ClickEvent( + ClickEvent.Action.COPY_TO_CLIPBOARD, + String.format("%s:%d", address.getHostAddress(), port) + )) + .withHoverEvent(new HoverEvent( + HoverEvent.Action.SHOW_TEXT, + Text.literal("Copy") + )) ); } } else { text.setStyle(text.getStyle() - .withClickEvent(new ClickEvent( - ClickEvent.Action.COPY_TO_CLIPBOARD, - String.format("%s:%d", address.getHostAddress(), port) - )) - .withHoverEvent(new HoverEvent( - HoverEvent.Action.SHOW_TEXT, - Text.literal("Copy") - )) + .withClickEvent(new ClickEvent( + ClickEvent.Action.COPY_TO_CLIPBOARD, + String.format("%s:%d", address.getHostAddress(), port) + )) + .withHoverEvent(new HoverEvent( + HoverEvent.Action.SHOW_TEXT, + Text.literal("Copy") + )) ); } diff --git a/src/main/java/anticope/rejects/commands/SetBlockCommand.java b/src/main/java/anticope/rejects/commands/SetBlockCommand.java index b13f84a..48aeb81 100644 --- a/src/main/java/anticope/rejects/commands/SetBlockCommand.java +++ b/src/main/java/anticope/rejects/commands/SetBlockCommand.java @@ -2,8 +2,7 @@ package anticope.rejects.commands; import anticope.rejects.arguments.ClientPosArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; -import meteordevelopment.meteorclient.systems.commands.Commands; +import meteordevelopment.meteorclient.commands.Command; import net.minecraft.block.BlockState; import net.minecraft.command.CommandSource; import net.minecraft.command.argument.BlockStateArgument; @@ -12,6 +11,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class SetBlockCommand extends Command { public SetBlockCommand() { @@ -20,10 +20,10 @@ public class SetBlockCommand extends Command { @Override public void build(LiteralArgumentBuilder builder) { - builder.then(argument("pos", ClientPosArgumentType.pos()).then(argument("block", BlockStateArgumentType.blockState(Commands.REGISTRY_ACCESS)).executes(ctx -> { + builder.then(argument("pos", ClientPosArgumentType.pos()).then(argument("block", BlockStateArgumentType.blockState(REGISTRY_ACCESS)).executes(ctx -> { Vec3d pos = ClientPosArgumentType.getPos(ctx, "pos"); BlockState blockState = ctx.getArgument("block", BlockStateArgument.class).getBlockState(); - mc.world.setBlockState(new BlockPos((int)pos.getX(), (int)pos.getY(), (int)pos.getZ()), blockState); + mc.world.setBlockState(new BlockPos((int) pos.getX(), (int) pos.getY(), (int) pos.getZ()), blockState); return SINGLE_SUCCESS; }))); diff --git a/src/main/java/anticope/rejects/commands/SetVelocityCommand.java b/src/main/java/anticope/rejects/commands/SetVelocityCommand.java index 5a8ba26..d96779c 100644 --- a/src/main/java/anticope/rejects/commands/SetVelocityCommand.java +++ b/src/main/java/anticope/rejects/commands/SetVelocityCommand.java @@ -2,10 +2,11 @@ package anticope.rejects.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 static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class SetVelocityCommand extends Command { public SetVelocityCommand() { @@ -19,7 +20,7 @@ public class SetVelocityCommand extends Command { mc.player.setVelocity(currentVelocity.x, DoubleArgumentType.getDouble(ctx, "y"), currentVelocity.z); return SINGLE_SUCCESS; })); - + builder.then(argument("x", DoubleArgumentType.doubleArg()).then(argument("z", DoubleArgumentType.doubleArg()).executes(ctx -> { double x = DoubleArgumentType.getDouble(ctx, "x"); double z = DoubleArgumentType.getDouble(ctx, "z"); diff --git a/src/main/java/anticope/rejects/commands/TeleportCommand.java b/src/main/java/anticope/rejects/commands/TeleportCommand.java index fb0f7fd..d45f9c1 100644 --- a/src/main/java/anticope/rejects/commands/TeleportCommand.java +++ b/src/main/java/anticope/rejects/commands/TeleportCommand.java @@ -3,17 +3,18 @@ package anticope.rejects.commands; import anticope.rejects.arguments.ClientPosArgumentType; import com.mojang.brigadier.arguments.FloatArgumentType; 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.util.math.Vec3d; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class TeleportCommand extends Command { public TeleportCommand() { - super("teleport","Sends a packet to the server with new position. Allows to teleport small distances.", "tp"); + super("teleport", "Sends a packet to the server with new position. Allows to teleport small distances.", "tp"); } @Override @@ -24,7 +25,7 @@ public class TeleportCommand extends Command { return SINGLE_SUCCESS; })); - builder.then(argument("pos", ClientPosArgumentType.pos()).then(argument("yaw", FloatArgumentType.floatArg()).then(argument("pitch",FloatArgumentType.floatArg()).executes(ctx -> { + builder.then(argument("pos", ClientPosArgumentType.pos()).then(argument("yaw", FloatArgumentType.floatArg()).then(argument("pitch", FloatArgumentType.floatArg()).executes(ctx -> { Vec3d pos = ClientPosArgumentType.getPos(ctx, "pos"); float yaw = FloatArgumentType.getFloat(ctx, "yaw"); float pitch = FloatArgumentType.getFloat(ctx, "pitch"); diff --git a/src/main/java/anticope/rejects/commands/TerrainExport.java b/src/main/java/anticope/rejects/commands/TerrainExport.java index 563fca2..3debfd8 100644 --- a/src/main/java/anticope/rejects/commands/TerrainExport.java +++ b/src/main/java/anticope/rejects/commands/TerrainExport.java @@ -3,12 +3,10 @@ package anticope.rejects.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 net.minecraft.command.CommandSource; import net.minecraft.text.Text; import net.minecraft.util.math.BlockPos; - import org.lwjgl.BufferUtils; import org.lwjgl.PointerBuffer; import org.lwjgl.system.MemoryUtil; @@ -19,12 +17,12 @@ import java.io.IOException; import java.nio.ByteBuffer; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; public class TerrainExport extends Command { - private final PointerBuffer filters; - private final static SimpleCommandExceptionType IO_EXCEPTION = new SimpleCommandExceptionType(Text.literal("An IOException occurred")); + private final PointerBuffer filters; public TerrainExport() { super("terrain-export", "Export an area to the c++ terrain finder format (very popbob command)."); diff --git a/src/main/java/anticope/rejects/mixin/meteor/AccountsScreenMixin.java b/src/main/java/anticope/rejects/mixin/meteor/AccountsScreenMixin.java index 832dedc..68d1214 100644 --- a/src/main/java/anticope/rejects/mixin/meteor/AccountsScreenMixin.java +++ b/src/main/java/anticope/rejects/mixin/meteor/AccountsScreenMixin.java @@ -3,7 +3,7 @@ package anticope.rejects.mixin.meteor; import anticope.rejects.utils.accounts.AddCustomYggdrasilAccountScreen; import meteordevelopment.meteorclient.gui.GuiTheme; import meteordevelopment.meteorclient.gui.WindowScreen; -import meteordevelopment.meteorclient.gui.screens.AccountsScreen; +import meteordevelopment.meteorclient.gui.screens.accounts.AccountsScreen; import meteordevelopment.meteorclient.gui.widgets.WWidget; import meteordevelopment.meteorclient.gui.widgets.containers.WContainer; import meteordevelopment.meteorclient.gui.widgets.containers.WHorizontalList; @@ -25,7 +25,7 @@ public abstract class AccountsScreenMixin extends WindowScreen { @Shadow protected abstract void addButton(WContainer c, String text, Runnable action); - @Inject(method = "initWidgets", at = @At(value = "INVOKE", target = "Lmeteordevelopment/meteorclient/gui/screens/AccountsScreen;addButton(Lmeteordevelopment/meteorclient/gui/widgets/containers/WContainer;Ljava/lang/String;Ljava/lang/Runnable;)V", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD) + @Inject(method = "initWidgets", at = @At(value = "INVOKE", target = "Lmeteordevelopment/meteorclient/gui/screens/accounts/AccountsScreen;addButton(Lmeteordevelopment/meteorclient/gui/widgets/containers/WContainer;Ljava/lang/String;Ljava/lang/Runnable;)V", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD) private void afterAddCrackedButton(CallbackInfo info, WHorizontalList l) { addButton(l, "Yggdrasil", () -> mc.setScreen(new AddCustomYggdrasilAccountScreen(theme, (AccountsScreen) (Object) this))); } diff --git a/src/main/java/anticope/rejects/mixin/meteor/modules/AimAssistMixin.java b/src/main/java/anticope/rejects/mixin/meteor/modules/AimAssistMixin.java deleted file mode 100644 index 58a2ba2..0000000 --- a/src/main/java/anticope/rejects/mixin/meteor/modules/AimAssistMixin.java +++ /dev/null @@ -1,39 +0,0 @@ -package anticope.rejects.mixin.meteor.modules; - -import anticope.rejects.utils.RejectsUtils; -import meteordevelopment.meteorclient.settings.DoubleSetting; -import meteordevelopment.meteorclient.settings.Setting; -import meteordevelopment.meteorclient.settings.SettingGroup; -import meteordevelopment.meteorclient.systems.modules.combat.AimAssist; -import net.minecraft.entity.Entity; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(value = AimAssist.class, remap = false) -public class AimAssistMixin { - @Shadow @Final private SettingGroup sgGeneral; - - private Setting fov; - - @Inject(method = "", at = @At("TAIL")) - private void onInit(CallbackInfo info) { - fov = sgGeneral.add(new DoubleSetting.Builder() - .name("fov") - .description("Will only aim entities in the fov.") - .defaultValue(360) - .min(0) - .max(360) - .build() - ); - } - - @Inject(method = "lambda$onTick$1", at = @At(value = "RETURN", ordinal = 5), cancellable = true) - private void onCheckEntity(Entity entity, CallbackInfoReturnable info) { - info.setReturnValue(RejectsUtils.inFov(entity, fov.get())); - } -} diff --git a/src/main/java/anticope/rejects/modules/AimAssist.java b/src/main/java/anticope/rejects/modules/AimAssist.java new file mode 100644 index 0000000..4077056 --- /dev/null +++ b/src/main/java/anticope/rejects/modules/AimAssist.java @@ -0,0 +1,163 @@ +package anticope.rejects.modules; + +import anticope.rejects.MeteorRejectsAddon; +import anticope.rejects.utils.RejectsUtils; +import it.unimi.dsi.fastutil.objects.Object2BooleanMap; +import meteordevelopment.meteorclient.events.render.Render3DEvent; +import meteordevelopment.meteorclient.events.world.TickEvent; +import meteordevelopment.meteorclient.settings.*; +import meteordevelopment.meteorclient.systems.friends.Friends; +import meteordevelopment.meteorclient.systems.modules.Module; +import meteordevelopment.meteorclient.utils.Utils; +import meteordevelopment.meteorclient.utils.entity.EntityUtils; +import meteordevelopment.meteorclient.utils.entity.SortPriority; +import meteordevelopment.meteorclient.utils.entity.Target; +import meteordevelopment.meteorclient.utils.entity.TargetUtils; +import meteordevelopment.meteorclient.utils.player.PlayerUtils; +import meteordevelopment.orbit.EventHandler; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.MathHelper; +import org.joml.Vector3d; + +public class AimAssist extends Module { + private final SettingGroup sgGeneral = settings.getDefaultGroup(); + private final SettingGroup sgSpeed = settings.createGroup("Aim Speed"); + + // General + + private final Setting>> entities = sgGeneral.add(new EntityTypeListSetting.Builder() + .name("entities") + .description("Entities to aim at.") + .defaultValue(EntityType.PLAYER) + .build() + ); + + private final Setting range = sgGeneral.add(new DoubleSetting.Builder() + .name("range") + .description("The range at which an entity can be targeted.") + .defaultValue(5) + .min(0) + .build() + ); + + private final Setting fov = sgGeneral.add(new DoubleSetting.Builder() + .name("fov") + .description("Will only aim entities in the fov.") + .defaultValue(360) + .min(0) + .max(360) + .build() + ); + + private final Setting ignoreWalls = sgGeneral.add(new BoolSetting.Builder() + .name("ignore-walls") + .description("Whether or not to ignore aiming through walls.") + .defaultValue(false) + .build() + ); + + private final Setting priority = sgGeneral.add(new EnumSetting.Builder() + .name("priority") + .description("How to filter targets within range.") + .defaultValue(SortPriority.LowestHealth) + .build() + ); + + private final Setting bodyTarget = sgGeneral.add(new EnumSetting.Builder() + .name("aim-target") + .description("Which part of the entities body to aim at.") + .defaultValue(Target.Body) + .build() + ); + + // Aim Speed + + private final Setting instant = sgSpeed.add(new BoolSetting.Builder() + .name("instant-look") + .description("Instantly looks at the entity.") + .defaultValue(false) + .build() + ); + + private final Setting speed = sgSpeed.add(new DoubleSetting.Builder() + .name("speed") + .description("How fast to aim at the entity.") + .defaultValue(5) + .min(0) + .visible(() -> !instant.get()) + .build() + ); + + private final Vector3d vec3d1 = new Vector3d(); + private Entity target; + + public AimAssist() { + super(MeteorRejectsAddon.CATEGORY, "aim-assist", "Automatically aims at entities."); + } + + @EventHandler + private void onTick(TickEvent.Post event) { + target = TargetUtils.get(entity -> { + if (!entity.isAlive()) return false; + if (!PlayerUtils.isWithin(entity, range.get())) return false; + if (!ignoreWalls.get() && !PlayerUtils.canSeeEntity(entity)) return false; + if (entity == mc.player || !entities.get().getBoolean(entity.getType())) return false; + if (entity instanceof PlayerEntity) return Friends.get().shouldAttack((PlayerEntity) entity); + return RejectsUtils.inFov(entity, fov.get()); + }, priority.get()); + } + + @EventHandler + private void onRender(Render3DEvent event) { + if (target != null) aim(target, event.tickDelta, instant.get()); + } + + private void aim(Entity target, double delta, boolean instant) { + Utils.set(vec3d1, target, delta); + + switch (bodyTarget.get()) { + case Head -> vec3d1.add(0, target.getEyeHeight(target.getPose()), 0); + case Body -> vec3d1.add(0, target.getEyeHeight(target.getPose()) / 2, 0); + } + + double deltaX = vec3d1.x - mc.player.getX(); + double deltaZ = vec3d1.z - mc.player.getZ(); + double deltaY = vec3d1.y - (mc.player.getY() + mc.player.getEyeHeight(mc.player.getPose())); + + // Yaw + double angle = Math.toDegrees(Math.atan2(deltaZ, deltaX)) - 90; + double deltaAngle; + double toRotate; + + if (instant) { + mc.player.setYaw((float) angle); + } else { + deltaAngle = MathHelper.wrapDegrees(angle - mc.player.getYaw()); + toRotate = speed.get() * (deltaAngle >= 0 ? 1 : -1) * delta; + if ((toRotate >= 0 && toRotate > deltaAngle) || (toRotate < 0 && toRotate < deltaAngle)) + toRotate = deltaAngle; + mc.player.setYaw(mc.player.getYaw() + (float) toRotate); + } + + // Pitch + double idk = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ); + angle = -Math.toDegrees(Math.atan2(deltaY, idk)); + + if (instant) { + mc.player.setPitch((float) angle); + } else { + deltaAngle = MathHelper.wrapDegrees(angle - mc.player.getPitch()); + toRotate = speed.get() * (deltaAngle >= 0 ? 1 : -1) * delta; + if ((toRotate >= 0 && toRotate > deltaAngle) || (toRotate < 0 && toRotate < deltaAngle)) + toRotate = deltaAngle; + mc.player.setPitch(mc.player.getPitch() + (float) toRotate); + } + } + + @Override + public String getInfoString() { + return EntityUtils.getName(target); + } +} diff --git a/src/main/java/anticope/rejects/utils/accounts/AddCustomYggdrasilAccountScreen.java b/src/main/java/anticope/rejects/utils/accounts/AddCustomYggdrasilAccountScreen.java index 42c9ec9..4064506 100644 --- a/src/main/java/anticope/rejects/utils/accounts/AddCustomYggdrasilAccountScreen.java +++ b/src/main/java/anticope/rejects/utils/accounts/AddCustomYggdrasilAccountScreen.java @@ -1,8 +1,8 @@ package anticope.rejects.utils.accounts; import meteordevelopment.meteorclient.gui.GuiTheme; -import meteordevelopment.meteorclient.gui.screens.AccountsScreen; -import meteordevelopment.meteorclient.gui.screens.AddAccountScreen; +import meteordevelopment.meteorclient.gui.screens.accounts.AccountsScreen; +import meteordevelopment.meteorclient.gui.screens.accounts.AddAccountScreen; import meteordevelopment.meteorclient.gui.widgets.containers.WTable; import meteordevelopment.meteorclient.gui.widgets.input.WTextBox; import meteordevelopment.meteorclient.systems.accounts.Accounts; diff --git a/src/main/resources/meteor-rejects-meteor.mixins.json b/src/main/resources/meteor-rejects-meteor.mixins.json index 21e6be6..4cb4a2f 100644 --- a/src/main/resources/meteor-rejects-meteor.mixins.json +++ b/src/main/resources/meteor-rejects-meteor.mixins.json @@ -15,7 +15,6 @@ "ModuleMixin", "ModulesMixin", "WAccountMixin", - "modules.AimAssistMixin", "modules.AutoSignMixin", "modules.FlightMixin", "modules.InventoryTweaksMixin",