Adjusts the health and hunger to always show under wither, poison, and hunger.

This commit is contained in:
Markil3
2021-03-02 10:41:53 -07:00
parent fb52f20d14
commit c560e50288

View File

@@ -615,7 +615,8 @@ public class TimerUtils
} }
else if (effectinstance.getDuration() <= BLINK_TIME + potion.getFadeInTime()) else if (effectinstance.getDuration() <= BLINK_TIME + potion.getFadeInTime())
{ {
effectAlpha = -(effectinstance.getDuration() - BLINK_TIME) / 22F + 0.454F; effectAlpha =
-(effectinstance.getDuration() - BLINK_TIME) / 22F + 0.454F;
} }
else else
{ {
@@ -688,8 +689,7 @@ public class TimerUtils
return true; return true;
} }
boolean changed = false; boolean changed = false;
boolean canceled = boolean canceled;
healthTime == 0 && health / maxHealth > HEALTH_BOUNDARY;
/** /**
* Checks for a change in current or max health. * Checks for a change in current or max health.
@@ -718,13 +718,19 @@ public class TimerUtils
* Only makes a change if the player is healthy. Otherwise, * Only makes a change if the player is healthy. Otherwise,
* the bar is shown. * the bar is shown.
*/ */
if (health / maxHealth > HEALTH_BOUNDARY) if (health / maxHealth > HEALTH_BOUNDARY && !entity
.hasStatusEffect(StatusEffects.WITHER) && !entity.hasStatusEffect(
StatusEffects.POISON))
{ {
setAlpha(Main.getAlpha(healthTime, setAlpha(Main.getAlpha(healthTime,
healthTimes.getMaxTime(), healthTimes.getMaxTime(),
healthTimes.getFadeInTime(), healthTimes.getFadeInTime(),
healthTimes.getFadeOutTime())); healthTimes.getFadeOutTime()));
} }
canceled =
healthTime == 0 && health / maxHealth > HEALTH_BOUNDARY && !entity
.hasStatusEffect(StatusEffects.WITHER) && !entity.hasStatusEffect(
StatusEffects.POISON);
return canceled; return canceled;
} }
@@ -792,14 +798,19 @@ public class TimerUtils
{ {
return true; return true;
} }
else /*
* Only makes a change if the player is healthy. Otherwise,
* the bar is shown.
*/
if (hunger > HUNGER_BOUNDARY && !entity.hasStatusEffect(StatusEffects.HUNGER))
{ {
setAlpha(Main.getAlpha(hungerTime, setAlpha(Main.getAlpha(hungerTime,
hungerTimes.getMaxTime(), hungerTimes.getMaxTime(),
hungerTimes.getFadeInTime(), hungerTimes.getFadeInTime(),
hungerTimes.getFadeOutTime())); hungerTimes.getFadeOutTime()));
return false;
} }
return hungerTime == 0 && hunger > HUNGER_BOUNDARY && !entity
.hasStatusEffect(StatusEffects.HUNGER);
} }
/** /**