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:
-
invalid reference
ResourceLocationArgument#getAdvancement(com.mojang.brigadier.context.CommandContext, String)
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
FieldsModifier and TypeFieldDescriptionprivate final net.minecraft.commands.CommandBuildContext
private final com.mojang.brigadier.CommandDispatcher
<net.minecraft.commands.CommandSourceStack> -
Constructor Summary
ConstructorsConstructorDescriptionRegisterClientCommandsEvent
(com.mojang.brigadier.CommandDispatcher<net.minecraft.commands.CommandSourceStack> dispatcher, net.minecraft.commands.CommandBuildContext context) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.commands.CommandBuildContext
Returns the context to build the commands for.com.mojang.brigadier.CommandDispatcher
<net.minecraft.commands.CommandSourceStack> Returns the command dispatcher for registering commands to be executed on the client.
-
Field Details
-
dispatcher
private final com.mojang.brigadier.CommandDispatcher<net.minecraft.commands.CommandSourceStack> dispatcher -
context
private final net.minecraft.commands.CommandBuildContext context
-
-
Constructor Details
-
RegisterClientCommandsEvent
@Internal public RegisterClientCommandsEvent(com.mojang.brigadier.CommandDispatcher<net.minecraft.commands.CommandSourceStack> dispatcher, net.minecraft.commands.CommandBuildContext context)
-
-
Method Details
-
getDispatcher
public com.mojang.brigadier.CommandDispatcher<net.minecraft.commands.CommandSourceStack> 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
public net.minecraft.commands.CommandBuildContext getBuildContext()Returns the context to build the commands for.- Returns:
- the context to build the commands for
-