Tough As Nails

Tough As Nails

21M Downloads

Hydration/Exhaustion Bug

eddy0820 opened this issue · 5 comments

commented

What's the issue you encountered?

Don't know if this is intentional or not but hitting the exhaustion threshold always resets your hydration to zero, I assumed it was like vanilla hunger where it would just subtract one from the hydration but it just resets to zero.

I found out the saturation value when I was making a AppleSkin like addon for the mod by just logging it every frame, looking through the ThirstHandler class I see that 1.0 is subtracted when hitting the exhaustion threshold while if it were intended to be like vanilla hunger 0.1 is what I would think is the correct value.

New to modding in general so forgive me if I am incorrect.

How can the issue be reproduced?

This is just a general issue that can found by sprinting or jumping

Logs

No response

Mod Version

1.19-8.0.0.78

Additional information

No response

commented

This is inaccurate. Vanilla also subtracts 1.0 from saturation once its threshold of 4.0 has been reached:

   public void tick(Player p_38711_) {
      Difficulty difficulty = p_38711_.level.getDifficulty();
      this.lastFoodLevel = this.foodLevel;
      if (this.exhaustionLevel > 4.0F) {
         this.exhaustionLevel -= 4.0F;
         if (this.saturationLevel > 0.0F) {
            this.saturationLevel = Math.max(this.saturationLevel - 1.0F, 0.0F);
         } else if (difficulty != Difficulty.PEACEFUL) {
            this.foodLevel = Math.max(this.foodLevel - 1, 0);
         }
      }
commented

I see, my bad!

That being said, is hydration being reset to zero after hitting the exhaustion threshold intended?

commented

If your hydration was 1.0 or lower then yes, it should be reset to 0

commented

Again sorry for the brother, but isn’t hydration always less than 1.0 due to hydration being measured from 0.0-1.0 (those are the values I see when debugging).

commented

No, hydration is not measured from 0 to 1. It can be (and is) above 1. When first spawned in it is 2, and after consuming several high-hydration drinks it is also above 1.