Tweakeroo

Tweakeroo

2M Downloads

[1.20.1 Fabric] Tweakeroo shouldn't prepend timestamps onto messages if `refresh` is true

caoimhebyrne opened this issue ยท 3 comments

commented

At the minute, Tweakeroo adds timestamps to any message that's sent, even ones that are sent during the refresh period.

This refresh period only re-sends messages which have already been sent, and is used by some mods (like mine, CompactChat) to ensure that the chat view is up-to-date with removed messages.

The refresh() function's definition in ChatHud, as of 1.20.1:

CleanShot 2023-07-14 at 16 31 59@2x

Tweakeroo's injection point:

@ModifyVariable(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;ILnet/minecraft/client/gui/hud/MessageIndicator;Z)V",
at = @At("HEAD"), argsOnly = true)
private Text tweakeroo_addMessageTimestamp(Text componentIn)
{

As you can see above, Twaekeroo doesn't take the refresh parameter at the end into account, meaning that it just adds timestamps to all messages.

This results with timestamps being falsely-updated when refresh() is called (the original message's creation date should stay intact), and it also gets duplicated in certain instances.
CleanShot 2023-07-14 at 16 33 20@2x

For reference, this is my mod's injection point (albeit slightly outdated, I'm updating the priority to 9999 so that I can add support for Tweakeroo, but this issue is also blocking that):

https://github.com/caoimhebyrne/compact-chat/blob/5c8c57eef45354f47df929561d8240754aec3b49/src/main/java/dev/caoimhe/compactchat/mixin/ChatHudMixin.java#L36-L45

commented

I'll make a PR for this issue, but if there's a reason that I shouldn't do it, let me know

commented

In general my client mods' code has been rotting away for several major MC releases by now. The mod updates to many of the recent MC versions have been PR'd in by others. I know there are several features and code areas that haven't been properly updated to all the vanilla changes and new features. I intend to go through and clean up and rewrite where needed everything once I start porting the newer development code from 1.12.2 to the later versions. For now the mods are basically in least effort life support mode, to remain mostly usable for players. So yes PR away.

commented

@maruohon Awesome! I've opened a PR. This should also fix an issue that occurs when a message has been removed by the server (I've never seen that happen though, it's just in the code)