From bb627157c217d3ebd632e51447e60acce1a81f86 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Mon, 10 Mar 2025 22:24:01 +0100 Subject: fix: Weird tools for BP 7; feat: Options for jade; fix: tools for glass blocks in jade --- src/main/kotlin/repo/MiningRepoData.kt | 9 +++++---- src/main/kotlin/repo/RepoManager.kt | 2 +- src/main/kotlin/repo/SBItemStack.kt | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/main') diff --git a/src/main/kotlin/repo/MiningRepoData.kt b/src/main/kotlin/repo/MiningRepoData.kt index 548c3e5..e40292d 100644 --- a/src/main/kotlin/repo/MiningRepoData.kt +++ b/src/main/kotlin/repo/MiningRepoData.kt @@ -30,7 +30,7 @@ class MiningRepoData : IReloadable { private set var customMiningBlocks: List = listOf() private set - var toolsByBreakingPower: NavigableMap = Collections.emptyNavigableMap() + var toolsByBreakingPower: NavigableMap = Collections.emptyNavigableMap() private set @@ -44,7 +44,7 @@ class MiningRepoData : IReloadable { .comparingInt { it.breakingPower } .thenComparing(Comparator.comparing( { it.itemId }, - nullsFirst(Comparator.naturalOrder()))) + nullsFirst(Comparator.comparing { "PICK" in it.neuItem || "BING" in it.neuItem }.thenComparing(Comparator.naturalOrder())))) } } @@ -60,13 +60,14 @@ class MiningRepoData : IReloadable { repo.items.items .values .asSequence() + .map { SBItemStack(it.skyblockId) } .filter { it.breakingPower > 0 } - .associateTo(TreeMap(BreakingPowerKey.COMPARATOR)) { + .associateTo(TreeMap(BreakingPowerKey.COMPARATOR)) { BreakingPowerKey(it.breakingPower, it.skyblockId) to it }) } - fun getToolsThatCanBreak(breakingPower: Int): Collection { + fun getToolsThatCanBreak(breakingPower: Int): Collection { return toolsByBreakingPower.tailMap(BreakingPowerKey(breakingPower, null), true).values } diff --git a/src/main/kotlin/repo/RepoManager.kt b/src/main/kotlin/repo/RepoManager.kt index 5bcf163..e50a131 100644 --- a/src/main/kotlin/repo/RepoManager.kt +++ b/src/main/kotlin/repo/RepoManager.kt @@ -64,6 +64,7 @@ object RepoManager { registerReloadListener(ItemNameLookup) registerReloadListener(ReforgeStore) registerReloadListener(essenceRecipeProvider) + registerReloadListener(recipeCache) registerReloadListener(miningData) ReloadRegistrationEvent.publish(ReloadRegistrationEvent(this)) registerReloadListener { @@ -75,7 +76,6 @@ object RepoManager { } } } - registerReloadListener(recipeCache) } } diff --git a/src/main/kotlin/repo/SBItemStack.kt b/src/main/kotlin/repo/SBItemStack.kt index e04eec3..3690866 100644 --- a/src/main/kotlin/repo/SBItemStack.kt +++ b/src/main/kotlin/repo/SBItemStack.kt @@ -34,6 +34,7 @@ import moe.nea.firmament.util.modifyExtraAttributes import moe.nea.firmament.util.petData import moe.nea.firmament.util.prepend import moe.nea.firmament.util.reconstitute +import moe.nea.firmament.util.removeColorCodes import moe.nea.firmament.util.skyBlockId import moe.nea.firmament.util.skyblock.ItemType import moe.nea.firmament.util.skyblock.Rarity @@ -352,7 +353,7 @@ data class SBItemStack constructor( val breakingPower: Int get() = - BREAKING_POWER_REGEX.useMatch(asImmutableItemStack().loreAccordingToNbt.firstOrNull()?.string) { + BREAKING_POWER_REGEX.useMatch(neuItem?.lore?.firstOrNull()?.removeColorCodes()) { group("power").toInt() } ?: 0 -- cgit