[Enhancement] Add config for offsets to clientside HUD items
3x1t-5tyl3 opened this issue · 4 comments
In my usecase where I disabled experience and the experience bar, it'd be great to add an offset config to the hud elements so I can align them with my own mod's way of altering the hud.
For context, I alter the vanilla hud via mixins to achieve a shift of the health and food bar. Tough as Nails just binds itself to the height of the food bar. Given potential incompatibility with raised, adding an offset would be both easy and not cause issues with other mods.
Binding to the foodHud ergo : renderFoodLevel() would also probably work?
Edit: decided to not care anymore. Thanks anyhow for the help. I'll just disable the bars instead.
What version of Minecraft are you targeting? Which of Fabric/NeoForge/Forge are you targeting? Each version/loader might work differently here, so that info is relevant (e.g. in the Fabric version for 1.21, AppleSkin hooks renderFood
so it'd likely just work)
If all else fails, you can use the HUDOverlayEvent
from the AppleSkin API for this purpose (just listen for it and modify the y
value accordingly):
- https://github.com/squeek502/AppleSkin/blob/1.21-fabric/java/squeek/appleskin/api/event/HUDOverlayEvent.java
- https://github.com/squeek502/AppleSkin/blob/1.21-neoforge/java/squeek/appleskin/api/event/HUDOverlayEvent.java
- (or see whatever branch is relevant for your mod)
Details on how to use the AppleSkin API are in the readme for whatever branch is relevant for you.
What version of Minecraft are you targeting? Which of Fabric/NeoForge/Forge are you targeting? Each version/loader might work differently here, so that info is relevant (e.g. in the Fabric version for 1.21, AppleSkin hooks
renderFood
so it'd likely just work)If all else fails, you can use the
HUDOverlayEvent
from the AppleSkin API for this purpose (just listen for it and modify they
value accordingly):* https://github.com/squeek502/AppleSkin/blob/1.21-fabric/java/squeek/appleskin/api/event/HUDOverlayEvent.java * https://github.com/squeek502/AppleSkin/blob/1.21-neoforge/java/squeek/appleskin/api/event/HUDOverlayEvent.java * (or see whatever branch is relevant for your mod)
Details on how to use the AppleSkin API are in the readme for whatever branch is relevant for you.
Personally I'm targetting exclusively NeoForge for MC-1.21 21.0.4x-beta+ (Mainly due to breaking ToolAction rename)
AppleSkin uses the NeoForge RegisterGuiLayersEvent
for this stuff, so in theory altering the rightHeight
variable before AppleSkin reads it should make things work:
AppleSkin/java/squeek/appleskin/client/HUDOverlayHandler.java
Lines 51 to 68 in 6d27f40