[PR #726] [MERGED] Guests: touching mobs push them on their own client, as in vanilla #2760

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

📋 Pull Request Information

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

Base: main ← Head: fix/guest-mob-push


📝 Commits (1)

  • 22dc3e5 Guests: touching mobs push them on their own client, as in vanilla

📊 Changes

8 files changed (+109 additions, -8 deletions)

View changed files

📝 crates/horizon-client/examples/mob_ai_probe.rs (+1 -0)
📝 crates/horizon-client/src/game/creatures.rs (+1 -0)
📝 crates/horizon-client/src/game/lan_mobs.rs (+2 -0)
📝 crates/horizon-client/src/game/remote.rs (+68 -1)
📝 crates/horizon-client/src/game/respawn_anchor.rs (+1 -1)
📝 crates/horizon-client/src/mobs.rs (+3 -0)
📝 crates/horizon-client/src/mobs/ai.rs (+8 -4)
📝 tools/lan_e2e.py (+25 -2)

📄 Description

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

Fixes #696 (part): Mob collisions, mobs can push the guest around.

Cause

A mob's collision push on a guest (MobEvent::Push from LivingEntity.pushEntities) reached the guest as SetEntityMotion, carrying the velocity of the server's copy of the guest. Nothing ever damps that velocity, so every tick of contact added to it, and each packet replaced what the guest's own client was doing. A mob that kept touching the guest threw it around. A mob that doesn't move (NoAI) didn't push it at all.

Fix

Vanilla pushes players only on their own client: EntitySelector.pushableBy lets a client push only its local player, and a server-side push of a ServerPlayer is never sent.

  • PlayerView has a new remote flag, set for guests. A mob's push_entities no longer emits the push for a remote player, but still pushes itself away from the guest.
  • A server client now pushes its own player away from every living entity it touches. This is Entity.push(Entity) with the player as this, with team collision rules. The player isn't pushed while dead, spectating or on a ladder, and spectators, bats and passengers of the same vehicle don't push.

Tests

New lan_e2e.py --check push: a NoAI cow 0.3 blocks from the guest pushes the guest west, just clear of the cow (less than 1.5 blocks).

  • Before: FAIL, "the cow did not push the guest" (moved 0.0).
  • After: PASS (moved 0.6).

Self-check

These ran on one integration commit holding the six #696 branches (#722 to #727), plus a per-branch check:

  • cargo fmt --all --check: ok on each branch.
  • cargo clippy --workspace --all-targets -- -D warnings: ok on the integration commit. cargo clippy -p horizon-client --all-targets -- -D warnings: ok on this branch alone.
  • cargo test -p horizon-client --lib: 823 passed, 0 failed, 11 ignored (integration commit).
  • tools/lan_e2e.py on the integration commit: tab, self, armour, nametags, walls, chest, crafting, damage, mobs, pvp, containers, feedback, trials, clicks, xp, sleep, push and eat all PASS.
    • hazards passes, but it leaves the guest dying in the void, so every check after it fails on the dead screen. The same happens on main, so it was run on its own.
  • Local parity (PARITY_LOCAL_JOBS=3 tools/parity.py --changed origin/main, 88 harnesses): 88 passed, 0 failed (137 min).

Overlaps

  • The open PRs #695, #697 and #700 also touch game/lan_actions.rs, lan/hub.rs, lan/guest.rs, lan/playerdata.rs and tools/lan_e2e.py; #708 touches game/remote.rs and tools/lan_e2e.py.
  • The six #696 PRs each add a check to tools/lan_e2e.py's CHECKS list, and some share game/remote.rs. Whichever merges second needs a small rebase.
  • The recipe book from #696 is #714 (perf-ticks-5), not here.

🤖 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/726 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/17/2026 **Status:** ✅ Merged **Merged:** 10/18/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/guest-mob-push` --- ### 📝 Commits (1) - [`22dc3e5`](https://github.com/horizon-rust/horizon/commit/22dc3e595404dfc0c0143da4ab72edbb82ebe31b) Guests: touching mobs push them on their own client, as in vanilla ### 📊 Changes **8 files changed** (+109 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/mob_ai_probe.rs` (+1 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+1 -0) 📝 `crates/horizon-client/src/game/lan_mobs.rs` (+2 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+68 -1) 📝 `crates/horizon-client/src/game/respawn_anchor.rs` (+1 -1) 📝 `crates/horizon-client/src/mobs.rs` (+3 -0) 📝 `crates/horizon-client/src/mobs/ai.rs` (+8 -4) 📝 `tools/lan_e2e.py` (+25 -2) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Fixes #696 (part): **Mob collisions**, mobs can push the guest around. ## Cause A mob's collision push on a guest (`MobEvent::Push` from `LivingEntity.pushEntities`) reached the guest as `SetEntityMotion`, carrying the velocity of the server's copy of the guest. Nothing ever damps that velocity, so every tick of contact added to it, and each packet replaced what the guest's own client was doing. A mob that kept touching the guest threw it around. A mob that doesn't move (NoAI) didn't push it at all. ## Fix Vanilla pushes players only on their own client: `EntitySelector.pushableBy` lets a client push only its local player, and a server-side push of a `ServerPlayer` is never sent. - `PlayerView` has a new `remote` flag, set for guests. A mob's `push_entities` no longer emits the push for a remote player, but still pushes itself away from the guest. - A server client now pushes its own player away from every living entity it touches. This is `Entity.push(Entity)` with the player as `this`, with team collision rules. The player isn't pushed while dead, spectating or on a ladder, and spectators, bats and passengers of the same vehicle don't push. ## Tests New `lan_e2e.py --check push`: a NoAI cow 0.3 blocks from the guest pushes the guest west, just clear of the cow (less than 1.5 blocks). - Before: FAIL, "the cow did not push the guest" (moved 0.0). - After: PASS (moved 0.6). ## Self-check These ran on one integration commit holding the six #696 branches (#722 to #727), plus a per-branch check: - `cargo fmt --all --check`: ok on each branch. - `cargo clippy --workspace --all-targets -- -D warnings`: ok on the integration commit. `cargo clippy -p horizon-client --all-targets -- -D warnings`: ok on this branch alone. - `cargo test -p horizon-client --lib`: 823 passed, 0 failed, 11 ignored (integration commit). - `tools/lan_e2e.py` on the integration commit: tab, self, armour, nametags, walls, chest, crafting, damage, mobs, pvp, containers, feedback, trials, clicks, xp, sleep, push and eat all PASS. - `hazards` passes, but it leaves the guest dying in the void, so every check after it fails on the dead screen. The same happens on main, so it was run on its own. - Local parity (`PARITY_LOCAL_JOBS=3 tools/parity.py --changed origin/main`, 88 harnesses): 88 passed, 0 failed (137 min). ## Overlaps - The open PRs #695, #697 and #700 also touch `game/lan_actions.rs`, `lan/hub.rs`, `lan/guest.rs`, `lan/playerdata.rs` and `tools/lan_e2e.py`; #708 touches `game/remote.rs` and `tools/lan_e2e.py`. - The six #696 PRs each add a check to `tools/lan_e2e.py`'s `CHECKS` list, and some share `game/remote.rs`. Whichever merges second needs a small rebase. - The recipe book from #696 is #714 (perf-ticks-5), not here. 🤖 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:58:50 +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#2760
No description provided.