[PR #1845] [MERGED] Freeze server-thread players in powder snow #3811

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

📋 Pull Request Information

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

Base: main ← Head: fix/1297-server-freeze-damage


📝 Commits (2)

  • 436c2fe Freeze server-thread players in powder snow
  • b873f30 wears_freeze_immune above sync_player_body's doc comment, which it had taken over

📊 Changes

3 files changed (+37 additions, -14 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+14 -10)
📝 crates/horizon-client/src/game/lan_actions.rs (+2 -0)
📝 crates/horizon-client/src/motion.rs (+21 -4)

📄 Description

What and why

Fixes #1297.

With the server thread, a player standing in powder snow never took freezing damage. The host keeps its own copy of the player and runs MotionWorld::server_block_damage along the moves the client sent, but that path only applied block damage. It never set isInPowderSnow from powder snow's FREEZE effect and never ran the freezing part of LivingEntity.aiStep, so the server's ticksFrozen stayed at 0. The client froze and hurt itself locally, then the authoritative health overwrote that.

server_block_damage now does what the server does for that player each tick, in vanilla's order:

  • Entity.baseTick: wasInPowderSnow = isInPowderSnow, then isInPowderSnow = false;
  • applyEffectsFromBlocks: powder snow along the moves now counts for FREEZE on this path too (the slowing stays the client's, and the fire-out callback list is left to the client path);
  • LivingEntity.aiStep "freezing": ticksFrozen drops by 2 when not in powder snow (or unable to freeze), and a fully frozen player takes 1 freeze damage when tickCount % 40 == 0.

The host also sets the guest's freeze_immune from the armor it wears, from the freeze_immune_wearables tag the local player already uses (moved into a small wears_freeze_immune helper). Without that, a guest in leather armor would freeze on the host.

Vanilla reference

  • LivingEntity.aiStep (the server-only "freezing" section), Entity.baseTick (wasInPowderSnow / isInPowderSnow)
  • PowderSnowBlock.entityInside and InsideBlockEffectType.FREEZE (setIsInPowderSnow(true), then ticksFrozen + 1 capped at getTicksRequiredToFreeze when canFreeze)
  • LivingEntity.canFreeze (freeze_immune_wearables)

No new harness: there is no vanilla oracle for the server-side player tick yet. I checked the server path with a throwaway unit check: a player standing in two stacked powder snow blocks for 260 server ticks reaches 140 ticks frozen and takes freeze damage at ticks 159, 199 and 239 (20 to 17 health, the same as the issue's no-server-thread run); with freeze-immune armor it takes none. The same check fails on origin/main (health stays 20, ticks frozen 0). cargo check -p horizon-client is clean and the existing auto_jump harness, which drives the player's motion through this code, passes. I did not run the game itself in server-thread mode.

Self-check

pr_ready (tools/pr_ready.py --quick on device-591, against origin/main at bd591f985, 4 min 14 s)

Check Result
Scope ✅ 3 files, +37 −14
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ➖ no Python change
rustfmt ✅ (5 s)
clippy ✅ (16 s)
tests: horizon-client ✅ 1236 passed (3 min 48 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 ➖ 330 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 318 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🔄 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/1845 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/1297-server-freeze-damage` --- ### 📝 Commits (2) - [`436c2fe`](https://github.com/horizon-rust/horizon/commit/436c2fefb47d16e33b0e13ad2218dc731ec43afe) Freeze server-thread players in powder snow - [`b873f30`](https://github.com/horizon-rust/horizon/commit/b873f30c29b66a551b6f3744be5efa7468795c9c) wears_freeze_immune above sync_player_body's doc comment, which it had taken over ### 📊 Changes **3 files changed** (+37 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+14 -10) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+2 -0) 📝 `crates/horizon-client/src/motion.rs` (+21 -4) </details> ### 📄 Description ## What and why Fixes #1297. With the server thread, a player standing in powder snow never took freezing damage. The host keeps its own copy of the player and runs `MotionWorld::server_block_damage` along the moves the client sent, but that path only applied block damage. It never set `isInPowderSnow` from powder snow's FREEZE effect and never ran the freezing part of `LivingEntity.aiStep`, so the server's `ticksFrozen` stayed at 0. The client froze and hurt itself locally, then the authoritative health overwrote that. `server_block_damage` now does what the server does for that player each tick, in vanilla's order: - `Entity.baseTick`: `wasInPowderSnow = isInPowderSnow`, then `isInPowderSnow = false`; - `applyEffectsFromBlocks`: powder snow along the moves now counts for FREEZE on this path too (the slowing stays the client's, and the fire-out callback list is left to the client path); - `LivingEntity.aiStep` "freezing": `ticksFrozen` drops by 2 when not in powder snow (or unable to freeze), and a fully frozen player takes 1 freeze damage when `tickCount % 40 == 0`. The host also sets the guest's `freeze_immune` from the armor it wears, from the `freeze_immune_wearables` tag the local player already uses (moved into a small `wears_freeze_immune` helper). Without that, a guest in leather armor would freeze on the host. ## Vanilla reference - `LivingEntity.aiStep` (the server-only "freezing" section), `Entity.baseTick` (`wasInPowderSnow` / `isInPowderSnow`) - `PowderSnowBlock.entityInside` and `InsideBlockEffectType.FREEZE` (`setIsInPowderSnow(true)`, then `ticksFrozen + 1` capped at `getTicksRequiredToFreeze` when `canFreeze`) - `LivingEntity.canFreeze` (`freeze_immune_wearables`) No new harness: there is no vanilla oracle for the server-side player tick yet. I checked the server path with a throwaway unit check: a player standing in two stacked powder snow blocks for 260 server ticks reaches 140 ticks frozen and takes freeze damage at ticks 159, 199 and 239 (20 to 17 health, the same as the issue's no-server-thread run); with freeze-immune armor it takes none. The same check fails on `origin/main` (health stays 20, ticks frozen 0). `cargo check -p horizon-client` is clean and the existing `auto_jump` harness, which drives the player's motion through this code, passes. I did not run the game itself in server-thread mode. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on device-591, against origin/main at bd591f985, 4 min 14 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +37 −14 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ➖ no Python change | | rustfmt | ✅ (5 s) | | clippy | ✅ (16 s) | | tests: horizon-client | ✅ 1236 passed (3 min 48 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 | ➖ 330 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 318 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:12:29 +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#3811
No description provided.