Skip to content

Comments

serverbound configuration packet#43

Merged
hayanesuru merged 2 commits intomainfrom
configuration
Feb 19, 2026
Merged

serverbound configuration packet#43
hayanesuru merged 2 commits intomainfrom
configuration

Conversation

@hayanesuru
Copy link
Owner

@hayanesuru hayanesuru commented Feb 19, 2026

Summary by CodeRabbit

  • New Features

    • Added serverbound configuration packet handling for client initialization flow.
    • Added support for keep-alive, pong, and configuration completion packets.
    • Added known packs selection and custom click action support.
  • Bug Fixes

    • Removed hostname field character length restriction.

@coderabbitai
Copy link

coderabbitai bot commented Feb 19, 2026

📝 Walkthrough

Walkthrough

The PR renames the List enum variant from Ref to Owned, adjusts trait bounds in the Read implementation, introduces serverbound configuration packet handling with a new ConfigurationHandler trait, and adds several new packet type definitions including KeepAlive, Pong, ResourcePack, and configuration-specific structures. The handshake Intention struct's host_name field is also changed to remove its length constraint.

Changes

Cohort / File(s) Summary
List Type Refactor
haya_protocol/src/lib.rs
Renamed enum variant Ref(Box<[T]>) to Owned(Box<[T]>) with corresponding updates in Write and Read trait implementations. Updated Read trait bounds from T: Read<'a> + 'a to T: Read<'a>.
Configuration Packet Infrastructure
haya_protocol/src/serverbound.rs
Added serverbound configuration packet set with new ConfigurationHandler trait and packet type mappings for 10 new configuration packet variants including client information, cookie responses, finish configuration, and custom click actions.
Common Packet Types
haya_protocol/src/serverbound/common.rs
Introduced KeepAlive, Pong, and ResourcePack structs along with ResourcePackAction enum containing 8 action variants. Added is_terminal() method to identify terminal resource pack states.
Configuration Packet Types
haya_protocol/src/serverbound/configuration.rs
Added SelectKnownPacks struct with bounded List field, CustomClickAction struct with Ident and optional NBT payload, and AcceptCodeOfConduct unit struct for configuration phase handling.
Handshake Type Update
haya_protocol/src/serverbound/handshake.rs
Changed Intention.host_name field type from Utf8<'a, 255> to Utf8<'a>, removing the 255-character length constraint.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A List once called Ref, now Owned with pride,
New packets flow through configuration's tide,
KeepAlives echo, Pongs reply,
Host names stretch beneath the sky,
Protocol blooms in structured delight!

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch configuration

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@haya_protocol/src/serverbound/common.rs`:
- Around line 30-46: The ResourcePackAction enum is serialized as u8 but lacks
explicit discriminant values; update the enum (ResourcePackAction) to assign
explicit u8 discriminants to each variant (e.g., SuccessfullyLoaded = 0,
Declined = 1, etc.) to ensure wire stability and prevent accidental reordering;
keep the repr(u8) and existing is_terminal() method unchanged, only add explicit
= <number> values to each variant in the enum declaration.

@hayanesuru hayanesuru merged commit 9db2f6a into main Feb 19, 2026
2 checks passed
@hayanesuru hayanesuru deleted the configuration branch February 19, 2026 05:36
@coderabbitai coderabbitai bot mentioned this pull request Feb 21, 2026
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.

1 participant