Skip to content

Commit

Permalink
Fix Chat Heads detecting on same chat line after wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyvest committed Jul 19, 2024
1 parent 98b31cf commit 72e3a58
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod_name = Chatting
mod_id = chatting
mod_version = 2.0.5-alpha.1
mod_version = 2.0.5-alpha.2
mod_archives_name = Chatting

# Gradle Configuration -- DO NOT TOUCH THESE VALUES.
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/org/polyfrost/chatting/mixin/ChatLineMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,21 @@ public class ChatLineMixin implements ChatLineHook {
@Unique
private ChatLine chatting$fullMessage = null;
@Unique
private static ChatLine chatting$lastChatLine = null;
@Unique
private static final Pattern chatting$pattern = Pattern.compile("(§.)|\\W");

@Inject(method = "<init>", at = @At("RETURN"))
private void onInit(int i, IChatComponent iChatComponent, int chatId, CallbackInfo ci) {
chatting$lastUniqueId++;
chatting$uniqueId = chatting$lastUniqueId;
if (chatting$lastChatLine == ChatHook.currentLine) {
if (chatting$lastPlayerInfo != null) {
return;
}
}
chatting$fullMessage = ChatHook.currentLine;
chatting$lastChatLine = chatting$fullMessage;
chatting$chatLines.add(new WeakReference<>((ChatLine) (Object) this));
NetHandlerPlayClient netHandler = Minecraft.getMinecraft().getNetHandler();
if (netHandler == null) return;
Expand Down

0 comments on commit 72e3a58

Please sign in to comment.