[PR #5597] [MERGED] Dedicated server: no update_attributes before the first chunk batch on join #6377

Closed
opened 2026-11-03 06:19:28 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5597
Author: @rdbtCVS
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/5560-join-update-attributes


📝 Commits (1)

  • 06b8a7c Dedicated server: hold the join tick's dirty attributes for the next tick

📊 Changes

1 file changed (+7 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/lan/hub.rs (+7 -3)

📄 Description

🤖 Opened by rdbtCVS's AI agent (Claude Code, Claude Opus 5.5), not by rdbtCVS personally.

A joining player got a ClientboundUpdateAttributesPacket before the first chunk batch. It held block_interaction_range, entity_interaction_range and movement_speed at their default values. Vanilla sends none there, so the dedicated_server harness failed now and then.

Why. Vanilla also marks these instances dirty: AttributeMap.getInstance → AttributeSupplier.createInstance → replaceFrom → setDirty. What differs is the order:

  • The player's first ServerEntity.sendDirtyEntityData runs in ChunkMap's tracker. That is the set_entity_data health line, and no attributes follow it.
  • ServerPlayer.tick runs after it. Its updatePlayerAttributes creates the interaction-range instances, and doTick's removeFrost creates movement speed.
  • So vanilla syncs them on the next tick, after MinecraftServer.tickChildren has sent the first chunk batch.

In Horizon the guest's tick (update_player_attributes) runs before Hub::sync_player_state, so take_dirty sent them on the join tick.

Fix. sync_player_state already uses sent_health.is_none() to spot the player's first sendDirtyEntityData. On that tick it now leaves the dirty attributes alone, so they go out on the next tick as in vanilla. That's one file, +7/−3.

Fixes #5560

Tests

  • cargo clippy -p horizon-client --all-targets -- -D warnings: clean
  • cargo test -p horizon-client --lib lan::: 116 passed, 1 ignored
  • python3 tools/parity.py dedicated_server: the +play-start minecraft:update_attributes line is gone. One unrelated difference is left: in the configuration phase, the minecraft:dialog registry_data (vanilla sends the entries as known-pack references with data=Optional.empty, Horizon sends them with their data). It comes before play, so this change can't touch it. It needs its own issue.
  • There's no unit test: no Hub-with-guest fixture exists, and a guest body needs the prepared resources. The harness covers it.

🤖 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/5597 **Author:** [@rdbtCVS](https://github.com/rdbtCVS) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/5560-join-update-attributes` --- ### 📝 Commits (1) - [`06b8a7c`](https://github.com/horizon-rust/horizon/commit/06b8a7cfe3a2b7296b6e7b1ed0ad116892c3e134) Dedicated server: hold the join tick's dirty attributes for the next tick ### 📊 Changes **1 file changed** (+7 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/lan/hub.rs` (+7 -3) </details> ### 📄 Description > 🤖 Opened by rdbtCVS's AI agent (Claude Code, Claude Opus 5.5), not by rdbtCVS personally. A joining player got a `ClientboundUpdateAttributesPacket` before the first chunk batch. It held `block_interaction_range`, `entity_interaction_range` and `movement_speed` at their default values. Vanilla sends none there, so the `dedicated_server` harness failed now and then. **Why.** Vanilla also marks these instances dirty: `AttributeMap.getInstance` → `AttributeSupplier.createInstance` → `replaceFrom` → `setDirty`. What differs is the order: - The player's first `ServerEntity.sendDirtyEntityData` runs in `ChunkMap`'s tracker. That is the `set_entity_data` health line, and no attributes follow it. - `ServerPlayer.tick` runs after it. Its `updatePlayerAttributes` creates the interaction-range instances, and `doTick`'s `removeFrost` creates movement speed. - So vanilla syncs them on the next tick, after `MinecraftServer.tickChildren` has sent the first chunk batch. In Horizon the guest's tick (`update_player_attributes`) runs before `Hub::sync_player_state`, so `take_dirty` sent them on the join tick. **Fix.** `sync_player_state` already uses `sent_health.is_none()` to spot the player's first `sendDirtyEntityData`. On that tick it now leaves the dirty attributes alone, so they go out on the next tick as in vanilla. That's one file, +7/−3. Fixes #5560 ### Tests - `cargo clippy -p horizon-client --all-targets -- -D warnings`: clean - `cargo test -p horizon-client --lib lan::`: 116 passed, 1 ignored - `python3 tools/parity.py dedicated_server`: the `+play-start minecraft:update_attributes` line is gone. One unrelated difference is left: in the configuration phase, the `minecraft:dialog` `registry_data` (vanilla sends the entries as known-pack references with `data=Optional.empty`, Horizon sends them with their data). It comes before play, so this change can't touch it. It needs its own issue. - There's no unit test: no Hub-with-guest fixture exists, and a guest body needs the prepared resources. The harness covers it. 🤖 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-03 06:19:28 +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#6377
No description provided.