[SPIGOT-3938] Using FoodLevelChangeEvent prevents proper saturation levels from being applied. Created: 15/May/18  Updated: 19/May/18  Resolved: 19/May/18

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Sean Porter Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None

Attachments: Text File 0026-Allow-modified-hunger-changes-to-affect-saturation-p.patch    
Plugin: mcMMO

 Description   

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.



 Comments   
Comment by md_5 [ 17/May/18 ]

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

Comment by Sean Porter [ 15/May/18 ]

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.

Comment by Sean Porter [ 15/May/18 ]

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

Comment by md_5 [ 15/May/18 ]

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

Thanks

Comment by Sean Porter [ 15/May/18 ]

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

Generated at Sun Mar 30 17:51:35 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.