aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/dulkirfabric/commands
diff options
context:
space:
mode:
authorronald <inglettronald@gmail.com>2023-07-30 19:58:05 -0500
committerronald <inglettronald@gmail.com>2023-07-30 19:58:05 -0500
commitc3af0d9cd112cbe71966c57cbbf914346faadfc3 (patch)
treea9237fadb90d85f97d5780751b0a7ab1549dae28 /src/main/kotlin/com/dulkirfabric/commands
parent1078df493e6473f0b5cfa0409857c16e6fd60f53 (diff)
downloadDulkirMod-Fabric-c3af0d9cd112cbe71966c57cbbf914346faadfc3.tar.gz
DulkirMod-Fabric-c3af0d9cd112cbe71966c57cbbf914346faadfc3.tar.bz2
DulkirMod-Fabric-c3af0d9cd112cbe71966c57cbbf914346faadfc3.zip
Added more HUD stuff and clipboard BUGFIX
Diffstat (limited to 'src/main/kotlin/com/dulkirfabric/commands')
-rw-r--r--src/main/kotlin/com/dulkirfabric/commands/AnimationCommand.kt17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/commands/AnimationCommand.kt b/src/main/kotlin/com/dulkirfabric/commands/AnimationCommand.kt
index 39a9f11..6a8829d 100644
--- a/src/main/kotlin/com/dulkirfabric/commands/AnimationCommand.kt
+++ b/src/main/kotlin/com/dulkirfabric/commands/AnimationCommand.kt
@@ -1,17 +1,14 @@
package com.dulkirfabric.commands
+import com.dulkirfabric.DulkirModFabric.mc
import com.dulkirfabric.config.DulkirConfig
-import com.dulkirfabric.util.render.AnimationPreset
import com.dulkirfabric.util.TextUtils
+import com.dulkirfabric.util.render.AnimationPreset
import com.google.gson.Gson
import com.mojang.brigadier.CommandDispatcher
import com.mojang.brigadier.builder.LiteralArgumentBuilder
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource
import net.minecraft.command.CommandRegistryAccess
-import java.awt.Toolkit
-import java.awt.datatransfer.Clipboard
-import java.awt.datatransfer.DataFlavor
-import java.awt.datatransfer.StringSelection
import java.util.*
object AnimationCommand {
@@ -51,8 +48,7 @@ object AnimationCommand {
private fun applyPresetFromClipboard() {
val gson = Gson()
- val clipboard = Toolkit.getDefaultToolkit().systemClipboard
- val base64 = clipboard.getData(DataFlavor.stringFlavor) as String
+ val base64 = mc.keyboard.clipboard
try {
val jsonString = String(Base64.getDecoder().decode(base64))
val import = gson.fromJson(jsonString, AnimationPreset::class.java)
@@ -74,14 +70,11 @@ object AnimationCommand {
}
private fun applyPresetToClipboard() {
- var s = ""
val gson = Gson()
val jsonString = gson.toJson(DulkirConfig.configOptions.animationPreset)
- s = Base64.getEncoder().encodeToString(jsonString.toByteArray())
+ val s = Base64.getEncoder().encodeToString(jsonString.toByteArray())
// set clipboard
- val selection = StringSelection(s)
- val clipboard: Clipboard = Toolkit.getDefaultToolkit().systemClipboard
- clipboard.setContents(selection, selection)
+ mc.keyboard.clipboard = s
TextUtils.info("ยง6Animation config has been copied to clipboard")
}
} \ No newline at end of file