From 171049f66ed122656c44e9c07eecc099fe8c6b99 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Fri, 2 Aug 2024 10:58:50 +0200 Subject: Fix: Composter Overlay no data (#2294) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../features/garden/composter/ComposterDisplay.kt | 3 +- .../features/garden/composter/ComposterOverlay.kt | 58 ++++++++++++++++------ 2 files changed, 46 insertions(+), 15 deletions(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt index 7c88acfca..a08acac91 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt @@ -55,7 +55,7 @@ object ComposterDisplay { @SubscribeEvent fun onTabListUpdate(event: WidgetUpdateEvent) { - if (!(config.displayEnabled && GardenAPI.inGarden())) return + if (!GardenAPI.inGarden()) return if (!event.isWidget(TabWidget.COMPOSTER)) return readData(event.lines) @@ -68,6 +68,7 @@ object ComposterDisplay { } private fun updateDisplay() { + if (!config.displayEnabled) return val newDisplay = mutableListOf>() newDisplay.addAsSingletonList("§bComposter") 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 8ed772ea3..5bf03b7e3 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 @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.config.features.garden.composter.ComposterConfig.Re import at.hannibal2.skyhanni.data.SackAPI.getAmountInSacksOrNull import at.hannibal2.skyhanni.data.jsonobjects.repo.GardenJson import at.hannibal2.skyhanni.data.model.ComposterUpgrade +import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent @@ -174,8 +175,8 @@ object ComposterOverlay { Collections.singletonList( listOf( "§cSkyHanni composter error:", "§cRepo data not loaded!", - "§7(organicMatterFactors is empty)" - ) + "§7(organicMatterFactors is empty)", + ), ) return } @@ -184,8 +185,8 @@ object ComposterOverlay { Collections.singletonList( listOf( "§cSkyHanni composter error:", "§cRepo data not loaded!", - "§7(fuelFactors is empty)" - ) + "§7(fuelFactors is empty)", + ), ) return } @@ -310,7 +311,7 @@ object ComposterOverlay { onChange = { currentTimeType = it update() - } + }, ) val list = mutableListOf() @@ -405,10 +406,12 @@ object ComposterOverlay { val first: NEUInternalName? = calculateFirst(map, testOffset, factors, missing, onClick, bigList) if (testOffset != 0) { - bigList.addAsSingletonList(Renderable.link("testOffset = $testOffset") { - ComposterOverlay.testOffset = 0 - update() - }) + bigList.addAsSingletonList( + Renderable.link("testOffset = $testOffset") { + ComposterOverlay.testOffset = 0 + update() + }, + ) } return first ?: error("First is empty!") @@ -475,7 +478,7 @@ object ComposterOverlay { lastAttemptTime = SimpleTimeMark.now() retrieveMaterials(internalName, itemName, itemsNeeded.toInt()) } - } + }, ) } @@ -524,7 +527,8 @@ object ComposterOverlay { if (LorenzUtils.noTradeMode) { ChatUtils.chat("You're out of $itemName §ein your sacks!") } else { - ChatUtils.clickableChat( // TODO Add this as a separate feature, and then don't send any msg if the feature is disabled + ChatUtils.clickableChat( + // TODO Add this as a separate feature, and then don't send any msg if the feature is disabled "You're out of $itemName §ein your sacks! Click here to buy more on the Bazaar!", onClick = { HypixelCommands.bazaar(itemName.removeColor()) }, "§eClick find on the bazaar!", @@ -559,7 +563,7 @@ object ComposterOverlay { } catch (e: Exception) { ErrorManager.logErrorWithData( e, "Failed to calculate composter overlay data", - "organicMatter" to organicMatter + "organicMatter" to organicMatter, ) } } @@ -597,11 +601,11 @@ object ComposterOverlay { if (inInventory) { config.overlayOrganicMatterPos.renderStringsAndItems( organicMatterDisplay, - posLabel = "Composter Overlay Organic Matter" + posLabel = "Composter Overlay Organic Matter", ) config.overlayFuelExtrasPos.renderStringsAndItems( fuelExtraDisplay, - posLabel = "Composter Overlay Fuel Extras" + posLabel = "Composter Overlay Fuel Extras", ) } } @@ -624,4 +628,30 @@ object ComposterOverlay { ConfigUtils.migrateIntToEnum(element, RetrieveFromEntry::class.java) } } + + @SubscribeEvent + fun onDebugDataCollect(event: DebugDataCollectEvent) { + event.title("Garden Composter") + + event.addIrrelevant { + add("currentOrganicMatterItem: $currentOrganicMatterItem") + add("currentFuelItem: $currentFuelItem") + + println(" ") + val composterUpgrades = ComposterAPI.composterUpgrades + if (composterUpgrades == null) { + println("composterUpgrades is null") + } else { + for ((a, b) in composterUpgrades) { + println("upgrade $a: $b") + } + } + + println(" ") + val tabListData = ComposterAPI.tabListData + for ((a, b) in tabListData) { + println("tabListData $a: $b") + } + } + } } -- cgit