[PR #884] [MERGED] LAN: guests see mobs flash when hit (ClientboundDamageEventPacket) #2887

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

📋 Pull Request Information

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

Base: main ← Head: fix/lan-damage-events


📝 Commits (1)

  • 0bc1968 LAN: guests see mobs flash when hit

📊 Changes

7 files changed (+121 additions, -8 deletions)

View changed files

📝 crates/horizon-client/src/game/agent.rs (+1 -1)
📝 crates/horizon-client/src/game/creatures.rs (+1 -1)
📝 crates/horizon-client/src/game/lan.rs (+24 -2)
📝 crates/horizon-client/src/game/remote.rs (+9 -0)
📝 crates/horizon-client/src/lan/containers.rs (+27 -0)
📝 crates/horizon-protocol/src/packets/play.rs (+20 -0)
📝 tools/lan_e2e.py (+39 -4)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Part of #848 (reported by Tydragon00): "the guest doesn't see the hit land, though the host does".

What

  • The host sends ClientboundDamageEventPacket where it sent EntityEvent 2. In 26.3, entity event 2 is onKineticHit; hurting goes through the damage event (LivingEntity.handleDamageEvent).
  • The packet is new in horizon-protocol (DAMAGE_EVENT, with a round-trip test). It carries:
    • the entity
    • the damage_type registry id
    • the cause entity (the guest who hit, or the host)
    • the direct entity (melee only)
  • The guest's client handles it as handleDamageEvent does: hurtTime 10 (the red flash) and a limb swing of 1.5. The host already sends the hurt sound, so the guest plays none of its own.
  • tools/lan_e2e.py xp now counts the experience the orbs add, not the total. /xp set leaves Player.totalExperience as it is (vanilla ServerPlayer.setExperiencePoints), so experience from an earlier check (the pig this PR's check kills) stays in it. The host also watches as a spectator, so orbs that an earlier check left near it don't go to it (ExperienceOrb follows the nearest player who isn't a spectator).

Tested

New check hurt in tools/lan_e2e.py: the guest hits a pig, then the host does. Both times, both sides see the pig's hurt_time above 0.

Self-check

  • cargo fmt --all -- --check: clean.
  • cargo clippy --workspace --all-targets -- -D warnings: clean on this branch.
  • cargo test -p horizon-client -p horizon-protocol: 1019 passed, 0 failed. This ran on an integration commit of the seven #848 / #803 PRs merged together.
  • tools/lan_e2e.py, on that integration build:
    • The #848 / #803 checks (pvp hurt containers machines brewing chest clicks eat eating xp swings plates time light sleep) all pass without --server-thread.
    • With --server-thread, all pass except light, which fails on main too.
    • hurt reads state fields that main's agent doesn't have. A probe of the same steps on main reproduced the bug: the guest saw no hurt flash.
  • Full tools/lan_e2e.py suite compared with main (e508a5ce binaries), with --server-thread:
    • Main fails self walls crafting sign pvp trials xp light.
    • The integration fails self walls crafting sign pvp trials. These fail on main too.
  • Full suite without --server-thread: later checks are order-dependent on main as well, and main fails clicks sleep push. After an earlier check, the guest's client and the server can disagree on where the guest stands, so later interactions are out of reach.
  • tools/parity.py --changed origin/main (95 harnesses) is running on the integration commit. The result will follow in a comment.

🤖 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/884 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/18/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/lan-damage-events` --- ### 📝 Commits (1) - [`0bc1968`](https://github.com/horizon-rust/horizon/commit/0bc19687aa29e714f03df078b425261329b40688) LAN: guests see mobs flash when hit ### 📊 Changes **7 files changed** (+121 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/agent.rs` (+1 -1) 📝 `crates/horizon-client/src/game/creatures.rs` (+1 -1) 📝 `crates/horizon-client/src/game/lan.rs` (+24 -2) 📝 `crates/horizon-client/src/game/remote.rs` (+9 -0) 📝 `crates/horizon-client/src/lan/containers.rs` (+27 -0) 📝 `crates/horizon-protocol/src/packets/play.rs` (+20 -0) 📝 `tools/lan_e2e.py` (+39 -4) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Part of #848 (reported by Tydragon00): "the guest doesn't see the hit land, though the host does". ## What - **The host sends `ClientboundDamageEventPacket`** where it sent `EntityEvent` 2. In 26.3, entity event 2 is `onKineticHit`; hurting goes through the damage event (`LivingEntity.handleDamageEvent`). - **The packet is new in horizon-protocol** (`DAMAGE_EVENT`, with a round-trip test). It carries: - the entity - the `damage_type` registry id - the cause entity (the guest who hit, or the host) - the direct entity (melee only) - **The guest's client** handles it as `handleDamageEvent` does: `hurtTime` 10 (the red flash) and a limb swing of 1.5. The host already sends the hurt sound, so the guest plays none of its own. - **`tools/lan_e2e.py` `xp`** now counts the experience the orbs add, not the total. `/xp set` leaves `Player.totalExperience` as it is (vanilla `ServerPlayer.setExperiencePoints`), so experience from an earlier check (the pig this PR's check kills) stays in it. The host also watches as a spectator, so orbs that an earlier check left near it don't go to it (`ExperienceOrb` follows the nearest player who isn't a spectator). ## Tested New check `hurt` in `tools/lan_e2e.py`: the guest hits a pig, then the host does. Both times, both sides see the pig's `hurt_time` above 0. ## Self-check - `cargo fmt --all -- --check`: clean. - `cargo clippy --workspace --all-targets -- -D warnings`: clean on this branch. - `cargo test -p horizon-client -p horizon-protocol`: 1019 passed, 0 failed. This ran on an integration commit of the seven #848 / #803 PRs merged together. - `tools/lan_e2e.py`, on that integration build: - The #848 / #803 checks (`pvp hurt containers machines brewing chest clicks eat eating xp swings plates time light sleep`) all pass without `--server-thread`. - With `--server-thread`, all pass except `light`, which fails on main too. - `hurt` reads state fields that main's agent doesn't have. A probe of the same steps on main reproduced the bug: the guest saw no hurt flash. - Full `tools/lan_e2e.py` suite compared with main (e508a5ce binaries), with `--server-thread`: - Main fails `self walls crafting sign pvp trials xp light`. - The integration fails `self walls crafting sign pvp trials`. These fail on main too. - Full suite without `--server-thread`: later checks are order-dependent on main as well, and main fails `clicks sleep push`. After an earlier check, the guest's client and the server can disagree on where the guest stands, so later interactions are out of reach. - `tools/parity.py --changed origin/main` (95 harnesses) is running on the integration commit. The result will follow in a comment. 🤖 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:59:52 +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#2887
No description provided.