diff options
| author | Linnea Gräf <nea@nea.moe> | 2025-11-25 00:23:57 +0100 |
|---|---|---|
| committer | Linnea Gräf <nea@nea.moe> | 2025-11-25 00:23:57 +0100 |
| commit | 707652b59e10371cf4826f9f65d653cac528c6bb (patch) | |
| tree | 65edeffdc0c14703771035222e18d7ff1cfd65b5 /src/main/kotlin/repo/SBItemStack.kt | |
| parent | 6dd14e7225ff60361fe9f87020c424c0eb89a68b (diff) | |
| download | Firmament-707652b59e10371cf4826f9f65d653cac528c6bb.tar.gz Firmament-707652b59e10371cf4826f9f65d653cac528c6bb.tar.bz2 Firmament-707652b59e10371cf4826f9f65d653cac528c6bb.zip | |
feat: add item list
Diffstat (limited to 'src/main/kotlin/repo/SBItemStack.kt')
| -rw-r--r-- | src/main/kotlin/repo/SBItemStack.kt | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main/kotlin/repo/SBItemStack.kt b/src/main/kotlin/repo/SBItemStack.kt index 80cd5d7..89e53e8 100644 --- a/src/main/kotlin/repo/SBItemStack.kt +++ b/src/main/kotlin/repo/SBItemStack.kt @@ -329,7 +329,9 @@ data class SBItemStack constructor( val reforge = ReforgeStore.modifierLut[reforgeId] ?: return val reforgeStats = reforge.reforgeStats?.get(rarity) ?: mapOf() itemStack.displayNameAccordingToNbt = itemStack.displayNameAccordingToNbt.copy() - .prepend(Component.literal(reforge.reforgeName + " ").withStyle(Rarity.colourMap[rarity] ?: ChatFormatting.WHITE)) + .prepend( + Component.literal(reforge.reforgeName + " ").withStyle(Rarity.colourMap[rarity] ?: ChatFormatting.WHITE) + ) val data = itemStack.extraAttributes.copy() data.putString("modifier", reforgeId.id) itemStack.extraAttributes = data @@ -355,6 +357,7 @@ data class SBItemStack constructor( // TODO: avoid instantiating the item stack here @ExpensiveItemCacheApi val itemType: ItemType? get() = ItemType.fromItemStack(asImmutableItemStack()) + @ExpensiveItemCacheApi val rarity: Rarity? get() = Rarity.fromItem(asImmutableItemStack()) @@ -391,6 +394,13 @@ data class SBItemStack constructor( } + /** + * estimate the lore content without creating an itemstack instance + */ + fun estimateLore(): List<Component> { + return (neuItem?.lore?.map { ItemCache.un189Lore(it) } ?: emptyList()) + extraLore + } + private fun starString(stars: Int): Component { if (stars <= 0) return Component.empty() // TODO: idk master stars |
