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());
resetAlpha();
}
/*
* Reset the transparency.
*/
else if (event instanceof RenderGameOverlayEvent.Post)
{
resetAlpha();
}
break;
case HOTBAR:
if (event instanceof RenderGameOverlayEvent.Pre)

View File

@@ -601,11 +601,6 @@ public class TimerUtils
final float HEALTH_BOUNDARY = 0.5F;
Minecraft mc = Minecraft.getInstance();
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.
@@ -634,9 +629,14 @@ public class TimerUtils
*/
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;
Minecraft mc = Minecraft.getInstance();
boolean canceled = hungerTime == 0 && hunger > HUNGER_BOUNDARY;
boolean changed = false;
if (hunger != mc.player.getFoodStats().getFoodLevel())
@@ -670,11 +669,8 @@ public class TimerUtils
mc.player.isPotionActive(Effects.HUNGER);
changed = true;
}
if (hunger <= HUNGER_BOUNDARY)
{
changed = true;
}
if (changed)
if (changed || hunger <= HUNGER_BOUNDARY)
{
hungerTime = HEALTH_TIME;
setAlpha(Main.getAlpha(hungerTime));
@@ -684,10 +680,10 @@ public class TimerUtils
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.
*/
return canceled;
return hungerTime == 0 && hunger > HUNGER_BOUNDARY;
}
/**