diff options
author | Wyvest <wyvestbusiness@gmail.com> | 2023-11-22 08:18:19 +0900 |
---|---|---|
committer | Wyvest <wyvestbusiness@gmail.com> | 2023-11-22 08:18:19 +0900 |
commit | 8b373f577d9c6dde26357ef3fc86691f1efef9b4 (patch) | |
tree | a5328e995d8f4df21a9fe94ac8e384be08833c70 /src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatTabs.java | |
parent | 64230799777473246b5f98efbc596206c5bbf42d (diff) | |
download | Chatting-8b373f577d9c6dde26357ef3fc86691f1efef9b4.tar.gz Chatting-8b373f577d9c6dde26357ef3fc86691f1efef9b4.tar.bz2 Chatting-8b373f577d9c6dde26357ef3fc86691f1efef9b4.zip |
update PGT and relocate to org.polyfrost
Diffstat (limited to 'src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatTabs.java')
-rw-r--r-- | src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatTabs.java | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatTabs.java b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatTabs.java deleted file mode 100644 index d21097d..0000000 --- a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatTabs.java +++ /dev/null @@ -1,54 +0,0 @@ -package cc.woverflow.chatting.mixin; - -import cc.woverflow.chatting.chat.ChatTabs; -import cc.woverflow.chatting.config.ChattingConfig; -import cc.woverflow.chatting.utils.ModCompatHooks; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.ChatLine; -import net.minecraft.client.gui.GuiNewChat; -import net.minecraft.util.IChatComponent; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import java.util.List; - -@Mixin(value = GuiNewChat.class, priority = 990) -public abstract class GuiNewChatMixin_ChatTabs { - @Shadow @Final private Minecraft mc; - - @Shadow public abstract void deleteChatLine(int id); - - @Shadow @Final private List<ChatLine> chatLines; - - @Inject(method = "printChatMessageWithOptionalDeletion", at = @At("HEAD"), cancellable = true) - private void handlePrintChatMessage(IChatComponent chatComponent, int chatLineId, CallbackInfo ci) { - handleChatTabMessage(chatComponent, chatLineId, mc.ingameGUI.getUpdateCounter(), false, ci); - } - - @Inject(method = "setChatLine", at = @At("HEAD"), cancellable = true) - private void handleSetChatLine(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { - handleChatTabMessage(chatComponent, chatLineId, updateCounter, displayOnly, ci); - } - - private void handleChatTabMessage(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { - if (ChattingConfig.INSTANCE.getChatTabs()) { - if (!ChatTabs.INSTANCE.shouldRender(chatComponent)) { - ChatTabs.INSTANCE.setHasCancelledAnimation(true); - if (chatLineId != 0) { - deleteChatLine(chatLineId); - } - if (!displayOnly) { - chatLines.add(0, new ChatLine(updateCounter, chatComponent, chatLineId)); - while (this.chatLines.size() > (100 + ModCompatHooks.getExtendedChatLength())) { - this.chatLines.remove(this.chatLines.size() - 1); - } - } - ci.cancel(); - } - } - } -} |