squeek502 / AppleSkin

Food-related HUD improvements for Minecraft (AppleCore without the core)
https://minecraft.curseforge.com/projects/appleskin
The Unlicense
325 stars 58 forks source link

[Enhancement] Add config for offsets to clientside HUD items #311

Closed 3x1t-5tyl3 closed 17 hours ago

3x1t-5tyl3 commented 5 days ago

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?

KZpx35fJptsaQztC

squeek502 commented 5 days ago

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):

Details on how to use the AppleSkin API are in the readme for whatever branch is relevant for you.

3x1t-5tyl3 commented 5 days ago

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.

Personally I'm targetting exclusively NeoForge for MC-1.21 21.0.4x-beta+ (Mainly due to breaking ToolAction rename)

squeek502 commented 3 days ago

AppleSkin uses the NeoForge RegisterGuiLayersEvent for this stuff, so in theory altering the rightHeight variable before AppleSkin reads it should make things work:

https://github.com/squeek502/AppleSkin/blob/6d27f4055d0e2e85d6fb45046b7ebb0bdc8abf1e/java/squeek/appleskin/client/HUDOverlayHandler.java#L51-L68

3x1t-5tyl3 commented 17 hours ago

Edit: decided to not care anymore. Thanks anyhow for the help. I'll just disable the bars instead.