aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/ledger/ItemUtil.kt
blob: 365c37e5e1fb88545d0be561fe5fdc3ef4928492 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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() }
}