-
Bug
-
Resolution: Fixed
-
1.16.5, 1.17, 1.19.2, 24w21b
-
None
-
Confirmed
-
Networking
-
Important
-
Platform
The code in charge of regenerating the player's health and food level when in peaceful mode is executed both on the server and on the client (located in Player#aiStep()).
This code is only meant to be executed if the naturalRegeneration gamerule is set to false. However, since the gamerules are not sent to the client, this gamerule will create an issue where the client will increase the player's health & food level whilst the server will not. I believe this code should only be executed on the server, not the client.
This can be reproduced by simply going into a singleplayer world and setting naturalRegeneration to false. If you give yourself a hunger potion effect and then take it away, you'll see that the client will regenerate your food level anyway. If you exit the world and then join it again, the food bar will be empty again since the server isn't actually increasing it.