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 for plugins that use display entities as nametag #5157

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

Conversation

alexdev03
Copy link

Implemented a simple formula that calculates y offset based on the lines the display entity has. It's not perfect for higher values but for values up to 4/5 is close to vanilla.

image
image

Vector3f displayTranslation = textDisplay.getTranslation();
if (displayTranslation != null && textDisplay.getText() != null) {
int lines = PlainTextComponentSerializer.plainText().serialize(textDisplay.getText()).split("\n").length;
float multiplier = (float) Math.max(0.22f, 0.45f - (0.06f * Math.floor((lines - 4) / 2f)));
Copy link
Member

Choose a reason for hiding this comment

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

Can we get some info on what all these numbers are?

Copy link
Author

Choose a reason for hiding this comment

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

I did some tests with multiple lines, then I gave an ai those tests and it gave me a function that follows a pattern based on the number of lines

Copy link
Member

Choose a reason for hiding this comment

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

Can we get this info verified?
And I think that it'd also be nice that we assert the behaviour by adding some tests for it

Copy link
Member

@rtm516 rtm516 left a comment

Choose a reason for hiding this comment

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

Hopefully this removes the private Component text as we don't seem to need it stored anywhere. Feel free to correct me if I'm wrong.

@alexdev03
Copy link
Author

Is there something else you want me to change? I'd like to push an update for my plugin that adds support for bedrock but I'm waiting for this pr.
If you want to test this pr you could use my plugin, branch dev: https://github.com/alexdev03/UnlimitedNametags

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.

4 participants