Using FoodLevelChangeEvent prevents proper saturation levels from being applied.

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • None
    • mcMMO

      The FoodLevelChangeEvent hardcodes a maximum result of 20 for the new food level. However, in combination with how saturation is calculated, this means that actually using this event to change the hunger value will have an unintended impact on the saturation gained. This is especially evident in this old issue for mcMMO, where the modified food values result in lower than normal saturation gains due to hitting the hunger cap.

          [SPIGOT-3938] Using FoodLevelChangeEvent prevents proper saturation levels from being applied.

          md_5 added a comment -

          Sorry I can't pull any patches unless the CLA is completely filled.
          Please refill the CLA with your full and correct details and then open a pull request to the Bukkit project https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests

          md_5 added a comment - Sorry I can't pull any patches unless the CLA is completely filled. Please refill the CLA with your full and correct details and then open a pull request to the Bukkit project https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests

          Sean Porter added a comment -

          I have just confirmed that the FoodLevelChangeEvent is instantiated with greater than 20 food as the end result on occasions where overflow happens, so this is also helping ensure access to vanilla behavior for plugins as well.

          Sean Porter added a comment - I have just confirmed that the FoodLevelChangeEvent is instantiated with greater than 20 food as the end result on occasions where overflow happens, so this is also helping ensure access to vanilla behavior for plugins as well.

          Sean Porter added a comment -

          Have to wait on getting my CLA sorted out so I have access to make a pull request. That said, I do have a patch file I can attach right here. There isn't actually any reason for that maximum to be there, as it gets applied elsewhere in the code and simply prevents appropriate calculations from happening.0026-Allow-modified-hunger-changes-to-affect-saturation-p.patch

          Sean Porter added a comment - Have to wait on getting my CLA sorted out so I have access to make a pull request. That said, I do have a patch file I can attach right here. There isn't actually any reason for that maximum to be there, as it gets applied elsewhere in the code and simply prevents appropriate calculations from happening. 0026-Allow-modified-hunger-changes-to-affect-saturation-p.patch

          md_5 added a comment -

          If you are familiar with the cause of the issue have you considered opening a PR to fix it?

          Thanks

          md_5 added a comment - If you are familiar with the cause of the issue have you considered opening a PR to fix it? Thanks

          Sean Porter added a comment -

          My apologies, I linked the wrong issue on the mcmmo tracker. this is the correct issue.

          Sean Porter added a comment - My apologies, I linked the wrong issue on the mcmmo tracker. this is the correct issue.

            Assignee:
            Unassigned
            Reporter:
            Sean Porter
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: