From ea626c99138aba94e23f47cee0be1fd29b8b2a4b Mon Sep 17 00:00:00 2001 From: Markil3 <75867393+Markil3@users.noreply.github.com> Date: Tue, 2 Mar 2021 10:34:03 -0700 Subject: [PATCH] Adjusts the health and hunger to always show under wither, poison, and hunger. --- .../markil3/immersive_hud/TimerUtils.java | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/main/java/markil3/immersive_hud/TimerUtils.java b/src/main/java/markil3/immersive_hud/TimerUtils.java index 0d4d3ff..ff58a44 100644 --- a/src/main/java/markil3/immersive_hud/TimerUtils.java +++ b/src/main/java/markil3/immersive_hud/TimerUtils.java @@ -758,7 +758,7 @@ public class TimerUtils * Only makes a change if the player is healthy. Otherwise, * the bar is shown. */ - if (health / maxHealth > HEALTH_BOUNDARY) + if (health / maxHealth > HEALTH_BOUNDARY && !mc.player.isPotionActive(Effects.WITHER) && !mc.player.isPotionActive(Effects.POISON)) { if (healthTime > 0) { @@ -828,22 +828,27 @@ public class TimerUtils * Only fade a change if the player is satisfied. Otherwise, * the bar is shown. */ - if (hungerTime <= 0 && hunger > HUNGER_BOUNDARY) + if (hunger > HUNGER_BOUNDARY && !mc.player.isPotionActive(Effects.HUNGER)) { + if (hungerTime > 0) + { + setAlpha(Main.getAlpha(hungerTime, + hungerTimes.getMaxTime(), + hungerTimes.getFadeInTime(), + hungerTimes.getFadeOutTime())); + stack.push(); + stack.translate(0F, + getHealthTranslation(), + 0F); + return false; + } return true; } - else - { - setAlpha(Main.getAlpha(hungerTime, - hungerTimes.getMaxTime(), - hungerTimes.getFadeInTime(), - hungerTimes.getFadeOutTime())); - stack.push(); - stack.translate(0F, - getHealthTranslation(), - 0F); - return false; - } + stack.push(); + stack.translate(0F, + getHealthTranslation(), + 0F); + return false; } /**