8

So, for my PvP arena I used to have a command:

effect @a minecraft:saturation 1000000 20 true

... which runs constantly to keep the hunger bar full, so that natural regeneration slowly regenerates health.
However, if do it in the latest snapshot, this effect breaks with the new food system and instead it regenerates health at a ridiculous rate (1 heart per second), even if saturation is at level 1.

Is there any way I can keep the hunger up, but with a lower regeneration rate than the one that has been introduced in the 1.9 snapshots?

3
  • Food level is a trackable scoreboard stat now. That's where I would start.
    – MBraedley
    Oct 28, 2015 at 22:37
  • @MBraedley Tha's a good start, but it doesn't help much since food is a read only parameter... No idea of what to do.
    – Lionitow
    Oct 29, 2015 at 21:27
  • But it's a stat that can be easily tracked. Since saturation is linked to food level, you can use food level as a proxy for saturation as a proxy for natural regeneration rate.
    – MBraedley
    Oct 30, 2015 at 16:39

3 Answers 3

1

You could try turning off natrual regeneration, and using your own regeneration system of you own.
Of course, it's not perfect - But it somewhat mimics the pre-1.9 behaviors.


Step 1: Turn off Natural Regeneration

/gamerule naturalRegeneration false

Step 2: Create a clock that every four seconds runs the following command:

/effect @a 10 1 true
OR
/effect @a minecraft:regeneration 1 true

This gives a regeneration effect that's long enough to heal one health (half-a-heart) every four seconds, since heal heals by one when hunger is above 18 (9 steaks) every four seconds.

At Regeneration II, hearts heal at a rate of 0.8 hearts per second, therefore - 1 seconds is enough to give one health (half-a-heart), but not the second health to fill up a whole heart as a whole heart takes 1.25 seconds to generate at this potency.

1

So you want your players to never starve, but also not to regenerate too quickly? Here's the best solution I could find:

First, we need to make sure the hunger bar stays at 19 so that both your players don't starve AND they regenerate slower. To do this, first, let's create an objective to detect the players' hunger.

  1. Type: /scoreboard objectives add [YOUR OBJECTIVE NAME] food <--- This will detect the players' hunger levels. (whether they are on 20, 19, etc., but it'll NOT detect a certain hunger level
  2. Put a command block and put this command into it: /effect give @a[scores={YOUR OBJECTIVE NAME=18}] minecraft:saturation 1 0 true <--- This will make it so that if a player's hunger is 18 and below, it'll put them back to 19.
  3. Set the "Impulse" to "Repeat" and "Needs Redstone" to "Always Active" and boom! You're done! <--- This applies to the command block you just put on your server.

Remember, this only applies once your players' hunger effect starts to decrease, which won't be a problem since the hunger bar decreases quicker than the Speed II effect.

Now, if you did that all correctly, your players' hunger bars should stay at 19 and neither decrease OR increase. (unless you are planning to give them golden apples, then it'll increase)

And there you go! It's all done. Sorry for the late response by the way.

0

You could try adding no flinch to the server, and make it take away health while regenerating health. But if you want to keep it vanilla and/or want the PvP to stay mod-free then I don't know if that suggestion will work. But maybe if you can calculate how many hearts it regenerates per second and put a regenerate effect on the command block based on the seconds, then that could work. I don't know, I'm just trying to be creative here so I could help you out.

1
  • I think that comments on the question are better suited to giving ideas than the answers. Please, before making a post, figure out where that post would best fit.
    – Angelica
    Mar 27, 2016 at 19:23

You must log in to answer this question.

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