[PR #1148] [MERGED] Players' arrows hit other players on a served world; a guest's bow shoots #3093

Closed
opened 2026-11-02 16:01:27 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/lan-player-arrows-hit-players


📝 Commits (2)

  • 5763854 A player's arrow hurts the other players on a served world
  • ceff635 A guest draws a bow, and lets go to shoot

📊 Changes

5 files changed (+185 additions, -9 deletions)

View changed files

📝 crates/horizon-client/src/game/combat.rs (+3 -0)
📝 crates/horizon-client/src/game/creatures.rs (+24 -2)
📝 crates/horizon-client/src/game/lan_pvp.rs (+101 -1)
📝 crates/horizon-client/src/game/remote.rs (+19 -3)
📝 tools/lan_e2e.py (+38 -3)

📄 Description

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

Fixes #484

What

  • Arrows hit players. A remote player's projectiles never hit other players: a player's shots only looked for mobs and the host, a guest's flew as if the host had shot it, and a hit on a guest from another guest ran as the shooter. Now a player's arrows, snowballs and eggs meet every player, a guest's flying from that guest (Projectile.getOwner). A hit on another player runs as the victim's hurt, refused when the pvp rule is off or the teams are allies without friendly fire (ServerPlayer.canHarmPlayer), which turns the arrow back (AbstractArrow.onHitEntity). Pearls, potions and wind charges fly past players as before.
  • A guest's bow shoots. A server's client sent the bow's use but never started using the item itself, so letting go sent no RELEASE_USE_ITEM and the server kept it drawing. BowItem.use runs on the client too (startUsingItem, with an arrow or in creative); the guest now draws on its side as well and releases when the button lets go (Minecraft.handleKeybinds). With #1102 this also stops held use repeating while the bow is drawn, as vanilla.

The rest of #484

On main already: an item used on a block is used once, guests' recipe-book clicks (PlaceRecipe), status effects on guests (lan_e2e --check effects), team friendly fire (--check pvp, "guest hits teammate"). Guest kills: #1147. Left for later (FEATURES.md): fishing bobbers per guest.

Proof

tools/lan_e2e.py --check arrows (new): the guest shoots the host and the host the guest with a bow, both hurt; with pvp off, no harm (the victim may regenerate, so >=). Passes in-frame and --server-thread; --check pvp still passes.

Self-check

All 18 B5 branches merged on one integration commit over origin/main b31cb422 (Mac mini):

cargo fmt --all --check                                                  ok
set -o pipefail; cargo clippy --workspace --all-targets -- -D warnings   exit 0, no ^error
cargo test -p horizon-client                                             1087 passed, 0 failed
python3 tools/parity.py --changed origin/main                            102 passed, 0 failed (over b7390d78)
python3 tools/parity.py --changed-files <explosion.rs>                   22 passed, 0 failed (over b31cb422, after rebasing onto #1101)

tools/lan_e2e.py, full runs over b31cb422 (48 checks):

  • --server-thread: 47 passed; swings (the guest's hoe) failed after earlier checks and passes alone.
  • in-frame: 44 passed. cracks caught a guest's crack left behind when its own tick broke the block (fixed in the cracks PR; swings then cracks and a 3-break probe now pass in both modes). barter (piglin gone), swings and effects fail only after earlier checks and pass alone.
  • sign (not touched here) fails about 1 run in 4, on main too: place reports 2 ticks after the click, sometimes before the server's answer. Noted in FEATURES.md with the other flakes.

🤖 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/1148 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/lan-player-arrows-hit-players` --- ### 📝 Commits (2) - [`5763854`](https://github.com/horizon-rust/horizon/commit/5763854b0d97e2a9e3f94d216d985f20719b86ce) A player's arrow hurts the other players on a served world - [`ceff635`](https://github.com/horizon-rust/horizon/commit/ceff635615c893c104191ed9776cda9f67028462) A guest draws a bow, and lets go to shoot ### 📊 Changes **5 files changed** (+185 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/combat.rs` (+3 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+24 -2) 📝 `crates/horizon-client/src/game/lan_pvp.rs` (+101 -1) 📝 `crates/horizon-client/src/game/remote.rs` (+19 -3) 📝 `tools/lan_e2e.py` (+38 -3) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Fixes #484 ## What - **Arrows hit players.** A remote player's projectiles never hit other players: a player's shots only looked for mobs and the host, a guest's flew as if the host had shot it, and a hit on a guest from another guest ran as the shooter. Now a player's arrows, snowballs and eggs meet every player, a guest's flying from that guest (`Projectile.getOwner`). A hit on another player runs as the victim's hurt, refused when the `pvp` rule is off or the teams are allies without friendly fire (`ServerPlayer.canHarmPlayer`), which turns the arrow back (`AbstractArrow.onHitEntity`). Pearls, potions and wind charges fly past players as before. - **A guest's bow shoots.** A server's client sent the bow's use but never started using the item itself, so letting go sent no `RELEASE_USE_ITEM` and the server kept it drawing. `BowItem.use` runs on the client too (`startUsingItem`, with an arrow or in creative); the guest now draws on its side as well and releases when the button lets go (`Minecraft.handleKeybinds`). With #1102 this also stops held use repeating while the bow is drawn, as vanilla. ## The rest of #484 On main already: an item used on a block is used once, guests' recipe-book clicks (`PlaceRecipe`), status effects on guests (`lan_e2e --check effects`), team friendly fire (`--check pvp`, "guest hits teammate"). Guest kills: #1147. Left for later (FEATURES.md): fishing bobbers per guest. ## Proof `tools/lan_e2e.py --check arrows` (new): the guest shoots the host and the host the guest with a bow, both hurt; with pvp off, no harm (the victim may regenerate, so `>=`). Passes in-frame and `--server-thread`; `--check pvp` still passes. ### Self-check All 18 B5 branches merged on one integration commit over origin/main `b31cb422` (Mac mini): ``` cargo fmt --all --check ok set -o pipefail; cargo clippy --workspace --all-targets -- -D warnings exit 0, no ^error cargo test -p horizon-client 1087 passed, 0 failed python3 tools/parity.py --changed origin/main 102 passed, 0 failed (over b7390d78) python3 tools/parity.py --changed-files <explosion.rs> 22 passed, 0 failed (over b31cb422, after rebasing onto #1101) ``` `tools/lan_e2e.py`, full runs over `b31cb422` (48 checks): - `--server-thread`: 47 passed; `swings` (the guest's hoe) failed after earlier checks and passes alone. - in-frame: 44 passed. `cracks` caught a guest's crack left behind when its own tick broke the block (fixed in the cracks PR; `swings` then `cracks` and a 3-break probe now pass in both modes). `barter` (piglin gone), `swings` and `effects` fail only after earlier checks and pass alone. - `sign` (not touched here) fails about 1 run in 4, on main too: `place` reports 2 ticks after the click, sometimes before the server's answer. Noted in FEATURES.md with the other flakes. 🤖 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 16:01:27 +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#3093
No description provided.