diff options
author | Linnea Gräf <nea@nea.moe> | 2025-03-07 00:21:38 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2025-03-08 16:01:00 +0100 |
commit | b4a93bd7515ffd8f1fcbcf5315729ddd36b0166a (patch) | |
tree | 0f062d04649ba2df26251d922e27c7cd737f1fc0 /src/main/kotlin/repo/SBItemStack.kt | |
parent | 6ad259ca405d58f1956d67d7daeb05ae8590ca62 (diff) | |
download | Firmament-b4a93bd7515ffd8f1fcbcf5315729ddd36b0166a.tar.gz Firmament-b4a93bd7515ffd8f1fcbcf5315729ddd36b0166a.tar.bz2 Firmament-b4a93bd7515ffd8f1fcbcf5315729ddd36b0166a.zip |
feat: Add block breaking indicators to jade
Diffstat (limited to 'src/main/kotlin/repo/SBItemStack.kt')
-rw-r--r-- | src/main/kotlin/repo/SBItemStack.kt | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/kotlin/repo/SBItemStack.kt b/src/main/kotlin/repo/SBItemStack.kt index da34707..e04eec3 100644 --- a/src/main/kotlin/repo/SBItemStack.kt +++ b/src/main/kotlin/repo/SBItemStack.kt @@ -81,6 +81,7 @@ data class SBItemStack constructor( } val EMPTY = SBItemStack(SkyblockId.NULL, 0) + private val BREAKING_POWER_REGEX = "Breaking Power (?<power>[0-9]+)".toPattern() operator fun invoke(itemStack: ItemStack): SBItemStack { val skyblockId = itemStack.skyBlockId ?: SkyblockId.NULL return SBItemStack( @@ -349,6 +350,12 @@ data class SBItemStack constructor( private var itemStack_: ItemStack? = null + val breakingPower: Int + get() = + BREAKING_POWER_REGEX.useMatch(asImmutableItemStack().loreAccordingToNbt.firstOrNull()?.string) { + group("power").toInt() + } ?: 0 + private val itemStack: ItemStack get() { val itemStack = itemStack_ ?: run { |