[PR #1999] [MERGED] Show critical-hit particles on server clients #3926

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

📋 Pull Request Information

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

Base: main ← Head: t3/fix-critical-hit-particles


📝 Commits (4)

  • 5e2871d Show critical-hit particles on server clients
  • be42e67 Merge origin/main into t3/fix-critical-hit-particles
  • 70f1b71 Merge origin/main into t3/fix-critical-hit-particles
  • f70b392 Merge origin/main into t3/fix-critical-hit-particles

📊 Changes

6 files changed (+165 additions, -4 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+6 -4)
📝 crates/horizon-client/src/game/lan.rs (+31 -0)
📝 crates/horizon-client/src/game/lan_pvp.rs (+22 -0)
📝 crates/horizon-client/src/game/levels.rs (+3 -0)
📝 crates/horizon-client/src/lan/containers.rs (+15 -0)
📝 tools/lan_e2e.py (+88 -0)

📄 Description

🤖 Opened by rdbt’s AI agent (OpenCode, agentrouter/gpt-6.1-sol), not by rdbt himself.

What and why

Fixes #1898.

Critical melee damage and its sound already worked, but the tracking emitter was created only in the authoritative Game. Single player's server-thread window and LAN guests never received the critical-hit animation. In-frame mob attacks showed particles only on the host; player targets had sound feedback but no emitter.

Queue successful mob and PvP critical hits until the hub is back in place, then send the victim's Animate(CRIT) packet to the attacker and clients tracking them. Keep the queue with its level. The in-frame host draws its existing local emitter once; only connected clients receive the packet.

Vanilla reference

Inspected the prepared, pinned 26.3 bytecode with javap -c -p:

  • net.minecraft.world.entity.player.Player.attack, canCriticalAttack, and attackVisualEffects: call crit(target) only after a successful critical melee hit.
  • net.minecraft.server.level.ServerPlayer.crit (also inspected magicCrit): send ClientboundAnimatePacket(target, 1) through ServerChunkCache.sendToTrackingPlayersAndSelf(this, packet) — the recipients track the attacker, while the packet identifies the victim.
  • net.minecraft.client.multiplayer.ClientPacketListener.handleAnimate: action 1 creates the victim's CRIT tracking emitter. Horizon's existing remote_animate already implements this.

Regression: tools/lan_e2e.py --check critical-hits drives real jumps and left-click attacks, checks both clients' particle counters, confirms critical sounds and successful damage, and uses grounded hits and refused falling hits as controls. It covers host/guest attacks against zombies and players in both hosting modes (12 cases per mode).

Self-check

All launches and the self-check used fresh scratch game, launcher, XDG data and XDG config homes, with HORIZON_LAUNCHER_NO_SELF_UPDATE=1 and HORIZON_NO_AUDIO=1.

Commands (all exit 0 on the final merge head, based on 5ba4793d3):

cargo build --locked --profile fast -p horizon-client --bins
python3 tools/lan_e2e.py --bin-dir target/fast --server-thread --check critical-hits --out "$PWD/.local/critical-hits-after-server-thread"
python3 tools/lan_e2e.py --bin-dir target/fast --check critical-hits --out "$PWD/.local/critical-hits-after-in-frame"
python3 tools/pr_ready.py --quick --base origin/main

Observed crit particles (attacker / other client, counts at the regression's observation):

Attack Server thread In-frame
Host → zombie 21 / 19 23 / 25
Guest → zombie 18 / 12 16 / 12
Host → player 14 / 8 24 / 24
Guest → player 14 / 19 18 / 12

All 16 grounded/refused control cases across the two modes produced zero crit particles on both clients. Successful crits played one crit sound per client and did the expected damage (zombie health 20 → 18.575; player health 20 → 18.5).

Pre-fix baseline, separately: both suites failed against b3149d43 specifically for missing particles, despite correct crit sounds and damage. Server-thread clients produced 0 / 0 for all four successful crit cases. In-frame zombie hits produced particles only on the host (23 / 0 for the host's attack, 0 / 22 for the guest's); player targets produced 0 / 0. The first readiness invocation timed out after 20 minutes before running any checks because of the existing harness-selection slowdown; refreshing the base to include #1991 resolved it. Earlier fixture attempts used a relative screenshot output path and an attack before the server had recorded the fall; the final commands use absolute output paths and wait for the falling phase.

Broad vanilla parity is left to CI as requested.

After opening the PR, newly merged main commits conflicted only where both branches appended tests to lan_e2e.py. The merge preserves both critical-hit and replant checks. The complete quick self-check and both 12-case gameplay runs above were repeated on the final merge head.

pr_ready (tools/pr_ready.py --quick on archlinux, against origin/main at 5ba4793d3, 4 min 23 s)

Check Result
Scope ✅ 6 files, +165 −4
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ✅ 303 passed (41 s)
rustfmt ✅ (8 s)
clippy ✅ (28 s)
tests: horizon-client ✅ 1263 passed (2 min 42 s)
doc tests ✅ 0 passed (2 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 26 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, hardcore_respawn, locator_bar, lore_tooltip, mace, online_mode and 14 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Screenshots

The connected-client regression captured before/after PNGs in the implementation worktree under .local/critical-hits-{before,after}-{server-thread,in-frame}/, including both attackers' perspectives. These are returned with the agent handoff; --out reproduces the captures locally.

🤖 Generated with OpenCode (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/1999 **Author:** [@rdbtCVS](https://github.com/rdbtCVS) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `t3/fix-critical-hit-particles` --- ### 📝 Commits (4) - [`5e2871d`](https://github.com/horizon-rust/horizon/commit/5e2871dbfd892a9d50c185cb5e5cf5b17013114c) Show critical-hit particles on server clients - [`be42e67`](https://github.com/horizon-rust/horizon/commit/be42e67e9daa18fe0ce51d9df4df8c1f34b734b1) Merge origin/main into t3/fix-critical-hit-particles - [`70f1b71`](https://github.com/horizon-rust/horizon/commit/70f1b71de1e9949b2c18875c80762b28660c8a5d) Merge origin/main into t3/fix-critical-hit-particles - [`f70b392`](https://github.com/horizon-rust/horizon/commit/f70b39290da6960ed0bb62d612531b2d6e4795ea) Merge origin/main into t3/fix-critical-hit-particles ### 📊 Changes **6 files changed** (+165 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+6 -4) 📝 `crates/horizon-client/src/game/lan.rs` (+31 -0) 📝 `crates/horizon-client/src/game/lan_pvp.rs` (+22 -0) 📝 `crates/horizon-client/src/game/levels.rs` (+3 -0) 📝 `crates/horizon-client/src/lan/containers.rs` (+15 -0) 📝 `tools/lan_e2e.py` (+88 -0) </details> ### 📄 Description > 🤖 Opened by rdbt’s AI agent (OpenCode, agentrouter/gpt-6.1-sol), not by rdbt himself. ## What and why Fixes #1898. Critical melee damage and its sound already worked, but the tracking emitter was created only in the authoritative `Game`. Single player's server-thread window and LAN guests never received the critical-hit animation. In-frame mob attacks showed particles only on the host; player targets had sound feedback but no emitter. Queue successful mob and PvP critical hits until the hub is back in place, then send the victim's `Animate(CRIT)` packet to the attacker and clients tracking them. Keep the queue with its level. The in-frame host draws its existing local emitter once; only connected clients receive the packet. ## Vanilla reference Inspected the prepared, pinned **26.3 bytecode** with `javap -c -p`: - `net.minecraft.world.entity.player.Player.attack`, `canCriticalAttack`, and `attackVisualEffects`: call `crit(target)` only after a successful critical melee hit. - `net.minecraft.server.level.ServerPlayer.crit` (also inspected `magicCrit`): send `ClientboundAnimatePacket(target, 1)` through `ServerChunkCache.sendToTrackingPlayersAndSelf(this, packet)` — the recipients track the **attacker**, while the packet identifies the **victim**. - `net.minecraft.client.multiplayer.ClientPacketListener.handleAnimate`: action 1 creates the victim's `CRIT` tracking emitter. Horizon's existing `remote_animate` already implements this. Regression: `tools/lan_e2e.py --check critical-hits` drives real jumps and left-click attacks, checks both clients' particle counters, confirms critical sounds and successful damage, and uses grounded hits and refused falling hits as controls. It covers host/guest attacks against zombies and players in both hosting modes (12 cases per mode). ## Self-check All launches and the self-check used fresh scratch game, launcher, XDG data and XDG config homes, with `HORIZON_LAUNCHER_NO_SELF_UPDATE=1` and `HORIZON_NO_AUDIO=1`. Commands (all **exit 0** on the final merge head, based on `5ba4793d3`): ```sh cargo build --locked --profile fast -p horizon-client --bins python3 tools/lan_e2e.py --bin-dir target/fast --server-thread --check critical-hits --out "$PWD/.local/critical-hits-after-server-thread" python3 tools/lan_e2e.py --bin-dir target/fast --check critical-hits --out "$PWD/.local/critical-hits-after-in-frame" python3 tools/pr_ready.py --quick --base origin/main ``` Observed crit particles (attacker / other client, counts at the regression's observation): | Attack | Server thread | In-frame | | --- | --- | --- | | Host → zombie | 21 / 19 | 23 / 25 | | Guest → zombie | 18 / 12 | 16 / 12 | | Host → player | 14 / 8 | 24 / 24 | | Guest → player | 14 / 19 | 18 / 12 | All 16 grounded/refused control cases across the two modes produced **zero crit particles on both clients**. Successful crits played one crit sound per client and did the expected damage (zombie health 20 → 18.575; player health 20 → 18.5). **Pre-fix baseline, separately:** both suites failed against `b3149d43` specifically for missing particles, despite correct crit sounds and damage. Server-thread clients produced 0 / 0 for all four successful crit cases. In-frame zombie hits produced particles only on the host (23 / 0 for the host's attack, 0 / 22 for the guest's); player targets produced 0 / 0. The first readiness invocation timed out after 20 minutes before running any checks because of the existing harness-selection slowdown; refreshing the base to include #1991 resolved it. Earlier fixture attempts used a relative screenshot output path and an attack before the server had recorded the fall; the final commands use absolute output paths and wait for the falling phase. Broad vanilla parity is left to CI as requested. After opening the PR, newly merged main commits conflicted only where both branches appended tests to `lan_e2e.py`. The merge preserves both critical-hit and replant checks. The complete quick self-check and both 12-case gameplay runs above were repeated on the final merge head. **pr_ready** (`tools/pr_ready.py --quick` on archlinux, against origin/main at 5ba4793d3, 4 min 23 s) | Check | Result | | --- | --- | | Scope | ✅ 6 files, +165 −4 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ✅ 303 passed (41 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (28 s) | | tests: horizon-client | ✅ 1263 passed (2 min 42 s) | | doc tests | ✅ 0 passed (2 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 26 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, hardcore_respawn, locator_bar, lore_tooltip, mace, online_mode and 14 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | ## Screenshots The connected-client regression captured before/after PNGs in the implementation worktree under `.local/critical-hits-{before,after}-{server-thread,in-frame}/`, including both attackers' perspectives. These are returned with the agent handoff; `--out` reproduces the captures locally. 🤖 Generated with [OpenCode](https://opencode.ai) (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:13:19 +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#3926
No description provided.