Package net.minecraftforge.client.event
Class RegisterClientCommandsEvent
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.client.event.RegisterClientCommandsEvent
public class RegisterClientCommandsEvent
extends net.minecraftforge.eventbus.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 cancellable, and does not have a result.
This event is fired on the main Forge event bus, only on the logical client.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
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.Methods inherited from class net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
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
-