added setblock
This commit is contained in:
@@ -46,6 +46,7 @@ public class MeteorRejectsAddon extends MeteorAddon {
|
|||||||
commands.add(new BookDupeCommand());
|
commands.add(new BookDupeCommand());
|
||||||
commands.add(new GiveCommand());
|
commands.add(new GiveCommand());
|
||||||
commands.add(new SaveSkinCommand());
|
commands.add(new SaveSkinCommand());
|
||||||
|
commands.add(new SetBlockCommand());
|
||||||
commands.add(new TeleportCommand());
|
commands.add(new TeleportCommand());
|
||||||
commands.add(new TerrainExport());
|
commands.add(new TerrainExport());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class ClientPosArgumentType implements ArgumentType<Vec3d> {
|
|||||||
public ClientPosArgumentType() {
|
public ClientPosArgumentType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ClientPosArgumentType blockPos() {
|
public static ClientPosArgumentType pos() {
|
||||||
return new ClientPosArgumentType();
|
return new ClientPosArgumentType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package cloudburst.rejects.commands;
|
||||||
|
|
||||||
|
import cloudburst.rejects.arguments.ClientPosArgumentType;
|
||||||
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||||
|
import minegame159.meteorclient.systems.commands.Command;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.command.CommandSource;
|
||||||
|
import net.minecraft.command.argument.BlockStateArgument;
|
||||||
|
import net.minecraft.command.argument.BlockStateArgumentType;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
|
import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
|
||||||
|
|
||||||
|
public class SetBlockCommand extends Command {
|
||||||
|
public SetBlockCommand() {
|
||||||
|
super("setblock", "Sets client side blocks", "sblk");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
||||||
|
builder.then(argument("pos", ClientPosArgumentType.pos()).then(argument("block", BlockStateArgumentType.blockState()).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);
|
||||||
|
|
||||||
|
return SINGLE_SUCCESS;
|
||||||
|
})));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,13 +18,13 @@ public class TeleportCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
||||||
builder.then(argument("pos", ClientPosArgumentType.blockPos()).executes(ctx -> {
|
builder.then(argument("pos", ClientPosArgumentType.pos()).executes(ctx -> {
|
||||||
Vec3d pos = ClientPosArgumentType.getPos(ctx, "pos");
|
Vec3d pos = ClientPosArgumentType.getPos(ctx, "pos");
|
||||||
mc.player.updatePosition(pos.getX(), pos.getY(), pos.getZ());
|
mc.player.updatePosition(pos.getX(), pos.getY(), pos.getZ());
|
||||||
return SINGLE_SUCCESS;
|
return SINGLE_SUCCESS;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
builder.then(argument("pos", ClientPosArgumentType.blockPos()).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");
|
Vec3d pos = ClientPosArgumentType.getPos(ctx, "pos");
|
||||||
float yaw = FloatArgumentType.getFloat(ctx, "yaw");
|
float yaw = FloatArgumentType.getFloat(ctx, "yaw");
|
||||||
float pitch = FloatArgumentType.getFloat(ctx, "pitch");
|
float pitch = FloatArgumentType.getFloat(ctx, "pitch");
|
||||||
|
|||||||
Reference in New Issue
Block a user