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 Details

  • Constructor Details

  • Method Details

    • getDispatcher

      public com.mojang.brigadier.CommandDispatcher<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 Commands.CommandSelection getCommandSelection()
      Returns the environment the command is being registered for.
      Returns:
      the environment the command is being registered for
    • getBuildContext

      public CommandBuildContext getBuildContext()
      Returns the context to build the commands for.
      Returns:
      the context to build the commands for