emilyploszaj / emi

A featureful and accessible item and recipe viewer
MIT License
220 stars 46 forks source link

Tooltips rendering behind items #480

Closed pupnewfster closed 2 months ago

pupnewfster commented 3 months ago

When in a Mekanism screen it seems that tooltips render behind the actual items image

I believe this is related to us doing various transformations in order to have more vertical space available for our movable windows, and EMI using mixins rather than events for when renderForeground and renderBackground happen https://github.com/emilyploszaj/emi/blob/1.20.4/xplat/src/main/java/dev/emi/emi/mixin/HandledScreenMixin.java. I am not sure if the background mixin actually causes any issues, but moving NeoForge (and likely Forge) to using the following events instead would probably fix this issue:

Version: 1.1.1+1.20.4

emilyploszaj commented 3 months ago

Actually this is not the case. EmiAgnos.isForge returns true on Neo, so only the renderBackground call is coming from this mixin. That is only responsible for rendering the backgrounds of sidebar panels (like the grid and vanilla themes) which does not seem present in this screenshot. EMI on Neo uses the ContainerScreenEvents for foreground and background rendering as well as the ScreenEvent for foreground rendering for its tooltips. This means when mekanism's screens are triggering these events (automatically or manually) the matrix stack has just been setup in a way that puts stuff in the wrong spot.

As summary, EMI uses events both for rendering stacks in the sidebar and its tooltips.

As an inconsequential sidenote, before EMI used Forge/Neo events for this, the mixin based approach actually did work on mekanism screens, but for compatibility with certain mods it had to be moved away from.

pupnewfster commented 3 months ago

Hmm, I guess I will need to debug further what is going on then

pupnewfster commented 3 months ago

Seems to be related to this line: https://github.com/emilyploszaj/emi/blob/1.20.4/xplat/src/main/java/dev/emi/emi/screen/EmiScreenManager.java#L1647 which moves things forward 100

emilyploszaj commented 2 months ago

The offending line was removed in the latest release