Changes how the mod handles status bars slightly.

This should somewhat increase compatibility with the AppleSkin mod.
This commit is contained in:
Markil3
2021-07-22 13:37:28 -06:00
parent 8646ac8ec8
commit c4fe9992b0
2 changed files with 17 additions and 2 deletions

View File

@@ -250,6 +250,8 @@ public class TimerUtils
ConfigManager.getInstance().getExperienceTime(); ConfigManager.getInstance().getExperienceTime();
ConfigManager.TimeValues jump = ConfigManager.TimeValues jump =
ConfigManager.getInstance().getJumpTime(); ConfigManager.getInstance().getJumpTime();
ConfigManager.TimeValues healthTimes = ConfigManager.getInstance().getHealthTime();
ConfigManager.TimeValues hungerTimes = ConfigManager.getInstance().getHungerTime();
float hotbarAlpha = Main.getAlpha(hotbarTime, float hotbarAlpha = Main.getAlpha(hotbarTime,
hotbar.getMaxTime(), hotbar.getMaxTime(),
@@ -263,8 +265,21 @@ public class TimerUtils
jump.getMaxTime(), jump.getMaxTime(),
jump.getFadeInTime(), jump.getFadeInTime(),
jump.getFadeOutTime()); jump.getFadeOutTime());
float statusAlpha = Main.getAlpha(healthTime,
healthTimes.getMaxTime(),
healthTimes.getFadeInTime(),
healthTimes.getFadeOutTime());
statusAlpha = Math.max(statusAlpha, Main.getAlpha(hungerTime,
hungerTimes.getMaxTime(),
hungerTimes.getFadeInTime(),
hungerTimes.getFadeOutTime()));
/*
* Draw it in its standard location until it is completely transparent, then move it
* instantly.
*/
statusAlpha = (float) Math.ceil(statusAlpha);
return 7 * (1 - Math.max(experienceAlpha, return 7 * (1 - Math.max(experienceAlpha,
jumpAlpha)) + 22 * (1 - hotbarAlpha); jumpAlpha)) + 22 * (1 - hotbarAlpha) + 42 * (1 - statusAlpha);
} }
/** /**

View File

@@ -338,7 +338,7 @@ public class HudHook
@Inject(method = "renderStatusBars(Lnet/minecraft/client/util" + @Inject(method = "renderStatusBars(Lnet/minecraft/client/util" +
"/math/MatrixStack;)V", at = @At(value = "INVOKE", target = "Lnet" + "/math/MatrixStack;)V", at = @At(value = "INVOKE", target = "Lnet" +
"/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", "/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V",
ordinal = 1)) ordinal = 1, shift = At.Shift.BY, by = 3))
public void renderFood(MatrixStack matrices, CallbackInfo callbackInfo) public void renderFood(MatrixStack matrices, CallbackInfo callbackInfo)
{ {
try try