meteor-client
meteor-client copied to clipboard
[Suggestion] Remove ClientPlayNetworkHandlerAccessor Methods
Describe the feature
In ServerCommand.java, you use ClientPlayNetworkHandlerAccessor in order to retrieve the server command tree. You don't need to even listen for the packet the server sends! I've been using this method to get the command tree; it's the one similar to what Minecraft uses.
public static List<String> getCommand(String preCommand) {
ClientPlayNetworkHandler h = client.player.networkHandler;
CommandDispatcher<CommandSource> cmdD = h.getCommandDispatcher();
CompletableFuture<Suggestions> sugg = cmdD.getCompletionSuggestions(cmdD.parse(preCommand, h.getCommandSource()), preCommand.length());
return sugg.join().getList()
.stream()
.map(Suggestion::getText)
.toList();
}
For your use case, it would be beneficial to pass an empty string as the method parameter to get the default command tree. Hopefully this helps!
Before submitting a suggestion
-
[X] This feature doesn't already exist in the client. (I have checked every module and their settings on the latest dev build)
-
[X] This wasn't already suggested. (I have searched suggestions on GitHub and read the FAQ)