Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/hide-crop-fortune-warnings' into…
Browse files Browse the repository at this point in the history
… hide-crop-fortune-warnings
  • Loading branch information
Chissl committed Dec 24, 2024
2 parents cf7b2f4 + 9906736 commit 6fe0b0d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import net.minecraft.util.AxisAlignedBB
import net.minecraft.util.BlockPos
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent

// TODO move into mining category and package
@SkyHanniModule
object NucleusBarriersBox {
private val config get() = SkyHanniMod.feature.mining.crystalHighlighter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.events.garden.farming.FarmingContestEvent
import at.hannibal2.skyhanni.features.garden.CropType
import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut
import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter
import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc
Expand Down Expand Up @@ -98,7 +99,19 @@ object FarmingContestAPI {
private fun readCurrentCrop(): CropType? {
val line = ScoreboardData.sidebarLinesFormatted.nextAfter("§eJacob's Contest") ?: return null
return sidebarCropPattern.matchMatcher(line) {
CropType.getByName(group("crop"))
val cropName = group("crop")
try {
CropType.getByName(cropName)
} catch (e: IllegalStateException) {
ScoreboardData.sidebarLinesFormatted
ErrorManager.logErrorWithData(
e, "Farming contest read current crop failed",
"cropName" to cropName,
"line" to line,
"sidebarLinesFormatted" to ScoreboardData.sidebarLinesFormatted,
)
null
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/utils/CircularList.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
package at.hannibal2.skyhanni.utils

/**
* A generic, immutable circular list that cycles through its elements infinitely.
*
* @param T The type of elements in the circular list.
* @property items A list of elements to be accessed in a circular manner.
* @constructor Creates a CircularList with the given elements.
* @throws IllegalArgumentException if the list is empty.
*/
class CircularList<T>(private val items: List<T>) {

constructor(vararg elements: T) : this(elements.asList())
Expand Down

0 comments on commit 6fe0b0d

Please sign in to comment.