aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatTabs.java
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2023-01-14 15:23:07 -0500
committerWyvest <45589059+Wyvest@users.noreply.github.com>2023-01-14 15:23:07 -0500
commit9234829c2aeb4ca7e2d270273a803dc6e98fd889 (patch)
tree84950cdfe6b1d09bac89e7022bd95a7956d5c060 /src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatTabs.java
parentee8f9de5a156f356e53eb70476f05cd2bf07ae89 (diff)
downloadChatting-9234829c2aeb4ca7e2d270273a803dc6e98fd889.tar.gz
Chatting-9234829c2aeb4ca7e2d270273a803dc6e98fd889.tar.bz2
Chatting-9234829c2aeb4ca7e2d270273a803dc6e98fd889.zip
add smooth messages
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.java12
1 files changed, 2 insertions, 10 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
index 1d29941..d21097d 100644
--- a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatTabs.java
+++ b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin_ChatTabs.java
@@ -1,13 +1,11 @@
package cc.woverflow.chatting.mixin;
-import cc.woverflow.chatting.chat.ChatSearchingManager;
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.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
@@ -17,24 +15,18 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.List;
-import java.util.Locale;
-@Mixin(GuiNewChat.class)
+@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;
- @SuppressWarnings({"FieldCanBeLocal", "unused"})
- private float percentComplete; //betterchat support
@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);
- if (!EnumChatFormatting.getTextWithoutFormattingCodes(chatComponent.getUnformattedText()).toLowerCase(Locale.ENGLISH).contains(ChatSearchingManager.INSTANCE.getLastSearch().toLowerCase(Locale.ENGLISH))) {
- percentComplete = 1.0F;
- }
}
@Inject(method = "setChatLine", at = @At("HEAD"), cancellable = true)
@@ -45,7 +37,7 @@ public abstract class GuiNewChatMixin_ChatTabs {
private void handleChatTabMessage(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) {
if (ChattingConfig.INSTANCE.getChatTabs()) {
if (!ChatTabs.INSTANCE.shouldRender(chatComponent)) {
- percentComplete = 1.0F;
+ ChatTabs.INSTANCE.setHasCancelledAnimation(true);
if (chatLineId != 0) {
deleteChatLine(chatLineId);
}