Fixes a bug that prevented air from showing up if health wasn't.

This commit is contained in:
Markil3
2021-02-27 11:10:53 -07:00
parent 8fffdf110f
commit 2deb8aa2b3
2 changed files with 11 additions and 22 deletions

View File

@@ -150,13 +150,6 @@ public class EventBus
event.getMatrixStack()); event.getMatrixStack());
resetAlpha(); resetAlpha();
} }
/*
* Reset the transparency.
*/
else if (event instanceof RenderGameOverlayEvent.Post)
{
resetAlpha();
}
break; break;
case HOTBAR: case HOTBAR:
if (event instanceof RenderGameOverlayEvent.Pre) if (event instanceof RenderGameOverlayEvent.Pre)

View File

@@ -601,11 +601,6 @@ public class TimerUtils
final float HEALTH_BOUNDARY = 0.5F; final float HEALTH_BOUNDARY = 0.5F;
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
boolean changed = false; boolean changed = false;
/*
* Skip healthy bars that haven't updated in awhile.
*/
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.
@@ -634,9 +629,14 @@ public class TimerUtils
*/ */
if (health / maxHealth > HEALTH_BOUNDARY) if (health / maxHealth > HEALTH_BOUNDARY)
{ {
setAlpha(Main.getAlpha(healthTime)); if (healthTime > 0)
{
setAlpha(Main.getAlpha(healthTime));
return false;
}
return true;
} }
return canceled; return false;
} }
/** /**
@@ -656,7 +656,6 @@ public class TimerUtils
*/ */
final int HUNGER_BOUNDARY = 15; final int HUNGER_BOUNDARY = 15;
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
boolean canceled = hungerTime == 0 && hunger > HUNGER_BOUNDARY;
boolean changed = false; boolean changed = false;
if (hunger != mc.player.getFoodStats().getFoodLevel()) if (hunger != mc.player.getFoodStats().getFoodLevel())
@@ -670,11 +669,8 @@ public class TimerUtils
mc.player.isPotionActive(Effects.HUNGER); mc.player.isPotionActive(Effects.HUNGER);
changed = true; changed = true;
} }
if (hunger <= HUNGER_BOUNDARY)
{ if (changed || hunger <= HUNGER_BOUNDARY)
changed = true;
}
if (changed)
{ {
hungerTime = HEALTH_TIME; hungerTime = HEALTH_TIME;
setAlpha(Main.getAlpha(hungerTime)); setAlpha(Main.getAlpha(hungerTime));
@@ -684,10 +680,10 @@ public class TimerUtils
hungerTime--; hungerTime--;
} }
/* /*
* Only makes a change if the player is satisfied. Otherwise, * Only fade a change if the player is satisfied. Otherwise,
* the bar is shown. * the bar is shown.
*/ */
return canceled; return hungerTime == 0 && hunger > HUNGER_BOUNDARY;
} }
/** /**