Nametags 1.21.10 and color fix

This commit is contained in:
2026-04-08 20:23:58 +02:00
parent b39b19f107
commit 019730c756
4 changed files with 47 additions and 69 deletions
@@ -10,6 +10,7 @@ import net.minecraft.entity.PlayerLikeEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import org.saturnclient.client.player.Roles;
import org.saturnclient.client.player.SaturnPlayer;
@@ -47,11 +48,14 @@ public abstract class PlayerEntityRendererMixin
state.setData(SaturnRenderState.saturnDataKey, player);
if (player != null) {
if (player != null && state.displayName != null) {
MutableText iconText = Text.literal(Roles.getSaturnIndicator())
.styled(style -> style.withColor(Roles.getIconColor(player.uuid)));
state.displayName = iconText.append(state.displayName);
state.displayName = Text.empty()
.append(iconText.copy())
.append(Text.empty().formatted(Formatting.RESET))
.append(state.displayName.copy());
}
}
}