PlayerEvents.tick(event => {
    const { player, level } = event;
    if (player.age % 20 !== 0 || !player.isAlive()) return;

    // Use the direct removal method for Fabric
    if (player.potionEffects.isActive("libraryferret:unbreakable_curse")) {
        player.removePotionEffect("libraryferret:unbreakable_curse");
    }

    if (player.exhaustion > 0) player.exhaustion *= 0.5;

    if (player.health < player.maxHealth) {
        if (player.persistentData.allowHealAt && level.time < player.persistentData.allowHealAt) return;
        let food = player.foodLevel;
        if (food >= 11) {
            player.heal(1.0);
        } else if (food >= 1 && player.age % 60 === 0) {
            player.heal(1.0);
        }
    }
});