From 2c66b795277876addffe1386e498fd1c0131218f Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 16 Oct 2023 12:11:17 +0200 Subject: code cleanup --- .../hannibal2/skyhanni/test/command/CopyItemCommand.kt | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/test/command') 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 f3d0d80ef..f0b2c8ae1 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.test.command import at.hannibal2.skyhanni.utils.InventoryUtils -import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.OSUtils @@ -12,12 +12,12 @@ import net.minecraft.nbt.NBTTagCompound object CopyItemCommand { fun command() { - try { - val itemStack = InventoryUtils.getItemInHand() ?: throw Exception() - copyItemToClipboard(itemStack) - } catch (_: Throwable) { + val itemStack = InventoryUtils.getItemInHand() + if (itemStack == null) { LorenzUtils.chat("§c[SkyHanni] No item in hand!") + return } + copyItemToClipboard(itemStack) } private fun recurseTag(compound: NBTTagCompound, text: String, list: MutableList) { @@ -35,12 +35,10 @@ object CopyItemCommand { } } - fun copyItemToClipboard(itemStack: ItemStack){ + fun copyItemToClipboard(itemStack: ItemStack) { val resultList = mutableListOf() - resultList.add("ITEM LORE") + resultList.add(itemStack.getInternalName().toString()) 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()) { -- cgit