Skip to content

Mannequin name improvements for 1.21.9->1.21.7 - #1312

Open
roccodev wants to merge 1 commit into
ViaVersion:masterfrom
roccodev:feature/mannequin-improvements
Open

Mannequin name improvements for 1.21.9->1.21.7#1312
roccodev wants to merge 1 commit into
ViaVersion:masterfrom
roccodev:feature/mannequin-improvements

Conversation

@roccodev

@roccodev roccodev commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

This slightly changes the way mannequin names are handled:

  • When spawning the second entity, the new name from the profile is now used to name the player info entry. This is nice because it allows registering the mannequin in scoreboard teams.
  • Team registration is only performed when the second entity is spawned, this is because the mannequin's name can change in-between due to the above. Perhaps I could also add a way to disable this, because in some cases (I'd imagine on track/untrack) it may override the team set by the server/plugins?
  • When the mannequin has no 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 on CustomNameVisible (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.

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();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why change empty names to Mannequin?

@roccodev roccodev Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

@roccodev
roccodev force-pushed the feature/mannequin-improvements branch from 0356308 to 952997f Compare September 1, 2026 19:10
@kennytv

kennytv commented Sep 4, 2026

Copy link
Copy Markdown
Member

@roccodev

roccodev commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Hmm, the PR that made that change didn't go into too much detail on the issue, I can only guess it's

that causes us to lose our cool player names

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 mannequinData.name() which wasn't set to the profile name, and I also think the player wasn't registered again to the team after the profile was ready, which this PR mitigates by only registering it then.

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.

2 participants