[PR #655] [MERGED] Network client: apply block entity data, difficulty, spawn, chunk centre, tick rate and animations from the server #2702

Closed
opened 2026-11-02 15:58:23 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/655
Author: @ludovic111
Created: 10/17/2026
Status: ✅ Merged
Merged: 10/17/2026
Merged by: @ludovic111

Base: main ← Head: fix/client-server-packets


📝 Commits (3)

  • cfcf69f Network client: apply the block entity data, difficulty, spawn, chunk centre, tick rate, animations and server data the server sends
  • cc8249d Merge remote-tracking branch 'origin/main' into fix/client-server-packets
  • aea0dc4 Network client: keep #656's ChangeDifficulty handler

📊 Changes

4 files changed (+244 additions, -9 deletions)

View changed files

📝 crates/horizon-client/src/clock.rs (+39 -1)
📝 crates/horizon-client/src/game/remote.rs (+182 -8)
📝 crates/horizon-client/src/multiplayer.rs (+8 -0)
📝 crates/horizon-protocol/src/packets/play.rs (+15 -0)

📄 Description

What and why

Gap 5 of making single player's server thread the default (#495, #494). With --server-thread the window is the server's client, and it dropped packets the in-frame game never needed. This PR applies them as vanilla's ClientPacketListener does. It helps every multiplayer connection too.

  • Block entity data (handleBlockEntityData, and the block entities in chunk packets, LevelChunk.replaceWithPacketData): the block entity of the packet's type loads the tag. Sign text and spawner data from the server now show. Before this, a sign placed or saved on the server showed blank on the window.
  • Difficulty (handleChangeDifficulty): the level data's difficulty and its lock.
  • Default spawn (handleSetSpawn): the respawn data that spawn compasses point at.
  • Chunk cache centre (handleSetChunkCacheCenter, updateViewRadius): ClientChunkCache.Storage's view centre. A column outside the storage (the server's radius, at least 2, plus 3) is ignored ("Ignoring chunk since it's not in the view range") or dropped when the storage moves or shrinks. A new dimension starts a new storage centred on 0, 0.
  • Animate (handleAnimate, 26.3 ids): 0 wakes the player up, 1 and 2 start the CRIT and ENCHANTED_HIT tracking emitters on the entity.
  • Tick rate (handleTickingState, handleTickingStep; both packets are new in horizon-protocol): the level's TickRateManager. A frozen level holds its time and its non-player entities (isEntityFrozen). The server's rate only ever slows the client's timer, as Minecraft.getTickTargetMillis does (FixedStep::client). The integrated in-frame loop keeps running at the rate. Leaving a server resets the clock.
  • Server data (handleServerData): a valid 64x64 icon replaces the one the server list entry keeps (ServerList.saveSingleServer). Single player has no entry.

Still not applied (for later PRs in this series):

  • BlockDestruction: the crumbling overlay draws one breaking stage (the local player's). Other breakers' cracks need the renderer to take a sprite per block (perf-gpu's area). In single player only mobs breaking doors send it.
  • The recipe book packets (RecipeBookAdd/Remove/Settings), the command tree (Commands) and advancements/statistics: separate PRs, since each needs its server side too.

Checks

  • cargo fmt --all --check: ok
  • cargo clippy --workspace --all-targets -- -D warnings: ok
  • cargo test -p horizon-client --lib: 788 passed, 0 failed. New: a_servers_tick_rate_only_slows_its_client_down. horizon-protocol: 49 passed, with round trips of the two new packets.
  • By hand on the Mac mini (offscreen, --server-thread): a sign saved by an in-frame session shows its text when the world reopens on the server thread (chunk packet). A sign set with /setblock while connected shows at once (BlockEntityData). /tick rate 10 gives 10 client ticks a second. During /tick freeze, day_time stays at 650. /difficulty hard gives its feedback. No "Ignoring chunk" warnings.
  • Local parity: run once on the integration commit of this series (results to follow in a comment).

skip-release until single player uses the server thread by default.

🤖 Generated with Claude Code


🔄 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/655 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/17/2026 **Status:** ✅ Merged **Merged:** 10/17/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/client-server-packets` --- ### 📝 Commits (3) - [`cfcf69f`](https://github.com/horizon-rust/horizon/commit/cfcf69f0b98c42a8fc41e336fd6d7ec1c9328b41) Network client: apply the block entity data, difficulty, spawn, chunk centre, tick rate, animations and server data the server sends - [`cc8249d`](https://github.com/horizon-rust/horizon/commit/cc8249d2ce37ebbea03bf80928c2505057922454) Merge remote-tracking branch 'origin/main' into fix/client-server-packets - [`aea0dc4`](https://github.com/horizon-rust/horizon/commit/aea0dc4c93216951ff793dc948d0a601ead2dd69) Network client: keep #656's ChangeDifficulty handler ### 📊 Changes **4 files changed** (+244 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/clock.rs` (+39 -1) 📝 `crates/horizon-client/src/game/remote.rs` (+182 -8) 📝 `crates/horizon-client/src/multiplayer.rs` (+8 -0) 📝 `crates/horizon-protocol/src/packets/play.rs` (+15 -0) </details> ### 📄 Description ## What and why Gap 5 of making single player's server thread the default (#495, #494). With `--server-thread` the window is the server's client, and it dropped packets the in-frame game never needed. This PR applies them as vanilla's `ClientPacketListener` does. It helps every multiplayer connection too. - **Block entity data** (`handleBlockEntityData`, and the block entities in chunk packets, `LevelChunk.replaceWithPacketData`): the block entity of the packet's type loads the tag. Sign text and spawner data from the server now show. Before this, a sign placed or saved on the server showed blank on the window. - **Difficulty** (`handleChangeDifficulty`): the level data's difficulty and its lock. - **Default spawn** (`handleSetSpawn`): the respawn data that spawn compasses point at. - **Chunk cache centre** (`handleSetChunkCacheCenter`, `updateViewRadius`): `ClientChunkCache.Storage`'s view centre. A column outside the storage (the server's radius, at least 2, plus 3) is ignored ("Ignoring chunk since it's not in the view range") or dropped when the storage moves or shrinks. A new dimension starts a new storage centred on 0, 0. - **Animate** (`handleAnimate`, 26.3 ids): 0 wakes the player up, 1 and 2 start the `CRIT` and `ENCHANTED_HIT` tracking emitters on the entity. - **Tick rate** (`handleTickingState`, `handleTickingStep`; both packets are new in `horizon-protocol`): the level's `TickRateManager`. A frozen level holds its time and its non-player entities (`isEntityFrozen`). The server's rate only ever slows the client's timer, as `Minecraft.getTickTargetMillis` does (`FixedStep::client`). The integrated in-frame loop keeps running at the rate. Leaving a server resets the clock. - **Server data** (`handleServerData`): a valid 64x64 icon replaces the one the server list entry keeps (`ServerList.saveSingleServer`). Single player has no entry. Still not applied (for later PRs in this series): - `BlockDestruction`: the crumbling overlay draws one breaking stage (the local player's). Other breakers' cracks need the renderer to take a sprite per block (perf-gpu's area). In single player only mobs breaking doors send it. - The recipe book packets (`RecipeBookAdd/Remove/Settings`), the command tree (`Commands`) and advancements/statistics: separate PRs, since each needs its server side too. ## Checks - `cargo fmt --all --check`: ok - `cargo clippy --workspace --all-targets -- -D warnings`: ok - `cargo test -p horizon-client --lib`: 788 passed, 0 failed. New: `a_servers_tick_rate_only_slows_its_client_down`. `horizon-protocol`: 49 passed, with round trips of the two new packets. - By hand on the Mac mini (offscreen, `--server-thread`): a sign saved by an in-frame session shows its text when the world reopens on the server thread (chunk packet). A sign set with `/setblock` while connected shows at once (`BlockEntityData`). `/tick rate 10` gives 10 client ticks a second. During `/tick freeze`, `day_time` stays at 650. `/difficulty hard` gives its feedback. No "Ignoring chunk" warnings. - Local parity: run once on the integration commit of this series (results to follow in a comment). `skip-release` until single player uses the server thread by default. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:58:23 +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#2702
No description provided.