Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-219083

Hunger client/server desync when natural regeneration is off in peaceful mode

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.16.5, 1.17, 1.19.2
    • 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.

            Unassigned Unassigned
            grinderwolf Jaime Costas Insua
            Votes:
            8 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              CHK: