diff options
Diffstat (limited to 'src/main/kotlin/util')
-rw-r--r-- | src/main/kotlin/util/SkyblockId.kt | 6 | ||||
-rw-r--r-- | src/main/kotlin/util/skyblock/ItemType.kt | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/main/kotlin/util/SkyblockId.kt b/src/main/kotlin/util/SkyblockId.kt index 631b444..a99afda 100644 --- a/src/main/kotlin/util/SkyblockId.kt +++ b/src/main/kotlin/util/SkyblockId.kt @@ -119,6 +119,12 @@ var ItemStack.extraAttributes: NbtCompound return customData.nbt } +fun ItemStack.modifyExtraAttributes(block: (NbtCompound) -> Unit) { + val baseNbt = get(DataComponentTypes.CUSTOM_DATA)?.copyNbt() ?: NbtCompound() + block(baseNbt) + set(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(baseNbt)) +} + val ItemStack.skyblockUUIDString: String? get() = extraAttributes.getString("uuid")?.takeIf { it.isNotBlank() } diff --git a/src/main/kotlin/util/skyblock/ItemType.kt b/src/main/kotlin/util/skyblock/ItemType.kt index 6c7096c..7a776b5 100644 --- a/src/main/kotlin/util/skyblock/ItemType.kt +++ b/src/main/kotlin/util/skyblock/ItemType.kt @@ -67,6 +67,8 @@ value class ItemType private constructor(val name: String) { val dungeonVariant get() = ofName("DUNGEON $name") + val isDungeon get() = name.startsWith("DUNGEON ") + override fun toString(): String { return name } |