I hope this works

I copy pasted above code and edited a bit to see if it works
(Btw, that is basically how I did #224)
This commit is contained in:
Nameless-123 committed 2020-04-18 18:31:18 +02:00
1 parent 08e42523ba
commit fe9ad4b297
1 file changed
+23 -17
+23 -17
View File
@@ -45,21 +45,28 @@ public class DrawCommand {
BlockStateArgumentType.getBlockState(c, "block"),
BlockPredicateArgumentType.getBlockPredicate(c,
"filter")))))))))
.then(literal("diamond").then(argument("centre", BlockPosArgumentType.blockPos())
.then(argument("radius", IntegerArgumentType.integer(1)).then(
argument("block", BlockStateArgumentType.blockState()).executes((c) -> drawDiamond(
c.getSource(), BlockPosArgumentType.getBlockPos(c, "centre"),
IntegerArgumentType.getInteger(c, "radius"),
BlockStateArgumentType.getBlockState(c, "block"), null)
.then(literal("replace").then(
argument("filter", BlockPredicateArgumentType.blockPredicate())
.executes((c) -> drawDiamond(c.getSource(),
BlockPosArgumentType.getBlockPos(c, "centre"),
IntegerArgumentType.getInteger(c, "radius"),
BlockStateArgumentType.getBlockState(c,
"block"),
BlockPredicateArgumentType.getBlockPredicate(c,
"filter"))))))))));
.then(literal("diamond").then(argument("center", BlockPosArgumentType.blockPos())
.then(argument("radius", IntegerArgumentType.integer(1))
.then(argument("block", BlockStateArgumentType.blockState())
.executes((c) -> drawDiamond(c.getSource(),
BlockPosArgumentType.getBlockPos(c, "center"),
IntegerArgumentType.getInteger(c, "radius"),
BlockStateArgumentType.getBlockState(c, "block"), null))
.then(literal("replace")
.then(argument("filter", BlockPredicateArgumentType.blockPredicate())
.executes((c) -> drawDiamond(c.getSource(),
BlockPosArgumentType.getBlockPos(c, "center"),
IntegerArgumentType.getInteger(c, "radius"),
BlockStateArgumentType.getBlockState(c, "block"),
BlockPredicateArgumentType.getBlockPredicate(c,"filter")
)
)
)
)
)
)
)
);
dispatcher.register(command);
}
@@ -169,8 +176,7 @@ public class DrawCommand {
return (int) drawDiamond(source, pos, radius, block, replacement, false);
}
private static double drawDiamond(ServerCommandSource source, BlockPos pos, int radius,
BlockStateArgument block,
private static int drawDiamond(ServerCommandSource source, BlockPos pos, int radius,BlockStateArgument block,
Predicate<CachedBlockPosition> replacement, boolean solid) {
int affected = 0;