[Bug]: As of JEI 15.8.x for Forge, `RenderTooltipEvent.GatherComponents` is no longer fired
squeek502 opened this issue · 9 comments
Steps to Reproduce the Bug
AppleSkin tooltips are no longer rendered in the JEI side pane when hovering over food items.
Expected Behavior
In 15.4.x and before, RenderTooltipEvent.GatherComponents
was fired and AppleSkin's FoodTooltipRenderer.renderImage
was called from here:
Actual Behavior
In 15.8.x, guiGraphics.renderTooltipInternal
is called instead, which bypasses the RenderTooltipEvent.GatherComponents
call:
Extra Notes
Unsure if not firing RenderTooltipEvent.GatherComponents
is intentional. Let me know if there's a different intended method of providing tooltip components to JEI.
Relevant AppleSkin issue: squeek502/AppleSkin#314
I need a open a bunch of PRs with Forge and NeoForge to get this properly supported, please bear with me lol
Starting with 1.20.1 Forge here:
1.21 NeoForge:
1.21 Forge:
Thanks for the report!
We made some changes in order to add fancy extra info to tooltips, I'll look into how I can restore support for this event.
Appreciate the quick fix. Tested Forge/1.20.1 and NeoForge/1.21 and everything looks good.
I have pushed a fix for this in 1.21, using the new NeoForge changes that were merged.
Forge changes haven't been merged yet, so I just wrote a hacky workaround for now in 1.20.1 and 1.21.
Please try it out (15.8.0.17
+) and let me know if you see any more issues!
Nice, thanks for confirming!
I'll leave this open until Forge merges my changes and I can get the "proper" fixes in.
Note that the changes to the Fabric RenderHelper
in 60a276d broke AppleSkin tooltip rendering in the JEI side pane.
On Fabric, it's only possible to return a single TooltipComponent
per ItemStack, so the (janky) strategy I took for AppleSkin was:
- Add a
FormattedText
dummy to the list returned fromItemStack.getTooltip
that contains aTooltipComponent
/ClientTooltipComponent
within it - Hook
ClientTooltipComponent::create
to return the smuggledClientTooltipComponent
when converting fromFormattedText
The problem introduced in 60a276d is the font.split(text, 400)
which converts the custom FoodOverlayTextComponent
into a string (which ends up empty) and then back into FormattedText
and then into a ClientTooltipComponent
, thus losing the smuggled FoodOverlay
in the process.
This same sort of thing came up with REI, and the really janky fix used for that was to add an REI plugin that walks the tooltip, finds the FoodOverlayTextComponent
, then deletes it from the tooltip and re-adds the smuggled FoodOverlay
directly. Context from when that was implemented is here: shedaniel/RoughlyEnoughItems#645
I don't have a suggested fix; I'm open to any ideas.
Going with a mixin targeting RenderHelper.renderTooltip
for now that swaps out the FormattedText for the TooltipComponent it's smuggling (squeek502/AppleSkin@4c91b58). I'll leave it up to you to decide if you want to support this use case more formally.