tutorial:commands
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
tutorial:commands [2019/08/22 03:55] – [A very basic command] Change ArgumentBuilders to CommandManager i509vcb | tutorial:commands [2019/09/18 00:51] – Add Chainable commands redirect info and open section for custom arguments. i509vcb | ||
---|---|---|---|
Line 211: | Line 211: | ||
Redirects do not work in shortened aliases such as ''/ | Redirects do not work in shortened aliases such as ''/ | ||
+ | |||
+ | ==== Redirects (Chainable Commands) ==== | ||
+ | Commands such as ''/ | ||
+ | |||
+ | <code java [enable_line_numbers=" | ||
+ | LiteralCommandNode< | ||
+ | LiteralCommandNode< | ||
+ | // You can register under the same literal more than once, it will just register new parts of the branch as shown below if you register a duplicate branch an error will popup in console warning of conflicting commands but one will still work. | ||
+ | .then(literal(" | ||
+ | .then(literal(" | ||
+ | .redirect(root)) // Return to root for chaining | ||
+ | .then(literal(" | ||
+ | .redirect(root))) // Return to root for chaining | ||
+ | .then(literal(" | ||
+ | .executes(ctx -> { | ||
+ | ctx.getSource().sendFeedback(new LiteralText(" | ||
+ | return Command.SINGLE_SUCCESS; | ||
+ | }))); | ||
+ | </ | ||
+ | The redirect can also modify the CommandSource. | ||
+ | |||
+ | <code java [enable_line_numbers=" | ||
+ | .redirect(rootNode, | ||
+ | return ((ServerCommandSource) commandContext_1x.getSource()).withLookingAt(Vec3ArgumentType.getVec3(commandContext_1x, | ||
+ | }) | ||
+ | </ | ||
===== ServerCommandSource ===== | ===== ServerCommandSource ===== | ||
Line 412: | Line 438: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | ===== Custom Arguments (Coming Soon) ===== | ||
+ | |||
+ | Coming Soon | ||
===== FAQ ===== | ===== FAQ ===== |
tutorial/commands.txt · Last modified: 2024/02/23 14:22 by allen1210