How can I register a client-side command? #1674
-
How can I register a command that is available to clients exclusively? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
dispatcher.register(ClientCommandManager
.literal("test")
.executes(ClientCommandExample::execute));
}); Command SourceIf you are familiar with standard commands, you may know that command executions are supplied an instance of
It can also send feedback and error messages:
Legacy RegistrationOn Minecraft 1.18.2 and earlier, the ClientCommandManager.DISPATCHER.register(ClientCommandManager
.literal("test")
.executes(ClientCommandExample::execute)); |
Beta Was this translation helpful? Give feedback.
The
fabric-command-api-v2
module provides theClientCommandRegistrationCallback
event that can be used to register client commands: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 …