fix(hunger): implement naturalRegeneration gamerule check (#1764)

This commit is contained in:
WCBBEX
2026-03-01 17:06:38 +08:00
committed by GitHub
parent d4dd87e548
commit 17118be2d1

View File

@@ -36,7 +36,9 @@ impl HungerManager {
let mut exhaustion = self.exhaustion.load();
let mut timer = self.tick_timer.load();
let difficulty = player.world().level_info.load().difficulty;
let level_info = player.world().level_info.load();
let difficulty = level_info.difficulty;
let natural_regen = level_info.game_rules.natural_health_regeneration;
let health = player.living_entity.health.load();
let can_heal = player.can_food_heal();
@@ -54,8 +56,6 @@ impl HungerManager {
needs_sync = true;
}
let natural_regen = true; // TODO: GameRule check
if natural_regen && saturation > 0.0 && can_heal && level >= 20 {
timer += 1;
if timer >= 10 {