From edc72af6ec6055822d0deed8efe3c952cbf65026 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Thu, 15 Feb 2024 19:38:09 +0100 Subject: Add collect all support --- src/main/kotlin/moe/nea/ledger/ItemUtil.kt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/main/kotlin/moe/nea/ledger/ItemUtil.kt') diff --git a/src/main/kotlin/moe/nea/ledger/ItemUtil.kt b/src/main/kotlin/moe/nea/ledger/ItemUtil.kt index 365c37e..7157386 100644 --- a/src/main/kotlin/moe/nea/ledger/ItemUtil.kt +++ b/src/main/kotlin/moe/nea/ledger/ItemUtil.kt @@ -11,3 +11,11 @@ fun ItemStack.getInternalId(): String? { return id.takeIf { it.isNotBlank() } } + +fun ItemStack.getLore(): List { + val nbt = this.tagCompound ?: NBTTagCompound() + val extraAttributes = nbt.getCompoundTag("display") + val lore = extraAttributes.getTagList("Lore", 8) + return (0 until lore.tagCount()).map { lore.getStringTagAt(it) } +} + -- cgit