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/GuiNewChatMapMixin.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/GuiNewChatMapMixin.java')
-rw-r--r-- | src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMapMixin.java | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMapMixin.java b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMapMixin.java deleted file mode 100644 index 5b38bda..0000000 --- a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMapMixin.java +++ /dev/null @@ -1,78 +0,0 @@ -package cc.woverflow.chatting.mixin; - -import cc.woverflow.chatting.hook.GuiNewChatHook; -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.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Mixin(value = GuiNewChat.class, priority = Integer.MIN_VALUE) -public abstract class GuiNewChatMapMixin implements GuiNewChatHook { - - @Unique private final Map<ChatLine, ChatLine> drawnToFull = new HashMap<>(); - @Unique private final List<ChatLine> tempDrawnLines = new ArrayList<>(); - @Unique private ChatLine lastTempLine = null; - - @Shadow @Final private List<ChatLine> drawnChatLines; - @Shadow @Final private List<ChatLine> chatLines; - - @Inject(method = "setChatLine", at = @At("HEAD")) - private void handleSetChatLine(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { - tempDrawnLines.clear(); - } - - @Inject(method = "setChatLine", at = @At(value = "INVOKE", target = "Ljava/util/List;add(ILjava/lang/Object;)V", ordinal = 0, shift = At.Shift.AFTER, remap = false)) - private void handleDrawnLineAdded(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { - if (!displayOnly) tempDrawnLines.add(drawnChatLines.get(0)); - else if (lastTempLine != null) { - drawnToFull.put(drawnChatLines.get(0), lastTempLine); - } - } - - @Inject(method = "setChatLine", at = @At(value = "INVOKE", target = "Ljava/util/List;remove(I)Ljava/lang/Object;", ordinal = 0, shift = At.Shift.BEFORE, remap = false)) - private void handleDrawnLineRemoved(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { - drawnToFull.remove(drawnChatLines.get(drawnChatLines.size() - 1)); - } - - @Inject(method = "setChatLine", at = @At("RETURN")) - private void handleLineAdded(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { - if (!displayOnly) { - ChatLine masterLine = chatLines.get(0); - for (ChatLine tempDrawnLine : tempDrawnLines) drawnToFull.put(tempDrawnLine, masterLine); - }else { - lastTempLine = null; - } - } - - @Inject(method = "refreshChat", at = @At("HEAD")) - private void handleRefreshedChat(CallbackInfo ci) { - drawnToFull.clear(); - } - - @Inject(method = "refreshChat", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiNewChat;setChatLine(Lnet/minecraft/util/IChatComponent;IIZ)V", ordinal = 0, shift = At.Shift.BEFORE)) - private void handleLineRefresh(CallbackInfo ci, int i, ChatLine chatline) { - lastTempLine = chatline; - } - - @Inject(method = "clearChatMessages", at = @At("HEAD")) - private void handleChatCleared(CallbackInfo ci) { - drawnToFull.clear(); - } - - @Override - public ChatLine getFullMessage(ChatLine line) { - return drawnToFull.getOrDefault(line, null); - } -} |