aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-01-21 22:38:20 +1100
committerGitHub <noreply@github.com>2024-01-21 12:38:20 +0100
commit6ada0c11bfb7f79f39a94db061f158f46e89d8d2 (patch)
tree71443e19bdf23a86ef9e5744ff92970e06d4e4a8 /src/main
parente5004a6748110ea35d075050cbf4a59bfe64b62b (diff)
downloadskyhanni-6ada0c11bfb7f79f39a94db061f158f46e89d8d2.tar.gz
skyhanni-6ada0c11bfb7f79f39a94db061f158f46e89d8d2.tar.bz2
skyhanni-6ada0c11bfb7f79f39a94db061f158f46e89d8d2.zip
fix tests and bring it back (#943)
Bring back the deleted test and fix the issue causing it. #943
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt7
4 files changed, 11 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 9b64ee1b5..ae24e155f 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -349,7 +349,6 @@ import at.hannibal2.skyhanni.utils.KeyboardManager
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.MinecraftConsoleFilter.Companion.initLogging
import at.hannibal2.skyhanni.utils.NEUVersionCheck.checkIfNeuIsLoaded
-import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils
import at.hannibal2.skyhanni.utils.TabListData
import at.hannibal2.skyhanni.utils.UtilsPatterns
import at.hannibal2.skyhanni.utils.repopatterns.RepoPatternManager
@@ -434,7 +433,6 @@ class SkyHanniMod {
loadModule(BingoCardReader())
loadModule(GardenBestCropTime())
loadModule(TrackerManager)
- loadModule(SkyBlockItemModifierUtils)
loadModule(UtilsPatterns)
// APIs
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
index 3614eb39d..ed7b94770 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
@@ -8,7 +8,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
-import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import com.google.gson.JsonObject
import net.minecraft.item.Item
import net.minecraft.item.ItemStack
@@ -18,8 +17,6 @@ import java.util.Locale
object SkyBlockItemModifierUtils {
private val drillPartTypes = listOf("drill_part_upgrade_module", "drill_part_engine", "drill_part_fuel_tank")
- private val petLevelPattern by RepoPattern.pattern("utils.item.petlevel", "(?:§f§f)?§7\\[Lvl (?<level>\\d+)] .*")
-
fun ItemStack.getHotPotatoCount() = getAttributeInt("hot_potato_count")
fun ItemStack.getFarmingForDummiesCount() = getAttributeInt("farming_for_dummies_count")
@@ -95,7 +92,7 @@ object SkyBlockItemModifierUtils {
inline val ItemStack.cachedData get() = (this as ItemStackCachedData).skyhanni_cachedData
fun ItemStack.getPetLevel(): Int {
- petLevelPattern.matchMatcher(this.displayName) {
+ UtilsPatterns.petLevelPattern.matchMatcher(this.displayName) {
return group("level").toInt()
}
return 0
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt b/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt
index fdaa65050..05bb4620b 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt
@@ -35,4 +35,8 @@ object UtilsPatterns {
"item.name.potion",
".*Potion"
)
+ val petLevelPattern by patternGroup.pattern(
+ "item.petlevel",
+ "(?:§f§f)?§7\\[Lvl (?<level>\\d+)] .*"
+ )
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt
index 1aee38844..a0bc09da7 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternManager.kt
@@ -38,7 +38,12 @@ object RepoPatternManager {
private var usedKeys = mutableMapOf<String, RepoPatternImpl>()
private var wasPreinitialized = false
- private val isInDevEnv = Launch.blackboard["fml.deobfuscatedEnvironment"] as Boolean
+ private val isInDevEnv = try {
+ Launch.blackboard["fml.deobfuscatedEnvironment"] as Boolean
+ } catch (_: Exception) {
+ true
+ }
+
private val config get() = SkyHanniMod.feature.dev.repoPattern
/**