From 24d8a5c4b98dfd84bb31cede18e509e070ac202e Mon Sep 17 00:00:00 2001 From: Lorenz Date: Mon, 22 Aug 2022 02:32:27 +0200 Subject: removed /ii and created /copyitem --- .../skyhanni/test/command/CopyItemCommand.kt | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt (limited to 'src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt') diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt new file mode 100644 index 000000000..854ab26eb --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt @@ -0,0 +1,48 @@ +package at.hannibal2.skyhanni.test.command + +import at.hannibal2.skyhanni.config.gui.utils.Utils +import at.hannibal2.skyhanni.test.LorenzTest +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.client.Minecraft + +object CopyItemCommand { + + fun command(args: Array) { + try { + val resultList = mutableListOf() + val itemStack = Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem()!! + resultList.add("ITEM LORE") + resultList.add("display name: '" + itemStack.displayName.toString() + "'") + val itemID = itemStack.getInternalName() + resultList.add("internalName: '$itemID'") + resultList.add("") + for (line in itemStack.getLore()) { + resultList.add("'$line'") + println(line) + } + resultList.add("") + resultList.add("getTagCompound") + if (itemStack.hasTagCompound()) { + val tagCompound = itemStack.tagCompound + for (s in tagCompound.keySet) { + resultList.add(" '$s'") + } + if (tagCompound.hasKey("ExtraAttributes")) { + resultList.add("") + resultList.add("ExtraAttributes") + val extraAttributes = tagCompound.getCompoundTag("ExtraAttributes") + LorenzTest.runn(extraAttributes, " . ") + } + } + + val string = resultList.joinToString("\n") + Utils.copyToClipboard(string) + LorenzUtils.debug("item info printed!") + LorenzUtils.chat("§e[SkyHanni] item info copied into the clipboard!") + } catch (_: Throwable) { + LorenzUtils.chat("§c[SkyHanni] No item in hand!") + } + } +} \ No newline at end of file -- cgit