mojira.dev
MC-112742

Name of unnamed villager is rendered with TeamColor instead of prefix and suffix of scoreboard team

The bug

The scoreboard team color is stored in the TeamColor tag and in the Prefix and Suffix tag. The TeamColor is in general used to determine which scoreboard objective should be displayed on the sidebar and which team should get team kills.
The problem is that for unnamed villagers this value is used for rendering their name, while for named villagers the prefix and suffix is correctly used.

Because Prefix and Suffix tags exists modifying them using NBT editors should not make this report invalid, because otherwise there would not even be a need for these tags.

How to reproduce

  1. Create a team

    /scoreboard teams add colorTest
  2. Leave the world and modify team data in the scoreboard.dat file of the world, with for example NBTExplorer, like this:

    Prefix: "ยง6"
    TeamColor: "green"
  3. Open the world again

  4. Summon two villagers

    /summon villager ~ ~ ~ {Team:"colorTest"}
    /summon villager ~ ~ ~ {Team:"colorTest",CustomName:"Some name"}
  5. Use the following command

    /say @e[team=colorTest]

    โ†’ The villager with the custom name uses the prefix color while the villager without a custom name uses the TeamColor

Code analysis

Based on 1.11.2 decompiled using MCP 9.35 rc1

The method net.minecraft.entity.passive.EntityVillager.getDisplayName() calls net.minecraft.entity.passive.EntityVillager.getDisplayName() while it should call net.minecraft.scoreboard.ScorePlayerTeam.formatPlayerName(Team, String).

Linked issues

Comments 2

This is "fixed" by prefix/suffix no longer existing, and everything goes by TeamColor instead.

Dinnerbone, can the prefix/suffix thing be a supported feature in /team option, rather then to do the old hacky solution of doing it through NBT editing? I liked how one could add prefixes/suffixes into teams before that became patched in 18w01a. Please give a response on this, I would greatly appreciate it if you do ๐Ÿ™‚

marcono1234

Nathan Adams

Confirmed

formatting, scoreboard, scoreboard-color-names, scoreboard-teams, team

Minecraft 1.11.2

Minecraft 18w01a

Retrieved