fix: rewrite recipe book add displays for 26.1 clients#4
Conversation
Handle CLIENTBOUND_RECIPE_BOOK_ADD in LegacyPacketHandler and remap item-bearing RecipeDisplay/SlotDisplay paths so legacy clients never receive 26.2-only item ids during recipe book sync. Made-with: Cursor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdded support for handling recipe book packets in the play-phase packet dispatch. Introduced a new packet handler method that delegates to a comprehensive rewriter utility, which iterates through recipe entries and remaps their display structures and constituent items for legacy compatibility. Changes
Sequence DiagramsequenceDiagram
participant Client
participant LegacyPacketHandler
participant RecipeBookAddRewriter
participant ItemRewriter
Client->>LegacyPacketHandler: ClientboundRecipeBookAddPacket
LegacyPacketHandler->>LegacyPacketHandler: routePlayPacket() detects packet type
LegacyPacketHandler->>RecipeBookAddRewriter: rewrite(packet)
loop For each recipe entry
RecipeBookAddRewriter->>RecipeBookAddRewriter: remapDisplay(RecipeDisplay)
alt Display type matched
RecipeBookAddRewriter->>RecipeBookAddRewriter: remapSlotDisplays(slots)
loop For each slot
RecipeBookAddRewriter->>RecipeBookAddRewriter: remapSlotDisplay(slot)
RecipeBookAddRewriter->>ItemRewriter: remapItemToLegacySafe(item)
ItemRewriter-->>RecipeBookAddRewriter: remapped item
end
end
RecipeBookAddRewriter->>ItemRewriter: remapTemplate(craftingRequirements)
ItemRewriter-->>RecipeBookAddRewriter: remapped requirements
end
RecipeBookAddRewriter-->>LegacyPacketHandler: ClientboundRecipeBookAddPacket (rewritten)
LegacyPacketHandler-->>Client: rewritten packet
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Handle CLIENTBOUND_RECIPE_BOOK_ADD in LegacyPacketHandler and remap item-bearing RecipeDisplay/SlotDisplay paths so legacy clients never receive 26.2-only item ids during recipe book sync.
Summary by CodeRabbit