diff options
author | Linnea Gräf <nea@nea.moe> | 2024-02-15 19:06:46 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-02-15 19:06:46 +0100 |
commit | aa8ca77ae239b9b6be140911524d70ba2b46c42d (patch) | |
tree | 14a91f9756853b1162a6725bb9100ab04061c2c2 /src/main/kotlin/moe/nea/ledger/ItemUtil.kt | |
parent | 3e19b97b52fae7422f8b0654da9341bf8c2393cb (diff) | |
download | LocalTransactionLedger-aa8ca77ae239b9b6be140911524d70ba2b46c42d.tar.gz LocalTransactionLedger-aa8ca77ae239b9b6be140911524d70ba2b46c42d.tar.bz2 LocalTransactionLedger-aa8ca77ae239b9b6be140911524d70ba2b46c42d.zip |
Add auction support
Diffstat (limited to 'src/main/kotlin/moe/nea/ledger/ItemUtil.kt')
-rw-r--r-- | src/main/kotlin/moe/nea/ledger/ItemUtil.kt | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/ledger/ItemUtil.kt b/src/main/kotlin/moe/nea/ledger/ItemUtil.kt new file mode 100644 index 0000000..365c37e --- /dev/null +++ b/src/main/kotlin/moe/nea/ledger/ItemUtil.kt @@ -0,0 +1,13 @@ +package moe.nea.ledger + +import net.minecraft.item.ItemStack +import net.minecraft.nbt.NBTTagCompound + + +fun ItemStack.getInternalId(): String? { + val nbt = this.tagCompound ?: NBTTagCompound() + val extraAttributes = nbt.getCompoundTag("ExtraAttributes") + val id = extraAttributes.getString("id") + return id.takeIf { it.isNotBlank() } +} + |