Package net.neoforged.neoforge.event
Class RegisterCommandsEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.RegisterCommandsEvent
public class RegisterCommandsEvent
extends net.neoforged.bus.api.Event
Commands are rebuilt whenever
ReloadableServerResources
is recreated.
You can use this event to register your commands whenever the Commands
class in constructed.
The event is fired on the NeoForge.EVENT_BUS
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final net.minecraft.commands.CommandBuildContext
private final com.mojang.brigadier.CommandDispatcher
<net.minecraft.commands.CommandSourceStack> private final net.minecraft.commands.Commands.CommandSelection
-
Constructor Summary
ConstructorsConstructorDescriptionRegisterCommandsEvent
(com.mojang.brigadier.CommandDispatcher<net.minecraft.commands.CommandSourceStack> dispatcher, net.minecraft.commands.Commands.CommandSelection environment, net.minecraft.commands.CommandBuildContext context) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.commands.CommandBuildContext
Returns the context to build the commands for.net.minecraft.commands.Commands.CommandSelection
Returns the environment the command is being registered 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 -
environment
private final net.minecraft.commands.Commands.CommandSelection environment -
context
private final net.minecraft.commands.CommandBuildContext context
-
-
Constructor Details
-
RegisterCommandsEvent
public RegisterCommandsEvent(com.mojang.brigadier.CommandDispatcher<net.minecraft.commands.CommandSourceStack> dispatcher, net.minecraft.commands.Commands.CommandSelection environment, 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
-
getCommandSelection
public net.minecraft.commands.Commands.CommandSelection getCommandSelection()Returns the environment the command is being registered for.- Returns:
- the environment the command is being registered for
-
getBuildContext
public net.minecraft.commands.CommandBuildContext getBuildContext()Returns the context to build the commands for.- Returns:
- the context to build the commands for
-