From f0056183f0761fb50a03cf22775b69a8591857b4 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Fri, 17 Jan 2025 19:26:21 +0100 Subject: feat: Show star stat boosts in REI menus --- src/main/kotlin/util/SkyblockId.kt | 6 ++++++ src/main/kotlin/util/skyblock/ItemType.kt | 2 ++ 2 files changed, 8 insertions(+) (limited to 'src/main/kotlin/util') 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 } -- cgit