User Tools

Site Tools


tutorial:command_redirects

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:command_redirects [2022/08/08 02:54] – [Aliases] solidblocktutorial:command_redirects [2023/02/20 05:59] – wrap the code solidblock
Line 31: Line 31:
 Commands such as ''/execute as @e[type=player] in the_end run tp ~ ~ ~'' are also possible because of redirects. Commands such as ''/execute as @e[type=player] in the_end run tp ~ ~ ~'' are also possible because of redirects.
  
-Let's first consider the vanilla ''/execute'' command. There is a node after the ''literal("execute")''. After dispatching subcommands, the dispatcher is redirected to that node (with some modifiers), making you possible to, after completing sub-command arguments, type what can be typed directly after ''/execute''. In the sub-command ''run'', the dispatcher is redirected to the rood node (''dispatcher.getRoot()''), allowing you to type another complete command after the word "''run''".+Let's first consider the vanilla ''/execute'' command. There is a node after the ''%%literal("execute")%%''. After dispatching subcommands, the dispatcher is redirected to that node (with some modifiers), making you possible to, after completing sub-command arguments, type whatever can be typed directly after ''/execute''. In the sub-command ''run'', the dispatcher is redirected to the root node (''dispatcher.getRoot()''), allowing you to type another complete command after the word "''run''".
  
 Below is an example of a chainable command: Below is an example of a chainable command:
Line 38: Line 38:
 LiteralCommandNode<ServerCommandSource> rootNode = dispatcher.register(literal("fabric_test")); LiteralCommandNode<ServerCommandSource> rootNode = dispatcher.register(literal("fabric_test"));
 LiteralCommandNode<ServerCommandSource> root1 = dispatcher.register(literal("fabric_test" LiteralCommandNode<ServerCommandSource> root1 = dispatcher.register(literal("fabric_test"
-    // 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.+    // 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("extra")     .then(literal("extra")
         .then(literal("long")         .then(literal("long")
tutorial/command_redirects.txt · Last modified: 2024/04/15 06:46 by solidblock