aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt12
2 files changed, 21 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index eb0aa48dd..938a0326f 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -6,8 +6,10 @@ import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.features.dungeon.DungeonData
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.StringUtils.toDashlessUUID
+import io.github.moulberry.notenoughupdates.mixins.AccessorGuiEditSign
import io.github.moulberry.notenoughupdates.util.SkyBlockTime
import net.minecraft.client.Minecraft
+import net.minecraft.client.gui.inventory.GuiEditSign
import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.SharedMonsterAttributes
import net.minecraft.util.ChatComponentText
@@ -189,4 +191,11 @@ object LorenzUtils {
}
}
}
+
+ fun setTextIntoSign(text: String) {
+ val gui = Minecraft.getMinecraft().currentScreen
+ if (gui !is GuiEditSign) return
+ gui as AccessorGuiEditSign
+ gui.tileSign.signText[0] = ChatComponentText(text)
+ }
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt
index 3819573c3..5089b4d82 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt
@@ -4,7 +4,9 @@ import net.minecraft.client.settings.KeyBinding
import org.lwjgl.input.Keyboard
import java.awt.Desktop
import java.awt.Toolkit
+import java.awt.datatransfer.DataFlavor
import java.awt.datatransfer.StringSelection
+import java.awt.datatransfer.UnsupportedFlavorException
import java.io.IOException
import java.net.URI
@@ -27,6 +29,16 @@ object OSUtils {
Toolkit.getDefaultToolkit().systemClipboard.setContents(StringSelection(text), null)
}
+ fun readFromClipboard(): String? {
+ val systemClipboard = Toolkit.getDefaultToolkit().systemClipboard ?: return null
+ try {
+ val data = systemClipboard.getData(DataFlavor.stringFlavor) ?: return null
+ return data.toString()
+ } catch (e: UnsupportedFlavorException) {
+ return null
+ }
+ }
+
fun KeyBinding.isActive() : Boolean {
if (!Keyboard.isCreated()) return false
try {