Topic category: Help with Minecraft modding (Java Edition)
Tl;Dr : By changing the player's maximum health, hunger makes it stop regenerating
As the title suggests, I want to have the player start with a certain amount of health, and by using a certain item your maximum amount changes. So far I've been able to do so, but I have encountered a problem: Hunger
The way I changed it is that there is procedure that verifies how much health you currently have and, if it is higher then the variable that stores how much is your maximum, it puts you back at that amount. However, by doing so the player's health is constantly regenerating in vain, resulting in you almost always having 1.5 of hunger missing (Aka, how much is needed to stop regeneration).
That makes battles a lot tougher in the beginning, as by the time you encounter a enemy your already low health will not regenerate unless you eat something. And those enemies are everywhere, so you can expect to fight them a lot.
How can I solve this issue? I imagine it would have to be by changing the actual maximum health value or something with the hunger
You could try disabling natural health regeneration, and instead make a custom regeneration.