[PR #2673] [MERGED] Server thread: patrols, sniffers, allays, trap horses and sculk see every player in the level #4528

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

📋 Pull Request Information

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

Base: main ← Head: fix/server-thread-no-local-player


📝 Commits (2)

  • e74a1fe Use every player in the level for patrols, sniffers, allays, trap horses and other world checks on the server thread
  • 64ca4d4 Merge remote-tracking branch 'origin/main' into HEAD

📊 Changes

9 files changed (+119 additions, -73 deletions)

View changed files

📝 crates/horizon-client/src/entity_nbt.rs (+10 -4)
📝 crates/horizon-client/src/game/allays.rs (+38 -3)
📝 crates/horizon-client/src/game/creatures.rs (+6 -8)
📝 crates/horizon-client/src/game/dragon.rs (+5 -8)
📝 crates/horizon-client/src/game/lan_actions.rs (+4 -1)
📝 crates/horizon-client/src/game/passengers.rs (+11 -6)
📝 crates/horizon-client/src/game/raids.rs (+10 -8)
📝 crates/horizon-client/src/game/sculk.rs (+18 -22)
📝 crates/horizon-client/src/game/sniffers.rs (+17 -13)

📄 Description

What and why

On the default single-player setup the world runs on a server thread that has no player of its own. The window is a guest of that server. A few world checks only looked at the local player, so on the server thread they never fired. They now use every player in the level (the host and the guests), as vanilla does.

  • Pillager patrols: PatrolSpawner picks from level.players(), so patrols spawn again.
  • Sniffers: digging dust, the digging and searching sounds now run when any player is within 32 blocks. The block dust is sent to the guests as a particle packet (same helper as landing dust).
  • Allays: an allay now remembers the player who gave it an item by UUID (saved with the allay) and throws the items back to that player, wherever that player is (host or guest, within 64 blocks).
  • Skeleton trap horses: spring when any alive, non-spectator player is within 10 blocks.

Other places with the same problem that I fixed:

  • Sculk sensors and shriekers never reacted to a guest standing on them. The guest's step now runs in the guest's tick, like their other sculk events.
  • A warden spawn was only blocked by the host's own box. It now checks every player.
  • Nether portal zombified piglins need a player close enough; guests now count.
  • Raids: the raid's player (bar, horn) is the first player in the level instead of the local one.
  • The difficulty that mobs see (mob_world_base) was measured at the origin with no local player. It now uses the first player's position.
  • Dragon respawn room check now sees guests standing in the room.

Not changed: the raid code still follows a single player (RaidLevel::player). Making raids and their bar fully multi-player is a bigger change.

Vanilla reference

  • PatrolSpawner.tick (level.players(), isSpectator)
  • Sniffer.tick, Sniffer.emitDiggingParticles, Sniffer.playSearchingSound (client side, so every player nearby sees them)
  • AllayAi.getLikedPlayer, Allay.mobInteract (LIKED_PLAYER memory by UUID), GoAndGiveItemsToTarget
  • SkeletonTrapGoal.canUse / Level.hasNearbyAlivePlayer
  • SculkSensorBlock.stepOn, Warden.checkSpawnObstruction, NetherPortalBlock.randomTick (anyPlayerCloseEnoughForSpawning), EnderDragonFight.respawnDragon

Self-check

cargo check -p horizon-client passes.


🔄 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/2673 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/server-thread-no-local-player` --- ### 📝 Commits (2) - [`e74a1fe`](https://github.com/horizon-rust/horizon/commit/e74a1fe46155aad64f29ac0ae5d05e151632d0a3) Use every player in the level for patrols, sniffers, allays, trap horses and other world checks on the server thread - [`64ca4d4`](https://github.com/horizon-rust/horizon/commit/64ca4d485fc0a985ba5df69c56b2e8ad0f44e8ad) Merge remote-tracking branch 'origin/main' into HEAD ### 📊 Changes **9 files changed** (+119 additions, -73 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entity_nbt.rs` (+10 -4) 📝 `crates/horizon-client/src/game/allays.rs` (+38 -3) 📝 `crates/horizon-client/src/game/creatures.rs` (+6 -8) 📝 `crates/horizon-client/src/game/dragon.rs` (+5 -8) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+4 -1) 📝 `crates/horizon-client/src/game/passengers.rs` (+11 -6) 📝 `crates/horizon-client/src/game/raids.rs` (+10 -8) 📝 `crates/horizon-client/src/game/sculk.rs` (+18 -22) 📝 `crates/horizon-client/src/game/sniffers.rs` (+17 -13) </details> ### 📄 Description ## What and why On the default single-player setup the world runs on a server thread that has no player of its own. The window is a guest of that server. A few world checks only looked at the local player, so on the server thread they never fired. They now use every player in the level (the host and the guests), as vanilla does. - Pillager patrols: `PatrolSpawner` picks from `level.players()`, so patrols spawn again. - Sniffers: digging dust, the digging and searching sounds now run when any player is within 32 blocks. The block dust is sent to the guests as a particle packet (same helper as landing dust). - Allays: an allay now remembers the player who gave it an item by UUID (saved with the allay) and throws the items back to that player, wherever that player is (host or guest, within 64 blocks). - Skeleton trap horses: spring when any alive, non-spectator player is within 10 blocks. Other places with the same problem that I fixed: - Sculk sensors and shriekers never reacted to a guest standing on them. The guest's step now runs in the guest's tick, like their other sculk events. - A warden spawn was only blocked by the host's own box. It now checks every player. - Nether portal zombified piglins need a player close enough; guests now count. - Raids: the raid's player (bar, horn) is the first player in the level instead of the local one. - The difficulty that mobs see (`mob_world_base`) was measured at the origin with no local player. It now uses the first player's position. - Dragon respawn room check now sees guests standing in the room. Not changed: the raid code still follows a single player (`RaidLevel::player`). Making raids and their bar fully multi-player is a bigger change. ## Vanilla reference - `PatrolSpawner.tick` (`level.players()`, `isSpectator`) - `Sniffer.tick`, `Sniffer.emitDiggingParticles`, `Sniffer.playSearchingSound` (client side, so every player nearby sees them) - `AllayAi.getLikedPlayer`, `Allay.mobInteract` (LIKED_PLAYER memory by UUID), `GoAndGiveItemsToTarget` - `SkeletonTrapGoal.canUse` / `Level.hasNearbyAlivePlayer` - `SculkSensorBlock.stepOn`, `Warden.checkSpawnObstruction`, `NetherPortalBlock.randomTick` (`anyPlayerCloseEnoughForSpawning`), `EnderDragonFight.respawnDragon` ## Self-check `cargo check -p horizon-client` passes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:17:49 +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#4528
No description provided.