From 9aac2eb3a620f5baf93ac2c6f5f99ede6440ba7b Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Wed, 2 Aug 2023 09:38:50 +0200 Subject: Fixed /shtestcomposter crash, removed SIMPLE_CARROT_CANDY from composter --- .../features/garden/composter/ComposterOverlay.kt | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt index 8fe0f2272..5d43b5821 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt @@ -361,7 +361,7 @@ class ComposterOverlay { bigList: MutableList>, factors: Map, missing: Double, - testOffset: Int = 0, + testOffset_: Int = 0, onClick: (String) -> Unit, ): String { val map = mutableMapOf() @@ -369,6 +369,12 @@ class ComposterOverlay { map[internalName] = factor / getPrice(internalName) } + val testOffset = if (testOffset_ > map.size) { + LorenzUtils.chat("§cSkyHanni] Invalid Composter Overlay Offset! $testOffset cannot be greather than ${map.size}!") + ComposterOverlay.testOffset = 0 + 0 + } else testOffset_ + var i = 0 var first: String? = null for (internalName in map.sortedDesc().keys) { @@ -384,6 +390,9 @@ class ComposterOverlay { val totalPrice = itemsNeeded * price val list = mutableListOf() + if (testOffset != 0) { + list.add("#$i ") + } list.add(item) val format = NumberUtil.format(totalPrice) val selected = @@ -402,8 +411,14 @@ class ComposterOverlay { if (i == 10 + testOffset) break } + if (testOffset != 0) { + bigList.addAsSingletonList(Renderable.link("testOffset = $testOffset") { + ComposterOverlay.testOffset = 0 + update() + }) + } - return first!! + return first ?: error("First is empty!") } private fun getPrice(internalName: String): Double { @@ -447,6 +462,7 @@ class ComposterOverlay { if (internalName.endsWith("_CHESTPLATE")) continue if (internalName.endsWith("_LEGGINGS")) continue if (internalName == "SPEED_TALISMAN") continue + if (internalName == "SIMPLE_CARROT_CANDY") continue val (newId, amount) = NEUItems.getMultiplier(internalName) if (amount <= 9) continue val finalAmount = -- cgit