Farmer's Delight

Farmer's Delight

97M Downloads

[1.18.2]: Nourishment effect overlaps with Vampirism thirst bar

MarioSMB opened this issue · 9 comments

commented

Description

When consuming a Farmer's Delight meal and gaining the Nourishment buff as a vampire, the "glazed" hunger bar overlaps with the Vampirism mod's thirst bar, as seen in this picture:
thirst_nourishment

Steps to reproduce

No response

Mod list

Forge 40.1.86
Farmer's Delight 1.2.0
Vampirism 1.8.8

Logs

No response

Forge

  • I am using the Forge version of Farmer's Delight

Minimal instance

  • I have tested this on a minimal instance

Performance and shader mods

  • I have tested this without performance or shader mods
commented

I don't know if this is something that should be fixed on Vampirism's or FD's side, please let me know if it should be taken to Vampirism instead.

commented

Vampirism replaces the hunger bar with its own blood sprites (vampires don’t eat food), which is rendered overlayed by the nourishment sprites in the regular hunger bar position.

Given this is an override on Vampirism’s side, I’m not sure exactly what can be done to hide the gilded effect here.

commented

The Nourishment gilded overlay is applied over the Hunger meter, and should ideally move together with it. The "half-peeled" sprite does not include the original shank, so the hunger meter is rendering underneath it.

Does this overlap only happen when Nourishment is applied? Does the Hunger bar move out of its place?

commented

Hmm... then it sounds more like a small design conflict.

In this case, we would need to confirm whether Vampirism disables the hunger bar in favor of its own, or just "reskins" the normal hunger bar with different eating mechanics.

Either way, sounds like Nourishment should simply not have any effects to vampires, so what Vampirism could potentially do is cancel overlay events being applied on the food_level layer. This would prevent FD from rendering gilded shanks, since they're not needed.

EDIT: If you have AppleSkin installed, does it display any blinking overlays over the blood meter when holding food? If not, maybe they're doing something I'm not, which is worth looking into.

commented

Thanks for the information, I'll go ahead and let them know with a link back to this issue.

commented

So... I went around testing with AppleSkin and found this issue doesn't seem to occur in 1.19.2! It may only apply to 1.18.2 versions of the mods.

commented

What Vampirism does

Vampirism just adds an additional overlay to the overlay registry

https://github.com/TeamLapen/Vampirism/blob/0f96b0b6bc4e176d3c42ed88d4e2411d5fcfcd26/src/main/java/de/teamlapen/vampirism/proxy/ClientProxy.java#L206

and cancels the rendering of the food bar

https://github.com/TeamLapen/Vampirism/blob/0f96b0b6bc4e176d3c42ed88d4e2411d5fcfcd26/src/main/java/de/teamlapen/vampirism/client/gui/overlay/VampirismHUDOverlay.java#L219-L223

Misconception

so what Vampirism could potentially do is cancel overlay events being applied on the food_level layer

From what if understand is that you misunderstood the OverlayRegistry
OverlayRegistry is a registry where all overlays can be rendered and organized in one place. Registering your nourishment overlay above the food_level only places your overlay in the rendering list above the food level, so that the food is rendered before your nourishment and does not replace your overlay. It does not actually bind your overlay somehow to the food_level

OverlayRegistry.registerOverlayAbove(ForgeIngameGui.FOOD_LEVEL_ELEMENT, "Farmer's Delight Nourishment", (gui, mStack, partialTicks, screenWidth, screenHeight) -> {

Solution Ideas

More or less suitable solutions

  • From Vampirism's side we could cancel the nourishing overlay just like the food bar, but that would require Farmer's Delight to expose the IIngameOverlay object and Vampirism to have a hard dependency on Farmer's Delight.
  • Farmer delight could check if the RenderGameOverlayEvent.PostLayer event was posted for the food_layer and render its overlay accordingly.
  • Farmer's Delight could depend on Vampirism's API and check if the blood bar or food bar is rendered
  • Simply disable the nourishing overlay if Vampirism is installed or an inter mod message is received.

Conclusion

I have not found a good solution to this problem. Considering that this problem may only exists in 1.18 and Vampirism currently focuses on 1.16 and 1.19, it could be worth to take a simple workaround instead of a whole fix. But maybe you have a different opinion or solution.

commented

I had looked a bit poorly into the cause of this issue back then. Yes, it does seem that the way FD renders its overlay on 1.18 in specific causes it to never be canceled. @Cheaterpaul is correct in this one.

Since I copied this impl from AppleSkin, that mod also causes an issue with Vampirism. If I recall, I assumed this method was the required way of rendering overlays on 1.18, but I might be wrong here.

I'll see if I can fix this locally on 1.18, then update here. 👍

commented

Fixed on commit 34e1687. Both of FD's overlays are now rendered during their respective levels on event, and are therefore canceled properly by other mods. Should be out in 1.2.2 soon. 👍