[PR #1036] [MERGED] Fix creative and spectator hunger exhaustion and starvation #3006

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

📋 Pull Request Information

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

Base: main ← Head: fix/1033-creative-hunger


📝 Commits (1)

  • 8d8d8ab Fix creative and spectator hunger exhaustion and starvation

📊 Changes

6 files changed (+89 additions, -11 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+2 -2)
📝 crates/horizon-client/src/game/lan_actions.rs (+1 -3)
📝 crates/horizon-client/src/game/lan_pvp.rs (+1 -1)
📝 crates/horizon-client/src/game/potions.rs (+1 -1)
📝 crates/horizon-client/src/hunger.rs (+15 -0)
📝 crates/horizon-client/src/motion.rs (+69 -4)

📄 Description

What and why

Fixes #1033.

Creative and spectator players could accumulate exhaustion from movement, jumps and hunger effects, and the food tick dispatched starvation damage with invulnerability hard-coded off. Route player exhaustion through a shared ability guard and reject starvation for invulnerable players in the shared resident/LAN/dedicated simulation.

Keep vanilla food ticking: exhaustion accumulated before a mode switch can still be consumed, and natural regeneration continues. Switching to creative with zero food no longer damages or kills the player; returning to survival restores normal exhaustion and starvation.

Vanilla reference

Pinned 26.3 Player.causeFoodExhaustion and Player.hurtServer, inspected with tools/rea_vanilla.py; FoodData.tick inspected from the pinned bytecode. The regression creative_and_spectator_preserve_hunger_when_switching_from_survival covers zero/low/full food, repeated exhaustion, pending survival exhaustion, and switching back to survival using prepared resources.

Self-check

  • Focused regression passed with prepared 26.3 resources (cargo test -p horizon-client --lib --no-default-features creative_and_spectator_preserve_hunger_when_switching_from_survival).

pr_ready (tools/pr_ready.py on archlinux, against origin/main at defaa7cd2, 5 min 12 s)

Check Result
Scope ✅ 6 files, +72 −11
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (9 s)
clippy ✅ (1 min 35 s)
tests: horizon-client ✅ 1031 passed (3 min 28 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (no vanilla data here): CI's parity job picks the affected harnesses
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/1036 **Author:** [@rdbtCVS](https://github.com/rdbtCVS) **Created:** 10/19/2026 **Status:** ✅ Merged **Merged:** 10/21/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/1033-creative-hunger` --- ### 📝 Commits (1) - [`8d8d8ab`](https://github.com/horizon-rust/horizon/commit/8d8d8ab221a40793b87cfa6d0974181928ef661a) Fix creative and spectator hunger exhaustion and starvation ### 📊 Changes **6 files changed** (+89 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+2 -2) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+1 -3) 📝 `crates/horizon-client/src/game/lan_pvp.rs` (+1 -1) 📝 `crates/horizon-client/src/game/potions.rs` (+1 -1) 📝 `crates/horizon-client/src/hunger.rs` (+15 -0) 📝 `crates/horizon-client/src/motion.rs` (+69 -4) </details> ### 📄 Description ## What and why Fixes #1033. Creative and spectator players could accumulate exhaustion from movement, jumps and hunger effects, and the food tick dispatched starvation damage with invulnerability hard-coded off. Route player exhaustion through a shared ability guard and reject starvation for invulnerable players in the shared resident/LAN/dedicated simulation. Keep vanilla food ticking: exhaustion accumulated before a mode switch can still be consumed, and natural regeneration continues. Switching to creative with zero food no longer damages or kills the player; returning to survival restores normal exhaustion and starvation. ## Vanilla reference Pinned 26.3 `Player.causeFoodExhaustion` and `Player.hurtServer`, inspected with `tools/rea_vanilla.py`; `FoodData.tick` inspected from the pinned bytecode. The regression `creative_and_spectator_preserve_hunger_when_switching_from_survival` covers zero/low/full food, repeated exhaustion, pending survival exhaustion, and switching back to survival using prepared resources. ## Self-check - Focused regression passed with prepared 26.3 resources (`cargo test -p horizon-client --lib --no-default-features creative_and_spectator_preserve_hunger_when_switching_from_survival`). **pr_ready** (`tools/pr_ready.py` on archlinux, against origin/main at defaa7cd2, 5 min 12 s) | Check | Result | | --- | --- | | Scope | ✅ 6 files, +72 −11 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (9 s) | | clippy | ✅ (1 min 35 s) | | tests: horizon-client | ✅ 1031 passed (3 min 28 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (no vanilla data here): CI's parity job picks the affected harnesses | | 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-02 16:00:47 +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#3006
No description provided.