Farmer's Delight

Farmer's Delight

77M Downloads

[1.18.2]: Comfort does not check naturalRegeneration gamerule

copygirl opened this issue ยท 7 comments

commented

Description

The comfort effect does not check if the gamerule naturalRegeneration is turned on or not, resulting in some odd behavior when said gamerule is turned off. When saturation is available, no healing occurs, since this is when Minecraft's healing-from-saturation is supposed to occur, but that's turned off by the gamerule. Only when saturation is empty, the player heals "as intended" by the effect, however the gamerule is not respected.

I'm currently tinkering with a hardcore modpack and would like to include Farmer's Delight, though its usefulness is limited in this scenario. If Comfort was disabled entirely when naturalRegeneration is turned off, it would reduce the number of useful foods in the mod to 4 - melon juice, fruit salad and mixed salad for regaining 1 heart, and apple cider for absorption. It would be nice if there was a configuration option that could control the heal rate of the Comfort effect when the gamerule is off, maybe with a default of 0, meaning disabled. A separate option for when the gamerule is turned on could be worth considering as well.

It'd also be nice if the nutrition values and effects of each food could be customized. I understand this would be best as another issue, but as it's non-trivial I want to leave it up to the developers if this is even a worthwhile suggestion, and I'll be looking into another solution for the time being.

Steps to reproduce

No response

Mod list

Forge: 40.2.0
Famer's Delight: 1.18.2-1.2.0

Logs

No response

Forge

  • I am using the Forge version of Farmer's Delight

Minimal instance

  • I have tested this on a minimal instance

Performance and shader mods

  • I have tested this without performance or shader mods
commented

Good point in regards to that gamerule; I completely forgot about it when designing this effect.

Due to it waiting on saturation to deplete, it fails to do its intended job until the player gets "tired" enough, so I'll need to check for it when choosing to activate the healing.

However, turning it off entirely when this gamerule is disabled would render it pointless. :(

I might still make Comfort do its thing with this gamerule off, with the difference being that it would always trigger. It's decently slower to normal regen currently. Though I suppose a rate of healing config could be nice, to cover all bases. Just gotta translate the healing intervals into a workable value.

commented

It'd also be nice if the nutrition values and effects of each food could be customized. I understand this would be best as another issue, but as it's non-trivial I want to leave it up to the developers if this is even a worthwhile suggestion, and I'll be looking into another solution for the time being.

This is significantly harder to do, though. Since all of those values are defined in-code for every food item in vanilla, the ideal solution would be a brand new mod/system to expose them to datapacks, which is far outside the scope of FD. Sorry, gonna pass on that one. x)

commented

Quick update: the implementation I wrote crashes on the server. Trying to find other ways to gather the data I need for this logic.

commented

After some testing, and asking around about the gamerule, I decided to implement the following:

  • When the naturalRegeneration gamerule is disabled, Comfort will operate at all times, regardless of hunger or saturation. However, its speed is drastically reduced, to a default of 20% of the original speed (see below);
  • A new config, comfortRateWithoutNaturalRegen, defines the percentage of speed to use when this gamerule is disabled. Setting it to 0 will cancel the effect, and setting it to 1 will use normal speeds;
  • The "silver sheen" of Comfort will play slower when this healing rate is reduced, to indicate it.

It seems that this gamerule was introduced at first to support the Ultra Hardcore community, a gamemode where healing is supposed to be scarce, limited to difficult and later-game items. Comfort, in this case, represents an easy way out of that idea, so it does need a nerf. However, I didn't want to make the effect completely useless, as it would feel strange to have it applied and doing nothing; therefore, I'm testing a very slow heal rate instead.

The idea is that, if healing is slow enough, it would be useless for combat, but a gentle "saving grace" across a long period. With the current 20% rate, Comfort heals half a heart every 20 seconds. For the longest-comforting meals (5 minutes), this would total 7 hearts of health. Given meals are meant to be "better" than raw or singular foods, some reward is still important.

With that said, setting the config to 0 effectively disables Comfort, if preferred for a given modpack or experience.

@copygirl, if you got some time, please let me know what you think of these mechanics. I'm likely pushing this as-is regardless, as it fixes the bug of Comfort being softlocked from saturation; still, feedback is appreciated. ๐Ÿ˜„

commented

While a speed factor appears like a straight-forward solution, perhaps it makes more sense to specify the number of seconds the effect needs to be active to heal? A half-heart per 30 seconds of comfort was my initial thought back when I looked into this, as the 4 built-in comfort durations are each divisible by 30 seconds.

commented

That could work too. I imagined the percentage analogue would make it easier to visualize for the user, but hard-setting the seconds also makes sense, as I can just plug it into the tick calculation. I'll test that out.

commented

The reason I'd prefer a flat value over a percentage is because someone looking at the configs might not be aware of the default speed at which comfort heals the player, and they'd then have to calculate it in relation to that, whereas specifying seconds makes that very clear from the get-go.

It might also be nice if the description for the config setting mentions something like "Foods in Farmer's Delight provide 30s to 5m of the comfort effect." to get an idea of the range of healing that's possible to achieve without testing or digging through the code.