Wynntils

Wynntils

611k Downloads

Item Tooltip Sizing and Positioning

Kepler-17c opened this issue ยท 15 comments

commented

When I halve my Minecraft window to one side of the screen (yes, I do that sometimes - don't beat me - for item management stuff where I need several things next to each other), the tooltip on some items isn't inside the game window bounds, but it pushed out to the side. It becomes unreadable when the left half of a tooltip is missing.

commented

Can you add a screenshot of this?

I feel there's a decent chance this is just vanilla behavior

commented

As you can see from the squares, I'm on the most recent version (90) as of now.

lol, thanks for pointing that out, it should not happen in production.๐Ÿ˜… See #138 for tracking the issue.

commented

Found that it can also happen in landscape format.

Landscape - in this case a broken item with JSON data as lore - also had this with a long list of roll predictions earlier:
image

Portrait - happens with a great portion of the items:
image

Both screenshots go all the way to the left border of my screen.

commented

That top one is definitely just vanilla behavior - it's not getting affected by the tooltip feature at all since, like the one in legacy wynntils, it only checks the vertical borders of the screen. We could maybe add checks for horizontal borders as well but that's very rarely an issue in-game

That second one is definitely strange though. My guess is that the minecraft rendering system always handles dimensions as if they're 16:9 and does some extra processing for non-standard window sizes that we're not accounting for, but I'll have to look into it further. Could you attach a full screenshot so I know just what shape your window is?

commented

No, I mean it's already implemented - I'll have to switch versions to make sure, but as far as I remember, that broken item stopped at the side and wrapped to the next line

commented

Thought it might be a bit too big, but here you go:

2022-07-04_05 06 44
2022-07-04_05 06 58

commented

As you can see from the squares, I'm on the most recent version (90) as of now.

commented

A solution for the item guesses problem would be wrapping when the text gets too long.

commented

Afaik that's currently the case on the 1.12.2 version

commented

Yeah it might be good to consider that for 1.12.2 version. Another alternative is to further split from the four possible levels, one line for each level.

commented

I did some testing, and it seems like this wrapping issue is only present with fabric and quilt (this is also the vanilla behavior). However with forge the wrapping works perfectly fine, the same as in 1.12.
I searched for the code making it possible in forge, but couldn't find the implementation (the method was empty).

commented

I did some testing, and it seems like this wrapping issue is only present with fabric and quilt (this is also the vanilla behavior). However with forge the wrapping works perfectly fine, the same as in 1.12.

I searched for the code making it possible in forge, but couldn't find the implementation (the method was empty).

What was the method name? Was it not overwritten by something?

commented

correction: turns out screen::renderComponentHoverEffect is used when you hover over a hoverable text component. The wrapping seems to be working fine when hovering the text.

commented

What was the method name? Was it not overwritten by something?

I did some more searching and found how forge actually does it ForgeHooksClient::gatherTooltipComponents
But I also found some code which supposedly already does this wrapping in the vanilla code (it doesn't) screen::renderComponentHoverEffect

commented

I will check out these and probably just implement forge behavior for the mod. We will need to disable the mod's code in Forge though, that will need a small change in the common side.