Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Make sure item tooltips are cached properly #3085

Merged
merged 1 commit into from
Feb 1, 2025

Conversation

kristofbolyai
Copy link
Member

Fixes #3079.

This PR doesn't fix a single issue, rather, it fixes two of them:

  1. The general logic behind TooltipUtils caching was there, but it did not use Objects.equals :(. This unfortunately made it so the tooltips were never pulled from the cache.
  2. FakeItemStack (aka, chat items, and more) had special tooltip building logic, basically they once built a fake tooltip, then it was parsed and rebuilt by ItemStatInfoFeature with slightly different tooltip options. This made the cache to be invalidated every render, and made it so item tooltips were calculated more than one times per render for these items. Now, FakeItemStack generates it's tooltips in a standard way (as every other feature does), making it actually use the cache. Fixing multiple generations per render makes no sense now, as it's mostly part of the design of the system, and with caching present, this virtually presents no overhead.

This PR doesn't fix a single issue, rather, it fixes two of them:
1. The general logic behind TooltipUtils caching was there, but it did not use Objects.equals :(. This unfortunately made it so the tooltips were never pulled from the cache.
2. FakeItemStack (aka, chat items, and more) had special tooltip building logic, basically they once built a fake tooltip, then it was parsed and rebuilt by ItemStatInfoFeature with slightly different tooltip options. This made the cache to be invalidated every render, and made it so item tooltips were calculated more than one times per render for these items. Now, FakeItemStack generates it's tooltips in a standard way (as every other feature does), making it actually use the cache. Fixing multiple generations per render makes no sense now, as it's mostly part of the design of the system, and with caching present, this virtually presents no overhead.
@kristofbolyai kristofbolyai merged commit 62b5ebf into main Feb 1, 2025
1 check passed
@kristofbolyai kristofbolyai deleted the tooltip-rendering-fixes branch February 1, 2025 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warnings are printed during rendering when hovering an item in chat with invalid identification data
2 participants