new commands
This commit is contained in:
@@ -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());
|
||||
|
||||
|
||||
36
src/main/java/anticope/rejects/commands/CenterCommand.java
Normal file
36
src/main/java/anticope/rejects/commands/CenterCommand.java
Normal file
@@ -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<CommandSource> 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;
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -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<CommandSource> 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;
|
||||
}))));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user