2

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

1
  • Usually a simple 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. Jul 4, 2018 at 19:45

2 Answers 2

-1
/region flag (region name) invincible allow

Alternatively,

/region flag region-name feed-delay 1
/region flag region-name feed-amount 20

This gives them a full bar of food every second, without giving "god mode" to anyone in the region.

1
  • 3
    Um.. Don't you need WorldGuard/Essentials/WorldEdit for this?
    – aytimothy
    Dec 29, 2019 at 20:32
-1

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.

1
  • Doesn't help unfortunately as this needs to be in a specific section of a vanilla survival world. Thanks anyway!
    – Xav
    Jul 4, 2018 at 21:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .