-
-
Notifications
You must be signed in to change notification settings - Fork 686
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
base: master
Are you sure you want to change the base?
Conversation
core/src/main/java/org/geysermc/geyser/entity/type/TextDisplayEntity.java
Outdated
Show resolved
Hide resolved
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))); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
Removed useless offset
core/src/main/java/org/geysermc/geyser/entity/type/TextDisplayEntity.java
Show resolved
Hide resolved
There was a problem hiding this 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.
core/src/main/java/org/geysermc/geyser/entity/type/TextDisplayEntity.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/geysermc/geyser/entity/type/TextDisplayEntity.java
Outdated
Show resolved
Hide resolved
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. |
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.