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

Refactor azalea-protocol #190

Merged
merged 20 commits into from
Nov 28, 2024
Merged

Refactor azalea-protocol #190

merged 20 commits into from
Nov 28, 2024

Conversation

mat-1
Copy link
Collaborator

@mat-1 mat-1 commented Nov 27, 2024

Fixes some things in azalea-protocol that have been bothering me for a while:

  • Significantly simplify usage of the declare_state_packets macro (notably, packet ids are implicit now)
  • Rename packet modules from like serverbound_keep_alive_packet to s_keep_alive
  • Rename configuration and handshaking to config and handshake
  • Remove the "Packet" suffix for packet structs (since the Clientbound/Serverbound prefix already indicates that it's a packet)
  • Re-export all packet structs so they're accessible through like azalea_protocol::packets::game::ClientboundKeepAlive
  • Rename ItemSlot to ItemStack for consistency with Mojmap
  • Replace .get() with .into_variant() from a new Packet trait, which is used to avoid most uses of that function now.
  • Rename read_from/write_into to azalea_read/azalea_write and McBufReadable/McBufWritable to AzaleaRead/AzaleaWrite
  • Rename McBuf to AzBuf
  • Add an attribute #[limit(number)] so strings can be limited to a certain size.

Based on the 1.21.4 PR since it's probably going to be merged in a few days anyways (diff). Also, these changes were mostly done with a lot of find-and-replace, so I may have messed up in some places without realizing. Please let me know if you notice something I broke or if you disagree with a change.

Some changes were inspired by @EightFactorial's FrogLight project <3

Closes #173

@mat-1 mat-1 merged commit 08958c2 into main Nov 28, 2024
0 of 2 checks passed
@mat-1 mat-1 deleted the refactor-azalea-protocol branch November 28, 2024 01:31
@mat-1
Copy link
Collaborator Author

mat-1 commented Nov 28, 2024

I realized I should probably merge this sooner rather than later since it fixes a lot, so I downgraded it to 1.21.3 and merged it for that instead of waiting for 1.21.4 to release.

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.

Whisper message is wrong
1 participant