From b4a93bd7515ffd8f1fcbcf5315729ddd36b0166a Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Fri, 7 Mar 2025 00:21:38 +0100 Subject: feat: Add block breaking indicators to jade --- src/main/kotlin/repo/SBItemStack.kt | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/main/kotlin/repo') 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 (?[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 { -- cgit