diff options
Diffstat (limited to 'src/main/java/cc/woverflow/chatting')
-rw-r--r-- | src/main/java/cc/woverflow/chatting/mixin/GuiChatMixin.java | 2 | ||||
-rw-r--r-- | src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/cc/woverflow/chatting/mixin/GuiChatMixin.java b/src/main/java/cc/woverflow/chatting/mixin/GuiChatMixin.java index e3edf95..1774f82 100644 --- a/src/main/java/cc/woverflow/chatting/mixin/GuiChatMixin.java +++ b/src/main/java/cc/woverflow/chatting/mixin/GuiChatMixin.java @@ -5,6 +5,7 @@ import cc.woverflow.chatting.chat.ChatShortcuts; import cc.woverflow.chatting.chat.ChatTab; import cc.woverflow.chatting.chat.ChatTabs; import cc.woverflow.chatting.config.ChattingConfig; +import cc.woverflow.chatting.gui.components.ClearButton; import cc.woverflow.chatting.gui.components.ScreenshotButton; import cc.woverflow.chatting.gui.components.SearchButton; import cc.woverflow.chatting.hook.GuiNewChatHook; @@ -51,6 +52,7 @@ public abstract class GuiChatMixin extends GuiScreen { buttonList.add(searchButton); } buttonList.add(new ScreenshotButton()); + buttonList.add(new ClearButton()); if (ChattingConfig.INSTANCE.getChatTabs()) { for (ChatTab chatTab : ChatTabs.INSTANCE.getTabs()) { buttonList.add(chatTab.getButton()); diff --git a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java index e9acce1..6cf58ef 100644 --- a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java +++ b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java @@ -72,6 +72,14 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { handleChatTabMessage(chatComponent, chatLineId, updateCounter, displayOnly, ci); } + @Inject(method = "setChatLine", at = @At(value = "INVOKE", target = "Ljava/util/List;add(ILjava/lang/Object;)V"), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiNewChat;scroll(I)V"), to = @At(value = "INVOKE", target = "Ljava/util/List;size()I")), cancellable = true) + private void handleAddDrawnLine(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { + ci.cancel(); + ChatLine chatLine = new ChatLine(updateCounter, chatComponent, chatLineId); + RenderUtils.messages.put(chatLine, System.currentTimeMillis()); + this.drawnChatLines.add(0, chatLine); + } + @Inject(method = "drawChat", at = @At("HEAD")) private void checkScreenshotKeybind(int j2, CallbackInfo ci) { if (Chatting.INSTANCE.getKeybind().isPressed()) { @@ -133,6 +141,7 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { @Redirect(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;drawStringWithShadow(Ljava/lang/String;FFI)I")) private int redirectDrawString(FontRenderer instance, String text, float x, float y, int color) { + RenderUtils.showTimestamp(); return ModCompatHooks.redirectDrawString(text, x, y, color); } |