类 ClientCommandHandler

java.lang.Object
net.minecraftforge.client.ClientCommandHandler

public class ClientCommandHandler extends Object
  • 字段详细资料

    • LOGGER

      private static final org.apache.logging.log4j.Logger LOGGER
    • commands

      private static com.mojang.brigadier.CommandDispatcher<CommandSourceStack> commands
  • 构造器详细资料

    • ClientCommandHandler

      public ClientCommandHandler()
  • 方法详细资料

    • init

      public static void init()
    • handleClientPlayerLogin

      private static void handleClientPlayerLogin(ClientPlayerNetworkEvent.LoggingIn event)
    • mergeServerCommands

      @Internal public static com.mojang.brigadier.CommandDispatcher<SharedSuggestionProvider> mergeServerCommands(com.mojang.brigadier.CommandDispatcher<SharedSuggestionProvider> serverCommands, CommandBuildContext buildContext)
    • getDispatcher

      public static com.mojang.brigadier.CommandDispatcher<CommandSourceStack> getDispatcher()
      返回:
      The command dispatcher for client side commands
    • getSource

      public static ClientCommandSourceStack getSource()
      返回:
      A ClientCommandSourceStack for the player in the current client
    • copy

      private static <S> void copy(com.mojang.brigadier.tree.CommandNode<S> sourceNode, com.mojang.brigadier.tree.CommandNode<S> resultNode)
      Creates a deep copy of the sourceNode while keeping the redirects referring to the old command tree
      参数:
      sourceNode - the original
      resultNode - the result
    • runCommand

      public static boolean runCommand(String command)
      Always try to execute the cached parsing of a typed command as a clientside command. Requires that the execute field of the commands to be set to send to server so that they aren't treated as client command's that do nothing. Commands.performCommand(ParseResults, String) for reference
      参数:
      command - the full command to execute, no preceding slash
      返回:
      false leaves the message to be sent to the server, while true means it should be caught before LocalPlayer#sendCommand