Added & adjusted effectTick checks for the Comfort effect #1222
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the comfort effect does not respect the natural regeneration gamerule, so I added a flag for that.
Also, to account for a few situations regarding food & saturation values, I swapped out the saturation check for food level checks (although I am uncertain if the main branch's behavior is actually intended. If it is, then this change can be discarded.)
These are the scenarios that I was accounting for:
Situation 2 works as intended, and the player is healed. The concerns are situations 1 and 3.
In situation 1, as comfort is applied independently from natural regeneration, this can result in the player healing 2 HP instead of just 1.
In situation 3, comfort doesn't trigger despite not being able to consume saturation for fast healing. For instance, if I eat a beef stew when I am at 0 hunger, even though I'm below the threshold for natural regeneration, I will not heal due to having saturation.
By checking food levels instead of saturation, this ensures the player only heals if there is no way for natural regeneration to occur.