diff --git a/src/main/java/carpet/commands/DrawCommand.java b/src/main/java/carpet/commands/DrawCommand.java index ed53dfb5..f52e16d7 100644 --- a/src/main/java/carpet/commands/DrawCommand.java +++ b/src/main/java/carpet/commands/DrawCommand.java @@ -64,7 +64,19 @@ public class DrawCommand then(argument("height",IntegerArgumentType.integer(1)). then(argument("pointing",StringArgumentType.word()).suggests( (c, b) -> suggestMatching(new String[]{"up","down"},b)). then(argument("orientation",StringArgumentType.word()).suggests( (c, b) -> suggestMatching(new String[]{"y","x","z"},b)) - .then(drawShape(c -> DrawCommand.drawPyramid(c, "circle", true))))))))); + .then(drawShape(c -> DrawCommand.drawPyramid(c, "circle", true))))))))). + then(literal("cylinder"). + then(argument("center", BlockPosArgumentType.blockPos()). + then(argument("radius", IntegerArgumentType.integer(1)). + then(argument("height",IntegerArgumentType.integer(1)). + then(argument("orientation",StringArgumentType.word()).suggests( (c, b) -> suggestMatching(new String[]{"y","x","z"},b)) + .then(drawShape(c -> DrawCommand.drawPrism(c, "circle")))))))). + then(literal("cuboid"). + then(argument("center", BlockPosArgumentType.blockPos()). + then(argument("radius", IntegerArgumentType.integer(1)). + then(argument("height",IntegerArgumentType.integer(1)). + then(argument("orientation",StringArgumentType.word()).suggests( (c, b) -> suggestMatching(new String[]{"y","x","z"},b)) + .then(drawShape(c -> DrawCommand.drawPrism(c, "square")))))))); dispatcher.register(command); } @@ -389,4 +401,55 @@ public class DrawCommand return affected; } + + private static int drawPrism(CommandContext ctx, String base){ + BlockPos pos; + double radius; + int height; + String orientation; + BlockStateArgument block; + Predicate replacement; + try + { + pos = getArg(ctx, BlockPosArgumentType::getBlockPos, "center"); + radius = getArg(ctx, IntegerArgumentType::getInteger, "radius")+0.5D; + height = getArg(ctx, IntegerArgumentType::getInteger, "height"); + orientation = getArg(ctx, StringArgumentType::getString,"orientation"); + block = getArg(ctx, BlockStateArgumentType::getBlockState, "block"); + replacement = getArg(ctx, BlockPredicateArgumentType::getBlockPredicate, "filter", true); + } + catch (ErrorHandled | CommandSyntaxException ignored) { return 0; } + + ServerCommandSource source = ctx.getSource(); + + int affected = 0; + BlockPos.Mutable mbpos = new BlockPos.Mutable(pos); + + List list = Lists.newArrayList(); + + ServerWorld world = source.getWorld(); + + CarpetSettings.impendingFillSkipUpdates = !CarpetSettings.fillUpdates; + + boolean isSquare = base.equalsIgnoreCase("square"); + + for(int i =0; i