[PR #1001] [MERGED] Server: a guest's projectiles are theirs (ender pearls take them) #2977

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

📋 Pull Request Information

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

Base: main ← Head: fix/guest-projectile-owner


📝 Commits (2)

  • 092bf87 Server: a guest's projectiles are theirs (ender pearls take them)
  • a480d10 docs/server.md: what remote players get right on a dedicated server now (#484)

📊 Changes

7 files changed (+103 additions, -9 deletions)

View changed files

📝 crates/horizon-client/src/game/creatures.rs (+48 -4)
📝 crates/horizon-client/src/game/lan_actions.rs (+11 -0)
📝 crates/horizon-client/src/game/lan_entities.rs (+5 -1)
📝 crates/horizon-client/src/projectiles.rs (+4 -0)
📝 docs/server.md (+1 -1)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaProtocolClient.java (+30 -1)
📝 tools/test_dedicated_server_parity.py (+4 -2)

📄 Description

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

Part of #484: "arrows don't record their owner". Stacked on #999, so it targets fix/guest-use-item-on. Merge that first; this one then retargets to main.

What was wrong

A projectile a guest shot was recorded as Who::Player, the local player. On a server that means the host, or nobody on a dedicated server. As a result:

  • Ender pearls didn't work for players on a dedicated server. On a LAN world, a guest's pearl teleported the host.
  • Clients were told the projectile had no owner: ClientboundAddEntityPacket data 0.
  • A mob hit by a guest's arrow answered to whoever the host's bookkeeping named.

What changed

  • Projectile.guest: the connection of the guest who shot it. leave_guest sets it on the projectiles added during the guest's turn whose owner is Who::Player.

  • Clients get the guest's entity id as the owner, as Projectile.getAddEntityPacket sends.

  • The hit runs as that guest (guest_projectile_hit, through as_guest):

    • their pearl teleports them, which reaches their client through the usual teleport, and hurts them 5;
    • the mob hit answers to them (mob_players, LivingEntity.lastHurtByPlayer).

    A hit on the host stays the host's.

  • ThrownEnderpearl's 5 % endermite now needs monsters to spawn (isSpawningMonsters, not on peaceful), as vanilla's does. It appears where the player was.

Tested

tools/test_dedicated_server_parity.py, a vanilla-codec client against vanilla's and Horizon's dedicated servers. Two additions:

  • each snowball's owner must be the player;
  • after the snowballs, the client throws an ender pearl straight down. It counts the teleports and records the first health after the throw. Monsters are off for that step so an endermite can't appear.

On main (with #999's case in place):

-play-use snowball owner is the player: true      (×2)
+play-use snowball owner is the player: false     (×5, before #999's fix)
-play-pearl teleported 1 time(s), health 15.0
+play-pearl teleported 1 time(s), health -1.0     (no hurt; the one "teleport" was the rotation echo #999 removes)

With #998, #999, #1000 and this PR on one integration commit: the transcripts are identical, dedicated server: 604 transcript lines identical.

Docs

docs/server.md, "Gameplay for remote players": what #484's audit found, what these PRs fix, and what's left.

Self-check

On one integration build of the four #484 PRs (#998, #999, #1000, #1001), on main at dbfaf2e0. The branches sit on ee59df13, which adds only #980's renderer change, which none of them touch:

cargo fmt --all -- --check                                ok (each branch too)
cargo clippy --workspace --all-targets -- -D warnings     ok
cargo test -p horizon-client                              ok: 920 + 77 + 15 + 2 + 2 + 2 + 1 passed, 0 failed
tools/test_dedicated_server_parity.py                     dedicated server: 604 transcript lines identical
tools/lan_e2e.py --check pvp chest crafting containers machines swings eat sign   all pass
tools/lan_e2e.py --check effects recipes projectiles                              all pass

Nothing needs Ludovic.

🤖 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/1001 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/19/2026 **Status:** ✅ Merged **Merged:** 10/19/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/guest-projectile-owner` --- ### 📝 Commits (2) - [`092bf87`](https://github.com/horizon-rust/horizon/commit/092bf87012689b9acab470d06d0a50fa250a8691) Server: a guest's projectiles are theirs (ender pearls take them) - [`a480d10`](https://github.com/horizon-rust/horizon/commit/a480d101577e6b7ce1f6aa7245712501e121dd7b) docs/server.md: what remote players get right on a dedicated server now (#484) ### 📊 Changes **7 files changed** (+103 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/creatures.rs` (+48 -4) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+11 -0) 📝 `crates/horizon-client/src/game/lan_entities.rs` (+5 -1) 📝 `crates/horizon-client/src/projectiles.rs` (+4 -0) 📝 `docs/server.md` (+1 -1) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaProtocolClient.java` (+30 -1) 📝 `tools/test_dedicated_server_parity.py` (+4 -2) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Part of #484: "arrows don't record their owner". **Stacked on #999**, so it targets `fix/guest-use-item-on`. Merge that first; this one then retargets to `main`. ## What was wrong A projectile a guest shot was recorded as `Who::Player`, the local player. On a server that means the host, or nobody on a dedicated server. As a result: - **Ender pearls didn't work for players on a dedicated server.** On a LAN world, a guest's pearl teleported the host. - Clients were told the projectile had no owner: `ClientboundAddEntityPacket` data 0. - A mob hit by a guest's arrow answered to whoever the host's bookkeeping named. ## What changed - `Projectile.guest`: the connection of the guest who shot it. `leave_guest` sets it on the projectiles added during the guest's turn whose owner is `Who::Player`. - **Clients** get the guest's entity id as the owner, as `Projectile.getAddEntityPacket` sends. - **The hit runs as that guest** (`guest_projectile_hit`, through `as_guest`): - their pearl teleports them, which reaches their client through the usual teleport, and hurts them 5; - the mob hit answers to them (`mob_players`, `LivingEntity.lastHurtByPlayer`). A hit on the host stays the host's. - `ThrownEnderpearl`'s 5 % endermite now needs monsters to spawn (`isSpawningMonsters`, not on peaceful), as vanilla's does. It appears where the player was. ## Tested `tools/test_dedicated_server_parity.py`, a vanilla-codec client against vanilla's and Horizon's dedicated servers. Two additions: - each snowball's owner must be the player; - after the snowballs, the client throws an ender pearl straight down. It counts the teleports and records the first health after the throw. Monsters are off for that step so an endermite can't appear. On main (with #999's case in place): ``` -play-use snowball owner is the player: true (×2) +play-use snowball owner is the player: false (×5, before #999's fix) -play-pearl teleported 1 time(s), health 15.0 +play-pearl teleported 1 time(s), health -1.0 (no hurt; the one "teleport" was the rotation echo #999 removes) ``` With #998, #999, #1000 and this PR on one integration commit: the transcripts are identical, `dedicated server: 604 transcript lines identical`. ## Docs `docs/server.md`, "Gameplay for remote players": what #484's audit found, what these PRs fix, and what's left. ## Self-check On one integration build of the four #484 PRs (#998, #999, #1000, #1001), on main at dbfaf2e0. The branches sit on ee59df13, which adds only #980's renderer change, which none of them touch: ``` cargo fmt --all -- --check ok (each branch too) cargo clippy --workspace --all-targets -- -D warnings ok cargo test -p horizon-client ok: 920 + 77 + 15 + 2 + 2 + 2 + 1 passed, 0 failed tools/test_dedicated_server_parity.py dedicated server: 604 transcript lines identical tools/lan_e2e.py --check pvp chest crafting containers machines swings eat sign all pass tools/lan_e2e.py --check effects recipes projectiles all pass ``` Nothing needs Ludovic. 🤖 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:00:34 +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#2977
No description provided.