User Tools

Site Tools


tutorial:commands

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:commands [2019/07/29 15:21] – [Some actual examples] Fix syntax errors i509vcbtutorial:commands [2019/07/29 19:19] – started fixing english errors but it's way too long lmao fudge
Line 1: Line 1:
 ====== Creating Commands ====== ====== Creating Commands ======
  
-Creating commands can allow a mod developer to add functionality a player can run a command to use+Creating commands can allow a mod developer to add functionality that a player can use through a command. 
 This tutorial will teach you how to register commands, and the command structure of Brigadier along with some more advanced commands structures. This tutorial will teach you how to register commands, and the command structure of Brigadier along with some more advanced commands structures.
  
Line 8: Line 8:
 If you just want to see how to register commands you've come to the right place here. If you just want to see how to register commands you've come to the right place here.
  
-Registering commands is done through ''CommandRegistryImpl'' or ''CommandRegistry'' through the ''register'' method. Doesn't matter which one you choose as they go to the same place.+Registering commands is done through ''CommandRegistry'' with the ''register'' method.
  
-The register method specifies two arguments, the dedicated flag and a consumer representing the CommandDispatcher. These methods should be placed in your mod'initalizer.+The ''register'' method specifies two arguments, the dedicated flag and a consumer representing the ''CommandDispatcher''. These methods should be placed in your mod'initializer.
  
-The dedicated flag if set to true will tell Fabric to only register the command on a DedicatedServer (if false than the command will register on both the InternalServer and DedicatedServer).+The dedicated flag if set to true will tell Fabric to only register the command on a ''DedicatedServer'' (if false than the command will register on both the ''InternalServer'' and ''DedicatedServer'').
  
 Below are a few examples of how the commands can be registered. Below are a few examples of how the commands can be registered.
  
 <code java> <code java>
-CommandRegistryImpl.INSTANCE.register(false, dispatcher -> TutorialCommands.register(dispatcher)); // All commands are registered in a single class that refrences every command.+CommandRegistry.INSTANCE.register(false, dispatcher -> TutorialCommands.register(dispatcher)); // All commands are registered in a single class that references every command.
   
 CommandRegistry.INSTANCE.register(false, dispatcher -> { // You can also just reference every single class also. There is also the alternative of just using CommandRegistry CommandRegistry.INSTANCE.register(false, dispatcher -> { // You can also just reference every single class also. There is also the alternative of just using CommandRegistry
tutorial/commands.txt · Last modified: 2024/02/23 14:22 by allen1210