From 0b897aeae566b19e9bf87776156d761965f7d1ec Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 20 Nov 2023 01:37:48 +0100 Subject: Fixed /ff upgrade suggests to update bustling reforge even when no farming armor is found. --- .../skyhanni/features/garden/fortuneguide/FFGuideGUI.kt | 14 +++++++++++--- .../features/garden/fortuneguide/FortuneUpgrades.kt | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt index 932fbbacd..d93dfd36a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.features.garden.fortuneguide.pages.CropPage import at.hannibal2.skyhanni.features.garden.fortuneguide.pages.OverviewPage import at.hannibal2.skyhanni.features.garden.fortuneguide.pages.UpgradePage import at.hannibal2.skyhanni.utils.GuiRenderUtils +import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.SoundUtils import net.minecraft.client.Minecraft import net.minecraft.client.gui.GuiScreen @@ -56,8 +57,14 @@ open class FFGuideGUI : GuiScreen() { return fallbackItem } - fun getFallbackItem(item: FarmingItems): ItemStack = - ItemStack(Blocks.barrier).setStackDisplayName("§cNo saved ${item.name.lowercase().replace("_", " ")}") + private val fallbackItems = mutableMapOf() + + fun getFallbackItem(item: FarmingItems) = fallbackItems.getOrPut(item) { + val name = "§cNo saved ${item.name.lowercase().replace("_", " ")}" + ItemStack(Blocks.barrier).setStackDisplayName(name) + } + + fun isFallbackItem(item: ItemStack) = item.name!!.startsWith("§cNo saved ") } init { @@ -294,7 +301,8 @@ open class FFGuideGUI : GuiScreen() { x = guiLeft - 28 y = guiTop + 15 if (isMouseIn(x, y, 28, 25) && - selectedPage != FortuneGuidePage.CROP && selectedPage != FortuneGuidePage.OVERVIEW) { + selectedPage != FortuneGuidePage.CROP && selectedPage != FortuneGuidePage.OVERVIEW + ) { SoundUtils.playClickSound() selectedPage = if (currentCrop == null) { FortuneGuidePage.OVERVIEW diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt index 9b2f6441e..c7ff7275a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt @@ -126,6 +126,8 @@ object FortuneUpgrades { val item = piece.getItem() //todo skip if it doesnt exist -> tell them to buy it later + if (FFGuideGUI.isFallbackItem(item)) return + recombobulateItem(item, genericUpgrades) when (item.getReforgeName()) { "mossy" -> {} -- cgit