PlayerEvents.tick(event => {
    const { player, level } = event;
    // Keep the 1-second interval for general checks
    if (player.age % 20 !== 0 || !player.isAlive()) return;

    // 1. Maintain Utility Fixes
    if (player.potionEffects.isActive("libraryferret:unbreakable_curse")) {
        player.removePotionEffect("libraryferret:unbreakable_curse");
    }

    // 2. Food System Tweak: Keep exhaustion low to make hunger feel less "punishing"
    if (player.exhaustion > 0) player.exhaustion *= 0.75;

    // 3. Slow Passive Out-of-Combat Healing
    if (player.health < player.maxHealth) {
        // Combat/Heal Delay check (if you have other scripts setting allowHealAt)
        if (player.persistentData.allowHealAt && level.time < player.persistentData.allowHealAt) return;

        let food = player.foodLevel;
        
        // High Hunger Regen: 2HP every 10 seconds (200 ticks)
        if (food >= 14 && player.age % 200 === 0) {
            player.heal(2.0);
        } 
        // Low Hunger Regen: 1HP every 20 seconds (400 ticks)
        else if (food >= 6 && player.age % 600 === 0) {
            player.heal(1.0);
        }
    }
});