yeelp / Scaling-Feast

A simple, balanced way to increase your maximum hunger in Minecraft over the course of a world.
MIT License
0 stars 1 forks source link

Hunger lost when quitting #77

Closed yeelp closed 4 years ago

yeelp commented 4 years ago

This doesn't seem to be possible to replicate with just Scaling Feast, and other custom packs I've used haven't had this problem, from what I'm aware of. However with the small custom mod pack I'm using right now, no single mod jumps out as problematic. However, it perhaps reveals a small improvement that could be made anyway.

Saving and quitting a world and rejoining causes a player's hunger to get reset to whatever the starting hunger was set to.

I suspect merging https://github.com/yeelp/Scaling-Feast/blob/a4560906fd6f9b9121fb7760b6a9fb9daaeee1f8/src/main/java/yeelp/scalingfeast/handlers/CapabilityHandler.java#L57

with

https://github.com/yeelp/Scaling-Feast/blob/a4560906fd6f9b9121fb7760b6a9fb9daaeee1f8/src/main/java/yeelp/scalingfeast/handlers/CapabilityHandler.java#L76

ought to resolve this. I'm assuming the following happens

  1. Player object is created, and capabilities are attached. onAddCapabilities runs, giving the player a food cap set to the starting hunger amount (in my case, 6).
  2. Player logs in, and onPlayerLogin runs, taking previous food values and comparing them to the new food cap, 6, and setting hunger and saturation to 6 since the foodstats exceed 6.
  3. Player joins world, and onPlayerJoin runs, setting the food cap and everything else back to what they were before the player quit as one would expect, but the hunger isn't preserved.
yeelp commented 4 years ago

This seems to be fixed in the current development version now.