Mannequin name improvements for 1.21.9->1.21.7 - #1312
Conversation
| private void sendPlayerTeamDisplayName(final UserConnection connection, final MannequinData mannequinData, final Tag displayName) { | ||
| // Send the display name as a team prefix | ||
| final Tag nonNullDisplayName = displayName != null ? displayName : new StringTag("Mannequin"); | ||
| boolean hasName = displayName != null && !displayName.asRawString().isEmpty(); |
There was a problem hiding this comment.
Check if it's a stringtag with an empty value instead of using rawstring, same result but without all the tostring calls
| addTeam.write(Types.STRING, mannequinData.name()); | ||
| addTeam.write(Types.BYTE, mannequinData.hasTeam() ? (byte) 2 : 0); // Mode | ||
| addTeam.write(Types.TRUSTED_TAG, nonNullDisplayName); // Display Name | ||
| addTeam.write(Types.TRUSTED_TAG, hasName ? displayName : new StringTag("Mannequin")); // Display Name |
There was a problem hiding this comment.
Why change empty names to Mannequin?
There was a problem hiding this comment.
It was to match the old behavior, though I then realised it would only show Mannequin when no display name was given, presumably for the temporary entity because the vanilla server always seems to set an empty custom name.
To be honest I'm not sure all this is even necessary for the team display name, I don't think it needs to be unique and it is almost never displayed in-game. Nonetheless, I made a few changes for the other comment so I changed this as well
0356308 to
952997f
Compare
|
Using the profile name was previously intentionally removed https://github.com/ViaVersion/ViaBackwards/pull/1166/changes#diff-9fc9ea9045c8479af18a6a229a32878c47ff24799d37cab9349449f94b172998L426 |
|
Hmm, the PR that made that change didn't go into too much detail on the issue, I can only guess it's
in which case I think it might be because the name wasn't added to the team correctly (in the PR changes, that's still using |
This slightly changes the way mannequin names are handled:
CustomName, its nametag is hidden (by setting the option in its team), which matches 1.21.9+ behavior. Technically in 1.21.9 this depends onCustomNameVisible(otherwise the name can display but only on hover), not sure whether I should change it to match that, because in 1.8 and 1.9 the name is either always displayed or always hidden.I also wanted to remove them from tablist after spawning (for versions that don't have the Listed flag, primarily 1.8) to match the vanilla behavior. Unfortunately, this has to be handled by server implementations because the vanilla 1.8 client needs to render the player at least once to save its skin (amazing implementation), which means the player info remove packet has to be delayed slightly.