aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/raeids
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2021-12-21 23:58:41 +0700
committerWyvest <45589059+Wyvest@users.noreply.github.com>2021-12-21 23:58:41 +0700
commitf5ac8fd82564fdfefba5db52b2e0b150c900cf58 (patch)
tree9e9a7c9f1e421794317c4609e510af7971fcc4b5 /src/main/kotlin/com/raeids
parent7ffe65977bef2a34262cf8690ba335ae5d915ef0 (diff)
downloadChatting-f5ac8fd82564fdfefba5db52b2e0b150c900cf58.tar.gz
Chatting-f5ac8fd82564fdfefba5db52b2e0b150c900cf58.tar.bz2
Chatting-f5ac8fd82564fdfefba5db52b2e0b150c900cf58.zip
copy chat message
Diffstat (limited to 'src/main/kotlin/com/raeids')
-rw-r--r--src/main/kotlin/com/raeids/stratus/Stratus.kt16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/kotlin/com/raeids/stratus/Stratus.kt b/src/main/kotlin/com/raeids/stratus/Stratus.kt
index 653c265..ba2e739 100644
--- a/src/main/kotlin/com/raeids/stratus/Stratus.kt
+++ b/src/main/kotlin/com/raeids/stratus/Stratus.kt
@@ -3,6 +3,7 @@ package com.raeids.stratus
import com.raeids.stratus.command.StratusCommand
import com.raeids.stratus.config.StratusConfig
import com.raeids.stratus.hook.ChatTabs
+import com.raeids.stratus.hook.GuiNewChatHook
import com.raeids.stratus.mixin.GuiNewChatAccessor
import com.raeids.stratus.updater.Updater
import com.raeids.stratus.utils.RenderHelper
@@ -14,6 +15,7 @@ import net.minecraft.client.gui.GuiChat
import net.minecraft.client.renderer.GlStateManager
import net.minecraft.client.settings.KeyBinding
import net.minecraft.client.shader.Framebuffer
+import net.minecraftforge.client.event.MouseEvent
import net.minecraftforge.common.MinecraftForge.EVENT_BUS
import net.minecraftforge.fml.client.registry.ClientRegistry
import net.minecraftforge.fml.common.Mod
@@ -22,6 +24,8 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
import org.lwjgl.input.Keyboard
+import java.awt.Toolkit
+import java.awt.datatransfer.StringSelection
import java.io.File
import java.io.IOException
import java.text.SimpleDateFormat
@@ -65,6 +69,18 @@ object Stratus {
}
@SubscribeEvent
+ fun onMouseClick(event: MouseEvent) {
+ val hook = Minecraft.getMinecraft().ingameGUI.chatGUI as GuiNewChatHook
+ if (hook.shouldCopy()) {
+ try {
+ Toolkit.getDefaultToolkit().systemClipboard.setContents(StringSelection(hook.copyString()), null)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ }
+ }
+
+ @SubscribeEvent
fun onTickEvent(event: TickEvent.ClientTickEvent) {
if (event.phase == TickEvent.Phase.START && Minecraft.getMinecraft().theWorld != null && Minecraft.getMinecraft().thePlayer != null && (Minecraft.getMinecraft().currentScreen == null || Minecraft.getMinecraft().currentScreen is GuiChat)) {
if (doTheThing) {