Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the clisten command #598

Merged
merged 17 commits into from
Mar 7, 2024
Merged

Add the clisten command #598

merged 17 commits into from
Mar 7, 2024

Conversation

xpple
Copy link
Collaborator

@xpple xpple commented Feb 5, 2024

Adds a command that lets the user listen to incoming or outgoing packets. The command supports two outputs that are configurable through the config packetDumpMethod:

  1. REFLECTION. This output format displays the packet's data using reflection on the corresponding packet class. All fields of the packet will be recursively serialized to Text (Component) providing a nice display for the user.
  2. BYTE_BUF. This output format displays the packet's data by keeping track of the calls to the methods in PacketByteBuf (FriendlyByteBuf) when the packet is serialized into it. The resulting output will be JSON. This packet dump method is written by @Gaming32.

An example of method 1:
image
An example of method 2:
image
Another example of method 1:
image
Another example of method 2:
image

Since protocol related analysis is more natural in mojmap (wiki.vg/Protocol), everything related to this command is in that mapping as well. This necessitated the MappingsHelper class to go back and forth between mappings. Perhaps in the future we can further use this class for a basic /cmappings command.

@xpple
Copy link
Collaborator Author

xpple commented Feb 6, 2024

I confirmed that both methods work in 1.20.5 (at least currently), see xpple:clisten+1.20.5.

# Conflicts:
#	src/main/java/net/earthcomputer/clientcommands/ClientCommands.java
#	src/main/resources/mixins.clientcommands.json
@xpple
Copy link
Collaborator Author

xpple commented Feb 12, 2024

Confirmed to work after port to mojmap, no mappings issues in dev or prod.

@xpple xpple requested a review from Earthcomputer March 3, 2024 14:11
@Earthcomputer Earthcomputer merged commit 9c69919 into Earthcomputer:fabric Mar 7, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants