summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/test/command
diff options
context:
space:
mode:
authorWalker Selby <git@walkerselby.com>2023-10-16 11:10:25 +0100
committerGitHub <noreply@github.com>2023-10-16 12:10:25 +0200
commit560cdada4b3577fb83c39c5cac62409093055103 (patch)
tree1acb9584b486e1d1c71f02ccc3314f7fd9da72a4 /src/main/java/at/hannibal2/skyhanni/test/command
parent94e6c479359c68d7dbf9b657aad86ab3fa12e525 (diff)
downloadskyhanni-560cdada4b3577fb83c39c5cac62409093055103.tar.gz
skyhanni-560cdada4b3577fb83c39c5cac62409093055103.tar.bz2
skyhanni-560cdada4b3577fb83c39c5cac62409093055103.zip
Add NBT Copy Keybind (#562)
created more useful copy item data keybind #562
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/test/command')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt46
1 files changed, 25 insertions, 21 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt
index 06496036d..f3d0d80ef 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt
@@ -6,33 +6,15 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.OSUtils
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getMinecraftId
+import net.minecraft.item.ItemStack
import net.minecraft.nbt.NBTTagCompound
object CopyItemCommand {
fun command() {
try {
- val resultList = mutableListOf<String>()
- val itemStack = InventoryUtils.getItemInHand() ?: return
- resultList.add("ITEM LORE")
- resultList.add("display name: '" + itemStack.displayName.toString() + "'")
- val itemID = itemStack.getInternalName_old()
- resultList.add("internalName: '$itemID'")
- resultList.add("minecraft id: '" + itemStack.getMinecraftId() + "'")
- resultList.add("lore:")
- for (line in itemStack.getLore()) {
- resultList.add(" '$line'")
- }
- resultList.add("")
- resultList.add("getTagCompound")
- if (itemStack.hasTagCompound()) {
- val tagCompound = itemStack.tagCompound
- recurseTag(tagCompound, " ", resultList)
- }
-
- val string = resultList.joinToString("\n")
- OSUtils.copyToClipboard(string)
- LorenzUtils.chat("§e[SkyHanni] Item info copied into the clipboard!")
+ val itemStack = InventoryUtils.getItemInHand() ?: throw Exception()
+ copyItemToClipboard(itemStack)
} catch (_: Throwable) {
LorenzUtils.chat("§c[SkyHanni] No item in hand!")
}
@@ -53,4 +35,26 @@ object CopyItemCommand {
}
}
+ fun copyItemToClipboard(itemStack: ItemStack){
+ val resultList = mutableListOf<String>()
+ resultList.add("ITEM LORE")
+ resultList.add("display name: '" + itemStack.displayName.toString() + "'")
+ val itemID = itemStack.getInternalName_old()
+ resultList.add("internalName: '$itemID'")
+ resultList.add("minecraft id: '" + itemStack.getMinecraftId() + "'")
+ resultList.add("lore:")
+ for (line in itemStack.getLore()) {
+ resultList.add(" '$line'")
+ }
+ resultList.add("")
+ resultList.add("getTagCompound")
+ if (itemStack.hasTagCompound()) {
+ val tagCompound = itemStack.tagCompound
+ recurseTag(tagCompound, " ", resultList)
+ }
+
+ val string = resultList.joinToString("\n")
+ OSUtils.copyToClipboard(string)
+ LorenzUtils.chat("§e[SkyHanni] Item info copied into the clipboard!")
+ }
} \ No newline at end of file