I am looking to create an area where, when players enter it, their hunger does not deplete but they are not 'invincible' (super-fast regenerating health). I have tried:
1)
/effect @a 23 1000000 1 1
But this just gives the infinite health regen issue.
2)
/testfor @a {foodLevel:17}
(and all food levels below) and given the appropriate saturation, but that is incredibly resource intensive and still provides some form of invinicibility.
Basically I want the hunger to freeze but for saturation to stay at a consistent level. Is there a way to do this through the use of command blocks or functions (it's also important it can be toggled). Thanks
testfor
shouldn't create too much lag. But since hunger isn't something fast, you could try only running it every few seconds. Other than that, I don't think there is a solution, you already found the best one.