diff --git a/README.md b/README.md index 6201a41..a46f8b1 100644 --- a/README.md +++ b/README.md @@ -65,11 +65,13 @@ - `stopMomentum` ## Commands +- `.center` - `.ghost` (Ported from [AntiGhost](https://github.com/gbl/AntiGhost/blob/fabric_1_16/src/main/java/de/guntram/mcmod/antighost/AntiGhost.java)) - `.save-skin` - `.heads` - `.seed` (Taken from an [unmerged PR](https://github.com/MeteorDevelopment/meteor-client/pull/1300)) - `.setblock` +- `.set-velocity` - `.teleport` - `.terrain-export` (Ported from [BleachHack](https://github.com/BleachDrinker420/BleachHack/blob/master/BleachHack-Fabric-1.17/src/main/java/bleach/hack/command/commands/CmdTerrain.java)) - `.kick` (Ported from [LiquidBounce](https://github.com/CCBlueX/LiquidBounce/blob/nextgen/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/exploit/ModuleKick.kt)) diff --git a/src/main/java/anticope/rejects/MeteorRejectsAddon.java b/src/main/java/anticope/rejects/MeteorRejectsAddon.java index f85e30b..8a6dab2 100644 --- a/src/main/java/anticope/rejects/MeteorRejectsAddon.java +++ b/src/main/java/anticope/rejects/MeteorRejectsAddon.java @@ -72,6 +72,7 @@ public class MeteorRejectsAddon extends MeteorAddon { // Commands Commands commands = Commands.get(); + commands.add(new CenterCommand()); commands.add(new GhostCommand()); commands.add(new GiveCommand()); commands.add(new SaveSkinCommand()); @@ -81,6 +82,7 @@ public class MeteorRejectsAddon extends MeteorAddon { // commands.add(new LocateCommand()); I wish it was that simple -_- commands.add(new ServerCommand()); commands.add(new SetBlockCommand()); + commands.add(new SetVelocityCommand()); commands.add(new TeleportCommand()); commands.add(new TerrainExport()); diff --git a/src/main/java/anticope/rejects/commands/CenterCommand.java b/src/main/java/anticope/rejects/commands/CenterCommand.java new file mode 100644 index 0000000..55f0721 --- /dev/null +++ b/src/main/java/anticope/rejects/commands/CenterCommand.java @@ -0,0 +1,36 @@ +package anticope.rejects.commands; + +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import meteordevelopment.meteorclient.systems.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; + +public class CenterCommand extends Command { + public CenterCommand() { + super("center", "Centers the player on a block."); + } + + @Override + public void build(LiteralArgumentBuilder builder) { + builder.then(literal("middle").executes(context -> { + double x = MathHelper.floor(mc.player.getX()) + 0.5; + double z = MathHelper.floor(mc.player.getZ()) + 0.5; + mc.player.setPosition(x, mc.player.getY(), z); + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY(), mc.player.getZ(), mc.player.isOnGround())); + + return SINGLE_SUCCESS; + })); + + builder.then(literal("center").executes(context -> { + double x = MathHelper.floor(mc.player.getX()); + double z = MathHelper.floor(mc.player.getZ()); + mc.player.setPosition(x, mc.player.getY(), z); + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY(), mc.player.getZ(), mc.player.isOnGround())); + + return SINGLE_SUCCESS; + })); + } +} \ No newline at end of file diff --git a/src/main/java/anticope/rejects/commands/SetVelocityCommand.java b/src/main/java/anticope/rejects/commands/SetVelocityCommand.java new file mode 100644 index 0000000..5a8ba26 --- /dev/null +++ b/src/main/java/anticope/rejects/commands/SetVelocityCommand.java @@ -0,0 +1,38 @@ +package anticope.rejects.commands; + +import com.mojang.brigadier.arguments.DoubleArgumentType; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import meteordevelopment.meteorclient.systems.commands.Command; +import net.minecraft.command.CommandSource; + +import static com.mojang.brigadier.Command.SINGLE_SUCCESS; + +public class SetVelocityCommand extends Command { + public SetVelocityCommand() { + super("set-velocity", "Sets player velocity", "velocity", "vel"); + } + + @Override + public void build(LiteralArgumentBuilder builder) { + builder.then(argument("y", DoubleArgumentType.doubleArg()).executes(ctx -> { + var currentVelocity = mc.player.getVelocity(); + 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"); + mc.player.setVelocity(x, mc.player.getVelocity().y, z); + return SINGLE_SUCCESS; + }))); + + builder.then(argument("x", DoubleArgumentType.doubleArg()).then(argument("y", DoubleArgumentType.doubleArg()).then(argument("z", DoubleArgumentType.doubleArg()).executes(ctx -> { + double x = DoubleArgumentType.getDouble(ctx, "x"); + double y = DoubleArgumentType.getDouble(ctx, "y"); + double z = DoubleArgumentType.getDouble(ctx, "z"); + mc.player.setVelocity(x, y, z); + return SINGLE_SUCCESS; + })))); + } +}