Chat Heads

Chat Heads

35M Downloads

[BUG] Avatar stays left, regardless of where the player's name is positioned.

EmptyDreams opened this issue · 8 comments

commented

As shown, even if the player's name appears in the middle of the sentence, the mod will still add the avatar to the far left of the chat message.

image

In the image, "Violetoast" is the player's name.

This message is sent by the server using ServerPlayer#sendSystemMessage, with the player's name obtained from Player#name.

Indeed, it would be more appropriate for the avatar to be displayed next to the player's name or not at all for system messages, as placing the avatar on the left can lead to confusion about the message's origin.

minecraft: 1.20.1
fabric loader: 0.15.11
fabirc api: 0.92.2
chat heads: 0.12.7
commented

Yeah, that's a current limitation of how Chat Heads renders the heads. Affects #68 too. This needs a complete rewrite, though I can already see some issues with that way as well (like needing to find the head position even for messages that we don't scan for names - and mod compatibility as always). I also feel that people will request adding heads onto all occurences of names, but I guess one can worry about that later.

May get on that once I'm fit again.

Indeed, it would be more appropriate for the avatar to be displayed next to the player's name or not at all for system messages

The "not at all for system messages" is not doable on most servers since they commonly translate all messages to system messages and don't leave any identifying sender information like UUIDs or /tell click events, so we have to scan for names, leading to false positives. If you know your server doesn't do this, you can disable the "heuristic" sender detection or turn off handling of system messages in the config - wouldn't recommend either if you're planning to play on different servers though.

I apologize for not noticing that these configurations could be modified in the configuration file.
I look forward to the mod making more eye-catching improvements in the future.

commented

Yeah, that's a current limitation of how Chat Heads renders the heads. Affects #68 too.
This needs a complete rewrite, though I can already see some issues with that way as well (like needing to find the head position even for messages that we don't scan for names - and mod compatibility as always).
I also feel that people will request adding heads onto all occurences of names, but I guess one can worry about that later.

May get on that once I'm fit again.

Indeed, it would be more appropriate for the avatar to be displayed next to the player's name or not at all for system messages

The "not at all for system messages" is not doable on most servers since they commonly translate all messages to system messages and don't leave any identifying sender information like UUIDs or /tell click events, so we have to scan for names, leading to false positives.
If you know your server doesn't do this, you can disable the "heuristic" sender detection or turn off handling of system messages in the config - wouldn't recommend either if you're planning to play on different servers though.

commented

After some cursed attempts...

(Rendering everywhere except where they should)

cursed2
(Literally everywhere!)
(And don't even get me started how cursed the code got in some attempts)

I finally got some success with a relatively simple solution!

It's still incomplete and probably incorrect (unicode stuff), but at least there's progress.

That's it, just a status report.
Will hopefully finish this in the next few days.

commented

Made a test build, which seems to work but may have some kinks if you wanna give it a try.
You need to change the "Render Position" config option to "Before Name".

commented

Made a new test build.
Seems pretty stable, need backport the changes to test them for #68.

commented

Okay, tried backporting and running with Chat Timestamps:
dang
And that's exactly what I feared would happen.
The message is modified after the head and its position are already determined.

Okay, no problem, just find the position at a later time, fixed!
f

But I remember I intentionally placed the code that early for compatibility with Compact Chat... Let's see...
aaaa

Darnit, how can this issue be so cursed?

commented

Okay, looks like I managed to fix that too - even though the two mods aren't really compatible anyway (whenever Compact Chat combines two messages into one, all the timestamps update to the current time).
Everything appears to work correctly with multiple players and even when § formatting is involved too!

fixed

So now I "just" need to clean up the code, remove an optimization and forward/backport everything for all versions...

commented

it_is_done

0.13 now has the new "before name" rendering and uses it by default.
The old "before line" rendering can still be used by changing the "render position" setting.