diff options
author | ronald <inglettronald@gmail.com> | 2023-07-30 19:58:05 -0500 |
---|---|---|
committer | ronald <inglettronald@gmail.com> | 2023-07-30 19:58:05 -0500 |
commit | c3af0d9cd112cbe71966c57cbbf914346faadfc3 (patch) | |
tree | a9237fadb90d85f97d5780751b0a7ab1549dae28 /src/main/kotlin/com/dulkirfabric/commands/AnimationCommand.kt | |
parent | 1078df493e6473f0b5cfa0409857c16e6fd60f53 (diff) | |
download | DulkirMod-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/AnimationCommand.kt')
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/commands/AnimationCommand.kt | 17 |
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 |