Package net.minecraftforge.client
Class ClientCommandHandler
java.lang.Object
net.minecraftforge.client.ClientCommandHandler
-
Field Summary
Modifier and TypeFieldDescriptionprivate static com.mojang.brigadier.CommandDispatcher<CommandSourceStack>
private static final org.apache.logging.log4j.Logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate 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 treestatic com.mojang.brigadier.CommandDispatcher<CommandSourceStack>
static ClientCommandSourceStack
private static void
static void
init()
static com.mojang.brigadier.CommandDispatcher<SharedSuggestionProvider>
mergeServerCommands
(com.mojang.brigadier.CommandDispatcher<SharedSuggestionProvider> serverCommands) static boolean
sendMessage
(String sendMessage) Always try to execute the cached parsing of client message as a command.
-
Field Details
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER -
commands
-
-
Constructor Details
-
ClientCommandHandler
public ClientCommandHandler()
-
-
Method Details
-
init
public static void init() -
handleClientPlayerLogin
-
mergeServerCommands
public static com.mojang.brigadier.CommandDispatcher<SharedSuggestionProvider> mergeServerCommands(com.mojang.brigadier.CommandDispatcher<SharedSuggestionProvider> serverCommands) -
getDispatcher
- Returns:
- The command dispatcher for client side commands
-
getSource
- Returns:
- 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- Parameters:
sourceNode
- the originalresultNode
- the result
-
sendMessage
Always try to execute the cached parsing of client message as a 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(CommandSourceStack, String)
for reference- Parameters:
sendMessage
- the chat message- Returns:
- false leaves the message to be sent to the server, true means it should be caught before
LocalPlayer.chat(String)
-