aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc
diff options
context:
space:
mode:
authorCephetir <silyichev@gmail.com>2022-05-06 12:41:54 +0300
committerCephetir <silyichev@gmail.com>2022-05-06 12:41:54 +0300
commitb5002d403246d91b8276791c1d16847abbbadab9 (patch)
treec011350cd8b1e29252edf672c68bbcb7cbc2a28d /src/main/java/cc
parentd3b3d5273d6754c991d6ba9a69884071a8e56c91 (diff)
downloadChatting-b5002d403246d91b8276791c1d16847abbbadab9.tar.gz
Chatting-b5002d403246d91b8276791c1d16847abbbadab9.tar.bz2
Chatting-b5002d403246d91b8276791c1d16847abbbadab9.zip
Timestamp on hover
Diffstat (limited to 'src/main/java/cc')
-rw-r--r--src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java9
1 files changed, 9 insertions, 0 deletions
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);
}