diff options
author | Moo2meenn <67310794+Moo2meenn@users.noreply.github.com> | 2022-05-06 18:50:33 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-06 18:50:33 +0300 |
commit | b96de6230299c751d0d3953c6546992efccb1111 (patch) | |
tree | d9db5ea005b8084b08c639096b42d3e5f6cc517e /src/main/java/cc | |
parent | 1046d78d70f074074dcf5c4ce522c8dc83654242 (diff) | |
parent | dae58987b89bc01fa2828b5f4840a594f416f592 (diff) | |
download | Chatting-b96de6230299c751d0d3953c6546992efccb1111.tar.gz Chatting-b96de6230299c751d0d3953c6546992efccb1111.tar.bz2 Chatting-b96de6230299c751d0d3953c6546992efccb1111.zip |
Merge branch 'main' into fix-buttons-height
Diffstat (limited to 'src/main/java/cc')
3 files changed, 12 insertions, 1 deletions
diff --git a/src/main/java/cc/woverflow/chatting/mixin/EntityPlayerSPMixin.java b/src/main/java/cc/woverflow/chatting/mixin/EntityPlayerSPMixin.java index 42c5579..2c19b0f 100644 --- a/src/main/java/cc/woverflow/chatting/mixin/EntityPlayerSPMixin.java +++ b/src/main/java/cc/woverflow/chatting/mixin/EntityPlayerSPMixin.java @@ -12,7 +12,7 @@ public class EntityPlayerSPMixin { @ModifyVariable(method = "sendChatMessage", at = @At("HEAD"), ordinal = 0, argsOnly = true) private String handleSentMessages(String value) { if (value.startsWith("/")) return value; - if (ChattingConfig.INSTANCE.getChatTabs() && ChatTabs.INSTANCE.getCurrentTab() != null && !ChatTabs.INSTANCE.getCurrentTab().getPrefix().isEmpty()) { + if (ChattingConfig.INSTANCE.getChatTabs() && ChatTabs.INSTANCE.getCurrentTab() != null && ChatTabs.INSTANCE.getCurrentTab().getPrefix() != null && !ChatTabs.INSTANCE.getCurrentTab().getPrefix().isEmpty()) { return ChatTabs.INSTANCE.getCurrentTab().getPrefix() + value; } else { return value; 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); } |