Skip to content

How can I register a client-side command? #1674

Discussion options

You must be logged in to vote

Note

This example has been created with Minecraft 1.20.1 in mind. Please reply if you are using a later version and the example seems outdated.

The fabric-command-api-v2 module provides the ClientCommandRegistrationCallback event that can be used to register client commands:

ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
    dispatcher.register(ClientCommandManager
        .literal("test")
        .executes(ClientCommandExample::execute));
});

Command Source

If you are familiar with standard commands, you may know that command executions are supplied an instance of ServerCommandSource that provides details about a command's executor. Likewise, client …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by haykam821
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant