Minecraft – Commands to stop hunger depletion without constant refilling health

minecraft-commandsminecraft-java-edition

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

Best Answer

I can help you a little bit. If you use /gamerule naturalRegeneration false then it stops players from gaining health. I use it sometimes for maps. I have no idea if this will help but I`m not a command block person.