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

Item stack name tooltip API #11033

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

radstevee
Copy link

This adds an API for getting whether the current item stack that the player is holding is showing its name as a tooltip. It's important to note that this behavior can be configured via the accessbility settings, under notification time. This is still very useful for server owners, e.g. when you have a UI Overlay in your action bar, which is slightly shifted downwards using fonts, this can collide with the item's name tooltip. But instead, with this API, you can detect if it's shown and then raise the overlay a bit. Here is an example of this in action (not made by me):

avoiding_item_name_tooltip_collisions_with_overlays.mp4

@radstevee radstevee requested a review from a team as a code owner July 7, 2024 09:00
@lynxplay
Copy link
Contributor

lynxplay commented Jul 7, 2024

Welcome to paper 🎉 Thank you for your first PR!

Feel free to ask in the discord if you have any questions on the feedback!
I like the concept of the PR otherwise.

Copy link
Contributor

@lynxplay lynxplay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs general re-evaluation on its usefulness/api usage.

Given the server has 0 authority over this, the PR adds a nice utility (certainly) but said utility cannot be consistent (as evident by the javadocs).

Needs more input of how worth this utility is.

@Malfrador
Copy link
Member

Malfrador commented Jul 15, 2024

As someone who does the things mentioned in the PR with the action bar, this is certainly very useful.

And it's clearly mentioned in the Javadocs that the server is limited in predicting it.
Maintenance cost should be very low too.

However maybe just exposing itemStackChangeTime directly would make more sense? Then that value could also be used for other things (though I am not sure what those could be), without needing to keep track of it in the ItemHeldEvent

@radstevee
Copy link
Author

I feel like publishing both would make the most sense here as it's the best of both worlds

@NonSwag
Copy link
Contributor

NonSwag commented Oct 14, 2024

I think having isItemNameTooltipEstimatedToBeVisible is too unpredictable because of the already mentioned fact that it is entirely controller by the client and the server doesn't know the tooltip visibility at all
I would suggest only exposing the time in ticks like vanilla already has and plugins can use it like they want

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Changes required
Development

Successfully merging this pull request may close these issues.

4 participants