feat: support slash-prefixed Baritone commands (e.g. /#goto)#5060
Open
CompileRider wants to merge 1 commit into
Open
feat: support slash-prefixed Baritone commands (e.g. /#goto)#5060CompileRider wants to merge 1 commit into
CompileRider wants to merge 1 commit into
Conversation
Add a sendCommand() mixin to ClientPacketListener so that when the Baritone prefix starts with '/' (like '/#'), commands typed as '/#goto 100 64 100' are intercepted before Minecraft routes them as vanilla commands. ChatScreen strips the leading '/' and calls sendCommand() instead of sendChat(), so the existing sendChat() mixin never saw these messages. The new mixin compares the command (without '/') against the prefix (without '/') and reconstructs the full message for ExampleBaritoneControl to process. Fixes cabaletta#5045
Contributor
Author
|
Yes, vanilla |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for Baritone command prefixes that start with
/(e.g./#). When the prefix is set to/#, typing/#goto 100 64 100in chat now correctly executes as a Baritone command instead of being sent to the server as an unknown vanilla command.Problem
When a user sets
prefixto a string starting with/(like/#), Minecraft'sChatScreenintercepts the message, strips the leading/, and routes it tosendCommand()instead ofsendChat(). Baritone's existing mixin only hooks intosendChat(), so slash-prefixed commands were never seen by Baritone.This is useful for privacy — if Baritone is inactive,
/#gotobecomes an unknown server command (only visible to the user), whereas#gotowould be broadcast as regular chat to all players.Solution
Added a new
@Injectmixin inMixinClientPlayNetHandlertargetingClientPacketListener.sendCommand(String)://) against the prefix (without/)/and dispatches aChatEventExampleBaritoneControlhandles it normally from thereWhat's NOT affected
#— new mixin returns early (no/prefix)/tp,/give, etc.) — don't match the Baritone prefixFORCE_COMMAND_PREFIX— goes throughsendChat(), untouchedMixinCommandSuggestionHelperTesting
Video attached demonstrating:
/#via#set prefix /#/#goto— Baritone intercepts correctly/tpstill work normallyFixes Suggest about command prefix #5045
video-compressed.mp4