From 07973160f87535eed91ea15c7a2bb37d75d85922 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Tue, 17 Oct 2023 13:22:11 +0200 Subject: Hiding a bunch of garden guis in a bunch of garden inventories. --- src/main/java/at/hannibal2/skyhanni/data/RenderData.kt | 7 +++---- .../at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt | 1 + src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt | 4 +++- .../at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt | 1 + .../at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt | 2 ++ .../skyhanni/features/garden/farming/FarmingWeightDisplay.kt | 7 ++++++- .../skyhanni/features/garden/visitor/GardenVisitorFeatures.kt | 6 ++++-- 7 files changed, 20 insertions(+), 8 deletions(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt b/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt index 0137c4491..f109ea01b 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt @@ -2,9 +2,8 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent -import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI -import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests import at.hannibal2.skyhanni.features.misc.visualwords.VisualWordGui +import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.client.gui.inventory.GuiInventory @@ -20,7 +19,7 @@ class RenderData { fun onRenderOverlay(event: RenderGameOverlayEvent.Pre) { if (event.type != RenderGameOverlayEvent.ElementType.HOTBAR) return if (!SkyHanniDebugsAndTests.globalRender) return - if (GuiEditManager.isInGui() || FFGuideGUI.isInGui() || VisualWordGui.isInGui()) return + if (GuiEditManager.isInGui() || VisualWordGui.isInGui()) return GuiRenderEvent.GuiOverlayRenderEvent().postAndCatch() } @@ -28,7 +27,7 @@ class RenderData { @SubscribeEvent fun onBackgroundDraw(event: GuiScreenEvent.BackgroundDrawnEvent) { if (!SkyHanniDebugsAndTests.globalRender) return - if (GuiEditManager.isInGui() || FFGuideGUI.isInGui() || VisualWordGui.isInGui()) return + if (GuiEditManager.isInGui() || VisualWordGui.isInGui()) return val currentScreen = Minecraft.getMinecraft().currentScreen ?: return if (currentScreen !is GuiInventory && currentScreen !is GuiChest) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt index 74defe1ad..03771efc8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -81,6 +81,7 @@ class FarmingFortuneDisplay { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!isEnabled()) return + if (GardenAPI.hideExtraGuis()) return config.pos.renderStringsAndItems(display, posLabel = "True Farming Fortune") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt index da588c2be..2f398f6ce 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt @@ -18,7 +18,9 @@ import at.hannibal2.skyhanni.features.garden.composter.ComposterOverlay import at.hannibal2.skyhanni.features.garden.contest.FarmingContestAPI import at.hannibal2.skyhanni.features.garden.farming.GardenBestCropTime import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI import at.hannibal2.skyhanni.features.garden.inventory.SkyMartCopperPrice +import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI import at.hannibal2.skyhanni.utils.BlockUtils.isBabyCrop import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old @@ -158,7 +160,7 @@ object GardenAPI { } fun hideExtraGuis() = ComposterOverlay.inInventory || AnitaMedalProfit.inInventory || - SkyMartCopperPrice.inInventory || FarmingContestAPI.inInventory + SkyMartCopperPrice.inInventory || FarmingContestAPI.inInventory || VisitorAPI.inInventory || FFGuideGUI.isInGui() fun clearCropSpeed() { config?.cropsPerSecond?.clear() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt index dfb66bb82..d033255d2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt @@ -106,6 +106,7 @@ class GardenLevelDisplay { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!isEnabled()) return + if (GardenAPI.hideExtraGuis()) return config.pos.renderString(display, posLabel = "Garden Level") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt index 60d54038c..bff6d4b0e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt @@ -85,6 +85,8 @@ class GardenOptimalSpeed { if (optimalSpeed == -1) return + if (GardenAPI.hideExtraGuis()) return + val text = "Optimal Speed: §f$optimalSpeed" if (optimalSpeed != currentSpeed) { config.pos.renderString("§c$text", posLabel = "Garden Optimal Speed") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt index 142d4f268..38a21b1d8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt @@ -29,6 +29,7 @@ class FarmingWeightDisplay { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent) { + if (GardenAPI.hideExtraGuis()) return val shouldShow = apiError || (config.ignoreLow || weight >= 200) if (isEnabled() && shouldShow) { config.pos.renderRenderables(display, posLabel = "Farming Weight Display") @@ -76,7 +77,11 @@ class FarmingWeightDisplay { event.move(3, "garden.eliteFarmingWeightPos", "garden.eliteFarmingWeights.pos") event.move(3, "garden.eliteFarmingWeightLeaderboard", "garden.eliteFarmingWeights.leaderboard") event.move(3, "garden.eliteFarmingWeightOvertakeETA", "garden.eliteFarmingWeights.overtakeETA") - event.move(3, "garden.eliteFarmingWeightOffScreenDropMessage", "garden.eliteFarmingWeights.offScreenDropMessage") + event.move( + 3, + "garden.eliteFarmingWeightOffScreenDropMessage", + "garden.eliteFarmingWeights.offScreenDropMessage" + ) event.move(3, "garden.eliteFarmingWeightOvertakeETAAlways", "garden.eliteFarmingWeights.overtakeETAAlways") event.move(3, "garden.eliteFarmingWeightETAGoalRank", "garden.eliteFarmingWeights.ETAGoalRank") event.move(3, "garden.eliteFarmingWeightIgnoreLow", "garden.eliteFarmingWeights.ignoreLow") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index 954f1278c..37a1ff142 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -528,11 +528,13 @@ class GardenVisitorFeatures { if (config.needs.onlyWhenClose && !GardenAPI.onBarnPlot) return - if (!GardenAPI.hideExtraGuis()) { + if (!hideExtraGuis()) { config.needs.pos.renderStringsAndItems(display, posLabel = "Visitor Items Needed") } } + private fun hideExtraGuis() = GardenAPI.hideExtraGuis() && !VisitorAPI.inInventory + @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent) { if (!config.needs.display) return @@ -547,7 +549,7 @@ class GardenVisitorFeatures { return true } - if (GardenAPI.hideExtraGuis()) return false + if (hideExtraGuis()) return false if (GardenAPI.inGarden()) { if (GardenAPI.onBarnPlot) return true if (!config.needs.onlyWhenClose) return true -- cgit