aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/ledger/ItemUtil.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-12-07 00:50:33 +0100
committerLinnea Gräf <nea@nea.moe>2024-12-07 00:50:33 +0100
commitd708dca108dcbfe3d67dfe90c27de9cdb41184a6 (patch)
tree2b4b0c1d12396abbbaba7b6653616f6391988bbf /src/main/kotlin/moe/nea/ledger/ItemUtil.kt
parent6bdc91b4bda1497e785af695769acae91e8e7064 (diff)
downloadLocalTransactionLedger-d708dca108dcbfe3d67dfe90c27de9cdb41184a6.tar.gz
LocalTransactionLedger-d708dca108dcbfe3d67dfe90c27de9cdb41184a6.tar.bz2
LocalTransactionLedger-d708dca108dcbfe3d67dfe90c27de9cdb41184a6.zip
feat: Add SQLITE database entry logging
Diffstat (limited to 'src/main/kotlin/moe/nea/ledger/ItemUtil.kt')
-rw-r--r--src/main/kotlin/moe/nea/ledger/ItemUtil.kt4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/kotlin/moe/nea/ledger/ItemUtil.kt b/src/main/kotlin/moe/nea/ledger/ItemUtil.kt
index 892127d..b82c97f 100644
--- a/src/main/kotlin/moe/nea/ledger/ItemUtil.kt
+++ b/src/main/kotlin/moe/nea/ledger/ItemUtil.kt
@@ -4,11 +4,11 @@ import net.minecraft.item.ItemStack
import net.minecraft.nbt.NBTTagCompound
-fun ItemStack.getInternalId(): String? {
+fun ItemStack.getInternalId(): ItemId? {
val nbt = this.tagCompound ?: NBTTagCompound()
val extraAttributes = nbt.getCompoundTag("ExtraAttributes")
val id = extraAttributes.getString("id")
- return id.takeIf { it.isNotBlank() }
+ return id.takeIf { it.isNotBlank() }?.let(::ItemId)
}