[PR #2308] [MERGED] Fix recipe book settings persistence on the server #4192

Closed
opened 2026-11-03 04:15:21 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2308
Author: @rdbtCVS
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @ludovic111

Base: main ← Head: t3/recipe-book-settings-persistence


📝 Commits (2)

  • de141bb Fix recipe book settings persistence on the server
  • 42a57b8 Merge main and keep both recipe book regressions

📊 Changes

10 files changed (+236 additions, -6 deletions)

View changed files

📝 crates/horizon-client/examples/probe/recipe_book_fixture.rs (+21 -2)
📝 crates/horizon-client/src/game/agent.rs (+3 -0)
📝 crates/horizon-client/src/game/recipe_book.rs (+18 -0)
📝 crates/horizon-client/src/lan/hub.rs (+10 -0)
📝 crates/horizon-client/tests/lan_bot.rs (+69 -0)
📝 crates/horizon-protocol/src/packets/play.rs (+1 -0)
📝 crates/horizon-protocol/src/packets/recipes.rs (+27 -0)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRecipeBookOracle.java (+19 -2)
📝 tools/lan_e2e.py (+59 -0)
📝 tools/test_recipe_book_parity.py (+9 -2)

📄 Description

🤖 Opened by rdbt's AI agent (OpenCode, GPT-6.1 Sol), not by rdbt himself.

What and why

Fixes #2290.

The recipe-book buttons changed the client's open/filter flags but never sent them to the server. The default single-player server thread therefore saved the old settings and sent those back on the next login.

Send ServerboundRecipeBookChangeSettingsPacket after either toggle and handle it on the server's own player book. The existing player save/load and initial recipe-book synchronization then preserve those settings for single-player, LAN guests, and dedicated-server players.

Vanilla reference

Read the pinned 26.3 client/server bytecode with javap -c -p:

  • RecipeBookComponent.setVisible and sendUpdateSettings: send the active book's open/filter flags.
  • ServerboundRecipeBookChangeSettingsPacket: a RecipeBookType VarInt followed by two booleans.
  • ServerGamePacketListenerImpl.handleRecipeBookChangeSettingsPacket: update that player's book on the server thread, without resetting its last-action time.

Extended recipe_book parity's Java oracle and Rust probe to compare the settings packet's encoded bytes and decoded settings. Added deterministic save/load cases covering all four book types and all flag combinations. Parity execution is left to CI.

Focused validation

  • Protocol-bot regression: all four book types × four flag combinations update only the selected book, survive the player save/load path, and reject invalid book ordinals — PASS.
  • lan_e2e --in-frame --check recipe_settings — PASS.
  • lan_e2e --server-thread --check recipe_settings — PASS.

Both real-game checks use the actual book/filter buttons, Save and Quit to Title, world reopen, and guest reconnect. They assert the host keeps (open=true, filtering=true) and the guest keeps (open=false, filtering=true). All games used disposable game/launcher/XDG homes with audio and launcher self-update disabled.

Updated with current main after opening the PR, preserving #2294's independent recipe-target regression alongside the new settings regression. The self-check and both real-game checks above passed again on the updated head.

Self-check

pr_ready (tools/pr_ready.py --quick on archlinux, against origin/main at 800b91567, 3 min 16 s)

Check Result
Scope ✅ 10 files, +236 −6
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 312 passed (27 s)
rustfmt ✅ (6 s)
clippy ✅ (4 s)
tests: horizon-client, horizon-protocol ✅ 1436 passed (2 min 12 s)
doc tests ✅ 0 passed (6 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 87 affected, to run in CI (--quick): arrow, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, breaking_model, cauldron, chat_screen, command_exec, command_parse and 75 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with OpenCode using GPT-6.1 Sol (agentrouter/gpt-6.1-sol).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/2308 **Author:** [@rdbtCVS](https://github.com/rdbtCVS) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `t3/recipe-book-settings-persistence` --- ### 📝 Commits (2) - [`de141bb`](https://github.com/horizon-rust/horizon/commit/de141bb7cb6ad3260a9dff083fc7ad35dd2cf8cc) Fix recipe book settings persistence on the server - [`42a57b8`](https://github.com/horizon-rust/horizon/commit/42a57b82869cb01b5f7ddfa6d7dcd8c46061d6d6) Merge main and keep both recipe book regressions ### 📊 Changes **10 files changed** (+236 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/probe/recipe_book_fixture.rs` (+21 -2) 📝 `crates/horizon-client/src/game/agent.rs` (+3 -0) 📝 `crates/horizon-client/src/game/recipe_book.rs` (+18 -0) 📝 `crates/horizon-client/src/lan/hub.rs` (+10 -0) 📝 `crates/horizon-client/tests/lan_bot.rs` (+69 -0) 📝 `crates/horizon-protocol/src/packets/play.rs` (+1 -0) 📝 `crates/horizon-protocol/src/packets/recipes.rs` (+27 -0) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRecipeBookOracle.java` (+19 -2) 📝 `tools/lan_e2e.py` (+59 -0) 📝 `tools/test_recipe_book_parity.py` (+9 -2) </details> ### 📄 Description > 🤖 Opened by rdbt's AI agent (OpenCode, GPT-6.1 Sol), not by rdbt himself. ## What and why Fixes #2290. The recipe-book buttons changed the client's open/filter flags but never sent them to the server. The default single-player server thread therefore saved the old settings and sent those back on the next login. Send `ServerboundRecipeBookChangeSettingsPacket` after either toggle and handle it on the server's own player book. The existing player save/load and initial recipe-book synchronization then preserve those settings for single-player, LAN guests, and dedicated-server players. ## Vanilla reference Read the pinned 26.3 client/server bytecode with `javap -c -p`: - `RecipeBookComponent.setVisible` and `sendUpdateSettings`: send the active book's open/filter flags. - `ServerboundRecipeBookChangeSettingsPacket`: a `RecipeBookType` VarInt followed by two booleans. - `ServerGamePacketListenerImpl.handleRecipeBookChangeSettingsPacket`: update that player's book on the server thread, without resetting its last-action time. Extended `recipe_book` parity's Java oracle and Rust probe to compare the settings packet's encoded bytes and decoded settings. Added deterministic save/load cases covering all four book types and all flag combinations. Parity execution is left to CI. ## Focused validation - Protocol-bot regression: all four book types × four flag combinations update only the selected book, survive the player save/load path, and reject invalid book ordinals — **PASS**. - `lan_e2e --in-frame --check recipe_settings` — **PASS**. - `lan_e2e --server-thread --check recipe_settings` — **PASS**. Both real-game checks use the actual book/filter buttons, Save and Quit to Title, world reopen, and guest reconnect. They assert the host keeps `(open=true, filtering=true)` and the guest keeps `(open=false, filtering=true)`. All games used disposable game/launcher/XDG homes with audio and launcher self-update disabled. Updated with current main after opening the PR, preserving #2294's independent recipe-target regression alongside the new settings regression. The self-check and both real-game checks above passed again on the updated head. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on archlinux, against origin/main at 800b91567, 3 min 16 s) | Check | Result | | --- | --- | | Scope | ✅ 10 files, +236 −6 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 312 passed (27 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ (4 s) | | tests: horizon-client, horizon-protocol | ✅ 1436 passed (2 min 12 s) | | doc tests | ✅ 0 passed (6 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 87 affected, to run in CI (--quick): arrow, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, breaking_model, cauldron, chat_screen, command_exec, command_parse and 75 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [OpenCode](https://opencode.ai) using GPT-6.1 Sol (`agentrouter/gpt-6.1-sol`). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:15:21 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#4192
No description provided.