Closed PencilVoid closed 2 years ago
I've been able to simply the code quite a bit, but I am not sure how I can resolve this issue, if I can. It may require Appleskin changing its code.
The vanilla HUD gets the value of where it should place its elements from the Window class. In the render
method, this.scaledHeight = this.client.getWindow().getScaledHeight();
does it. This scaledHeight
int field is then used in the other methods.
Appleskin does the same thing. Its HUD elements are not placed based on the HUD. Instead, it has its own methods in which it makes an int top
for its other methods to use. This is done as int top = mc.getWindow().getScaledHeight() - foodIconsOffset;
, which uses a constant to match it up with the status bars.
There might be a way to get this to work, but with my current experience I am not sure if that is possible. As far as I can tell, Appleskin would have to take directly from InGameHud.scaledHeight
instead of what it takes it from. Basically, it is intercepting the value before my code gets to it.
If I were to intercept that value, it would end up moving everything up, such as the inventory containers and even the darkened overlay behind it, which we do not want. I would in turn have to find every place not related to that getScaledHeight()
is used and modify it there. However, surely there are a lot of other mods that end up getting this value in the same way that Appleskin does and thus that would break it for all of them.
I should amend that the way it current moves things up is based on changing the constants, hardcoded numbers. Basically the game calculates how many "pixels" from the bottom it should place these elements by subtracting them from the scaled height of the window. In version 1.0.0, I am simply modifying these constants on a one-by-one basis. The "simplified" code requires some more inverse changes for the elements I don't want to move, such as the scoreboard. Overall it is simpler, though.
Well without figuring out a way around it, I will just make a mixin to fix Appleskin's HUD. I'll have an update out today.
As seen in the attached screenshot, the saturation overlay is not shifted to align with the hunger bar.