@@ -76,6 +76,7 @@ public class ChatHeads {
7676 public static float lastOpacity = 0.0f ;
7777 public static int lastChatOffset ;
7878 public static boolean serverSentUuid = false ;
79+ public static boolean serverSentCustomCharacter = false ;
7980
8081 public static final Set <ResourceLocation > blendedHeadTextures = new HashSet <>();
8182
@@ -92,6 +93,19 @@ public static void resetLineOwner() {
9293 }
9394
9495 public static void handleAddedMessage (Component message , @ Nullable ChatType .Bound bound , @ Nullable PlayerInfo playerInfo ) {
96+ if (!ChatHeads .serverSentCustomCharacter ) {
97+ Component sender = getSenderDecoration (bound );
98+ if (sender != null && containsCustomCharacters (sender ) || containsCustomCharacters (message )) {
99+ ChatHeads .serverSentCustomCharacter = true ;
100+ }
101+ }
102+
103+ // TODO check assets
104+ if (ChatHeads .serverSentCustomCharacter ) {
105+ ChatHeads .lastSender = null ;
106+ return ;
107+ }
108+
95109 if (ChatHeads .CONFIG .senderDetection () != HEURISTIC_ONLY ) {
96110 if (playerInfo != null ) {
97111 ChatHeads .lastSender = playerInfo ;
@@ -182,6 +196,11 @@ private static PlayerInfo getPlayerInfo(String name, ClientPacketListener connec
182196 return getPlayerFromNickname (name , connection , nicknameCache );
183197 }
184198
199+ public static boolean containsCustomCharacters (Component component ) {
200+ // characters \uE000-\uE007 are used for drawing heads in vanilla clients via a custom font
201+ return component .getString ().codePoints ().filter (c -> '\uE000' <= c && c <= '\uE007' ).findAny ().isPresent ();
202+ }
203+
185204 /**
186205 * Finds a value v in `collection` such that `keyFunction(v)` equals `key`.
187206 * Uses an (initially empty) cache to speed up subsequent calls.
0 commit comments