Class RegisterClientCommandsEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.client.event.RegisterClientCommandsEvent
public class RegisterClientCommandsEvent
extends net.neoforged.bus.api.Event
Fired to allow mods to register client commands.
Some command arguments behave differently for the client commands dispatcher:
ResourceLocationArgument.getAdvancement(com.mojang.brigadier.context.CommandContext, String)
only returns advancements that are shown on the advancements screen.ObjectiveArgument.getObjective(com.mojang.brigadier.context.CommandContext, String)
only returns objectives that are displayed to the player.
This event is not
, and does not
invalid reference
cancellable
.invalid reference
have a result
This event is fired on the main Forge event bus, only on the logical client.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprivate final CommandBuildContext
private final com.mojang.brigadier.CommandDispatcher
<CommandSourceStack> -
Constructor Summary
ConstructorDescriptionRegisterClientCommandsEvent
(com.mojang.brigadier.CommandDispatcher<CommandSourceStack> dispatcher, CommandBuildContext context) -
Method Summary
Modifier and TypeMethodDescriptionReturns the context to build the commands for.com.mojang.brigadier.CommandDispatcher
<CommandSourceStack> Returns the command dispatcher for registering commands to be executed on the client.
-
Field Details
-
dispatcher
-
context
-
-
Constructor Details
-
RegisterClientCommandsEvent
@Internal public RegisterClientCommandsEvent(com.mojang.brigadier.CommandDispatcher<CommandSourceStack> dispatcher, CommandBuildContext context)
-
-
Method Details
-
getDispatcher
Returns the command dispatcher for registering commands to be executed on the client.- Returns:
- the command dispatcher for registering commands to be executed on the client
-
getBuildContext
Returns the context to build the commands for.- Returns:
- the context to build the commands for
-