[PR #773] [MERGED] fix(game): allow always-edible food when full and apply consume effects (#750) #2797

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

📋 Pull Request Information

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

Base: main ← Head: fix/always-edible-food-effects


📝 Commits (2)

  • 9779eb7 fix(game): allow always-edible food when full and apply consume effects (#750)
  • ecdff7a fix(game): apply absorption effect attribute modifiers and health (#750)

📊 Changes

6 files changed (+245 additions, -16 deletions)

View changed files

📝 crates/horizon-client/src/effects.rs (+31 -0)
📝 crates/horizon-client/src/game.rs (+61 -8)
📝 crates/horizon-client/src/game/commands/effects.rs (+3 -1)
📝 crates/horizon-client/src/game/potions.rs (+25 -4)
📝 crates/horizon-client/src/game/totem.rs (+1 -3)
📝 crates/horizon-client/src/items.rs (+124 -0)

📄 Description

What and why

Fixes #750.

In vanilla, items with can_always_eat: true (such as Golden Apples, Enchanted Golden Apples, Chorus Fruit, Honey Bottles) can always be consumed regardless of the player's hunger level (even when hunger is 20/20). In Horizon:

  1. start_eating rejected consumption when hunger was full because it did not check info.can_always_eat.
  2. When consumption completed, on_consume_effects defined in the minecraft:consumable component were not applied to the player.
  3. The absorption effect was missing from PlayerEffects::modifiers(), preventing minecraft:max_absorption attribute modifiers from being registered and absorption health / yellow hearts from being displayed.

This change:

  • Parses can_always_eat and consume_effects from minecraft:food and minecraft:consumable in ItemInfo.
  • Allows consumption when info.can_always_eat is true even if hunger is at 20.
  • Applies the consumable's effects (e.g. Regeneration, Absorption, Resistance, Fire Resistance for golden apples) upon consumption finish.
  • Adds minecraft:max_absorption attribute modifier for absorption in PlayerEffects::modifiers() and synchronizes absorption points with PlayerMotion::set_health.

Vanilla reference

Follows vanilla Player.canEat(boolean), Consumable.canConsume, Consumable.onConsume, and AbsorptionMobEffect.

Self-check

Check Result
Scope ✅ minimal and targeted
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅
clippy ✅
tests: horizon-client ✅ passed

🔄 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/773 **Author:** [@lazy-importer](https://github.com/lazy-importer) **Created:** 10/17/2026 **Status:** ✅ Merged **Merged:** 10/17/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/always-edible-food-effects` --- ### 📝 Commits (2) - [`9779eb7`](https://github.com/horizon-rust/horizon/commit/9779eb7271e29c08424a6853db5a6bc598af7e8a) fix(game): allow always-edible food when full and apply consume effects (#750) - [`ecdff7a`](https://github.com/horizon-rust/horizon/commit/ecdff7ad2d94e6cf14d27a0b0bd89a64ce50f12b) fix(game): apply absorption effect attribute modifiers and health (#750) ### 📊 Changes **6 files changed** (+245 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/effects.rs` (+31 -0) 📝 `crates/horizon-client/src/game.rs` (+61 -8) 📝 `crates/horizon-client/src/game/commands/effects.rs` (+3 -1) 📝 `crates/horizon-client/src/game/potions.rs` (+25 -4) 📝 `crates/horizon-client/src/game/totem.rs` (+1 -3) 📝 `crates/horizon-client/src/items.rs` (+124 -0) </details> ### 📄 Description ## What and why Fixes #750. In vanilla, items with `can_always_eat: true` (such as Golden Apples, Enchanted Golden Apples, Chorus Fruit, Honey Bottles) can always be consumed regardless of the player's hunger level (even when hunger is 20/20). In Horizon: 1. `start_eating` rejected consumption when hunger was full because it did not check `info.can_always_eat`. 2. When consumption completed, `on_consume_effects` defined in the `minecraft:consumable` component were not applied to the player. 3. The `absorption` effect was missing from `PlayerEffects::modifiers()`, preventing `minecraft:max_absorption` attribute modifiers from being registered and absorption health / yellow hearts from being displayed. This change: - Parses `can_always_eat` and `consume_effects` from `minecraft:food` and `minecraft:consumable` in `ItemInfo`. - Allows consumption when `info.can_always_eat` is true even if hunger is at 20. - Applies the consumable's effects (e.g. Regeneration, Absorption, Resistance, Fire Resistance for golden apples) upon consumption finish. - Adds `minecraft:max_absorption` attribute modifier for `absorption` in `PlayerEffects::modifiers()` and synchronizes absorption points with `PlayerMotion::set_health`. ## Vanilla reference Follows vanilla `Player.canEat(boolean)`, `Consumable.canConsume`, `Consumable.onConsume`, and `AbsorptionMobEffect`. ## Self-check | Check | Result | | --- | --- | | Scope | ✅ minimal and targeted | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ | | clippy | ✅ | | tests: horizon-client | ✅ passed | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:59:08 +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#2797
No description provided.