From 161ed783e0e4e0d5d57e358f9939c08f934aee1d Mon Sep 17 00:00:00 2001 From: SeRaid <77941535+SeRaid743@users.noreply.github.com> Date: Mon, 15 Apr 2024 08:34:20 +1200 Subject: Improvement: renamed deep caverns parkour (#1443) --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 4 +- .../features/mining/DeepCavernsGuideConfig.java | 38 ++++++ .../features/mining/DeepCavernsParkourConfig.java | 38 ------ .../config/features/mining/MiningConfig.java | 4 +- .../skyhanni/features/mining/DeepCavernsGuide.kt | 152 +++++++++++++++++++++ .../skyhanni/features/mining/DeepCavernsParkour.kt | 146 -------------------- 6 files changed, 194 insertions(+), 188 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/config/features/mining/DeepCavernsGuideConfig.java delete mode 100644 src/main/java/at/hannibal2/skyhanni/config/features/mining/DeepCavernsParkourConfig.java create mode 100644 src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt (limited to 'src/main') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index dc3b8b2b0..6b55fd37b 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -263,7 +263,7 @@ import at.hannibal2.skyhanni.features.inventory.tiarelay.TiaRelayWaypoints import at.hannibal2.skyhanni.features.itemabilities.ChickenHeadTimer import at.hannibal2.skyhanni.features.itemabilities.FireVeilWandParticles import at.hannibal2.skyhanni.features.itemabilities.abilitycooldown.ItemAbilityCooldown -import at.hannibal2.skyhanni.features.mining.DeepCavernsParkour +import at.hannibal2.skyhanni.features.mining.DeepCavernsGuide import at.hannibal2.skyhanni.features.mining.HighlightMiningCommissionMobs import at.hannibal2.skyhanni.features.mining.KingTalismanHelper import at.hannibal2.skyhanni.features.mining.MiningNotifications @@ -499,7 +499,7 @@ class SkyHanniMod { loadModule(AdvancedPlayerList) loadModule(ItemAddManager()) loadModule(BingoCardReader()) - loadModule(DeepCavernsParkour()) + loadModule(DeepCavernsGuide()) loadModule(GardenBestCropTime()) loadModule(ActionBarData) loadModule(TrackerManager) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/mining/DeepCavernsGuideConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/mining/DeepCavernsGuideConfig.java new file mode 100644 index 000000000..9245aa32e --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/mining/DeepCavernsGuideConfig.java @@ -0,0 +1,38 @@ +package at.hannibal2.skyhanni.config.features.mining; + +import at.hannibal2.skyhanni.config.FeatureToggle; +import com.google.gson.annotations.Expose; +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorColour; +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider; +import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; +import io.github.notenoughupdates.moulconfig.observer.Property; + +public class DeepCavernsGuideConfig { + + @Expose + @ConfigOption(name = "Enabled", desc = "Shows a guide to the bottom of the Deep Caverns and to Rhys.") + @ConfigEditorBoolean + @FeatureToggle + public boolean enabled = true; + + @Expose + @ConfigOption(name = "Look Ahead", desc = "Change how many waypoints should be shown in front of you.") + @ConfigEditorSlider(minStep = 1, maxValue = 30, minValue = 1) + public Property lookAhead = Property.of(3); + + @Expose + @ConfigOption(name = "Rainbow Color", desc = "Show the rainbow color effect instead of a boring monochrome.") + @ConfigEditorBoolean + public Property rainbowColor = Property.of(true); + + @Expose + @ConfigOption(name = "Monochrome Color", desc = "Set a boring monochrome color for the guide waypoints.") + @ConfigEditorColour + public Property monochromeColor = Property.of("0:60:0:0:255"); + +// @Expose +// @ConfigOption(name = "Highlight all Lines", desc = "Show all lines in gray. Useful for debugging.") +// @ConfigEditorBoolean +// public boolean highlightAllLines = false; +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/mining/DeepCavernsParkourConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/mining/DeepCavernsParkourConfig.java deleted file mode 100644 index 9d8d1be01..000000000 --- a/src/main/java/at/hannibal2/skyhanni/config/features/mining/DeepCavernsParkourConfig.java +++ /dev/null @@ -1,38 +0,0 @@ -package at.hannibal2.skyhanni.config.features.mining; - -import at.hannibal2.skyhanni.config.FeatureToggle; -import com.google.gson.annotations.Expose; -import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; -import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorColour; -import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider; -import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; -import io.github.notenoughupdates.moulconfig.observer.Property; - -public class DeepCavernsParkourConfig { - - @Expose - @ConfigOption(name = "Enabled", desc = "Shows a parkour to the bottom of Deep Caverns and to Rhys.") - @ConfigEditorBoolean - @FeatureToggle - public boolean enabled = true; - - @Expose - @ConfigOption(name = "Look Ahead", desc = "Change how many waypoints should be shown in front of you.") - @ConfigEditorSlider(minStep = 1, maxValue = 30, minValue = 1) - public Property lookAhead = Property.of(3); - - @Expose - @ConfigOption(name = "Rainbow Color", desc = "Show the rainbow color effect instead of a boring monochrome.") - @ConfigEditorBoolean - public Property rainbowColor = Property.of(true); - - @Expose - @ConfigOption(name = "Monochrome Color", desc = "Set a boring monochrome color for the parkour platforms.") - @ConfigEditorColour - public Property monochromeColor = Property.of("0:60:0:0:255"); - - @Expose - @ConfigOption(name = "Highlight all Lines", desc = "Show all lines in gray. Useful for debugging.") - @ConfigEditorBoolean - public boolean highlightAllLines = false; -} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningConfig.java index 2393df0f7..a4f7f299e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningConfig.java @@ -24,9 +24,9 @@ public class MiningConfig { public KingTalismanConfig kingTalisman = new KingTalismanConfig(); @Expose - @ConfigOption(name = "Deep Caverns Parkour", desc = "") + @ConfigOption(name = "Deep Caverns Guide", desc = "") @Accordion - public DeepCavernsParkourConfig deepCavernsParkour = new DeepCavernsParkourConfig(); + public DeepCavernsGuideConfig deepCavernsGuide = new DeepCavernsGuideConfig(); @Expose @ConfigOption(name = "Area Walls", desc = "") diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt new file mode 100644 index 000000000..f0b72c539 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt @@ -0,0 +1,152 @@ +package at.hannibal2.skyhanni.features.mining + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.jsonobjects.repo.ParkourJson +import at.hannibal2.skyhanni.events.ConfigLoadEvent +import at.hannibal2.skyhanni.events.GuiContainerEvent +import at.hannibal2.skyhanni.events.InventoryCloseEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent +import at.hannibal2.skyhanni.events.IslandChangeEvent +import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent +import at.hannibal2.skyhanni.events.RepositoryReloadEvent +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor +import at.hannibal2.skyhanni.utils.ConditionalUtils +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland +import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName +import at.hannibal2.skyhanni.utils.NEUItems.getItemStack +import at.hannibal2.skyhanni.utils.ParkourHelper +import io.github.moulberry.notenoughupdates.events.ReplaceItemEvent +import io.github.moulberry.notenoughupdates.util.Utils +import net.minecraft.client.player.inventory.ContainerLocalMenu +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class DeepCavernsGuide { + + private val config get() = SkyHanniMod.feature.mining.deepCavernsGuide + + private var parkourHelper: ParkourHelper? = null + private var show = false + private var showStartIcon = false + + private val startIcon by lazy { + val neuItem = "MAP".asInternalName().getItemStack() + Utils.createItemStack( + neuItem.item, + "§bDeep Caverns Guide", + "§8(From SkyHanni)", + "", + "§7Manually enable the ", + "§7guide to the bottom", + "§7of the Deep Caverns." + ) + } + + @SubscribeEvent + fun onIslandChange(event: IslandChangeEvent) { + parkourHelper?.reset() + show = false + } + + @SubscribeEvent + fun onRepoReload(event: RepositoryReloadEvent) { + val data = event.getConstant("DeepCavernsParkour") + parkourHelper = ParkourHelper( + data.locations, + data.shortCuts, + platformSize = 1.0, + detectionRange = 3.5, + depth = false, + onEndReach = { + show = false + } + ) + updateConfig() + } + + @SubscribeEvent + fun onConfigLoad(event: ConfigLoadEvent) { + ConditionalUtils.onToggle(config.rainbowColor, config.monochromeColor, config.lookAhead) { + updateConfig() + } + } + + private fun updateConfig() { + parkourHelper?.run { + rainbowColor = config.rainbowColor.get() + monochromeColor = config.monochromeColor.get().toChromaColor() + lookAhead = config.lookAhead.get() + 1 + } + } + + @SubscribeEvent + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { + showStartIcon = false + if (!isEnabled()) return + if (event.inventoryName != "Lift") return + if (LorenzUtils.skyBlockArea != "Gunpowder Mines") return + showStartIcon = true + + event.inventoryItems[30]?.let { + if (it.displayName != "§aObsidian Sanctuary") { + if (!show) { + start() + ChatUtils.chat("Automatically enabling Deep Caverns Guide, helping you find the way to the bottom of the Deep Caverns and the path to Rhys.") + } + } + } + } + + private fun start() { + show = true + parkourHelper?.reset() + if (parkourHelper == null) { + ChatUtils.clickableChat( + "DeepCavernsParkour missing in SkyHanni Repo! Try /shupdaterepo to fix it!", + "shupdaterepo", + prefixColor = "§c" + ) + } + } + + @SubscribeEvent + fun onInventoryClose(event: InventoryCloseEvent) { + showStartIcon = false + } + + @SubscribeEvent + fun replaceItem(event: ReplaceItemEvent) { + if (show) return + if (event.inventory is ContainerLocalMenu && showStartIcon && event.slotNumber == 49) { + event.replaceWith(startIcon) + } + } + + @SubscribeEvent(priority = EventPriority.HIGH) + fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) { + if (showStartIcon && event.slotId == 49) { + event.isCanceled = true + ChatUtils.chat("Manually enabled Deep Caverns Guide.") + start() + } + } + + @SubscribeEvent + fun onRenderWorld(event: LorenzRenderWorldEvent) { + if (!isEnabled()) return + if (!show) return + + parkourHelper?.render(event) + } + + fun isEnabled() = IslandType.DEEP_CAVERNS.isInIsland() && config.enabled + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(38, "mining.deepCavernsParkour", "mining.deepCavernsGuide") + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt deleted file mode 100644 index 5fc57e010..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt +++ /dev/null @@ -1,146 +0,0 @@ -package at.hannibal2.skyhanni.features.mining - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.IslandType -import at.hannibal2.skyhanni.data.jsonobjects.repo.ParkourJson -import at.hannibal2.skyhanni.events.ConfigLoadEvent -import at.hannibal2.skyhanni.events.GuiContainerEvent -import at.hannibal2.skyhanni.events.InventoryCloseEvent -import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent -import at.hannibal2.skyhanni.events.IslandChangeEvent -import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent -import at.hannibal2.skyhanni.events.RepositoryReloadEvent -import at.hannibal2.skyhanni.utils.ChatUtils -import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor -import at.hannibal2.skyhanni.utils.ConditionalUtils -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName -import at.hannibal2.skyhanni.utils.NEUItems.getItemStack -import at.hannibal2.skyhanni.utils.ParkourHelper -import io.github.moulberry.notenoughupdates.events.ReplaceItemEvent -import io.github.moulberry.notenoughupdates.util.Utils -import net.minecraft.client.player.inventory.ContainerLocalMenu -import net.minecraftforge.fml.common.eventhandler.EventPriority -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -class DeepCavernsParkour { - - private val config get() = SkyHanniMod.feature.mining.deepCavernsParkour - - private var parkourHelper: ParkourHelper? = null - private var show = false - private var showStartIcon = false - - private val startIcon by lazy { - val neuItem = "MAP".asInternalName().getItemStack() - Utils.createItemStack( - neuItem.item, - "§bDeep Caverns Parkour", - "§8(From SkyHanni)", - "", - "§7Manually enable the ", - "§7Parkour to the bottom", - "§7of Deep Caverns." - ) - } - - @SubscribeEvent - fun onIslandChange(event: IslandChangeEvent) { - parkourHelper?.reset() - show = false - } - - @SubscribeEvent - fun onRepoReload(event: RepositoryReloadEvent) { - val data = event.getConstant("DeepCavernsParkour") - parkourHelper = ParkourHelper( - data.locations, - data.shortCuts, - platformSize = 1.0, - detectionRange = 3.5, - depth = false, - onEndReach = { - show = false - } - ) - updateConfig() - } - - @SubscribeEvent - fun onConfigLoad(event: ConfigLoadEvent) { - ConditionalUtils.onToggle(config.rainbowColor, config.monochromeColor, config.lookAhead) { - updateConfig() - } - } - - private fun updateConfig() { - parkourHelper?.run { - rainbowColor = config.rainbowColor.get() - monochromeColor = config.monochromeColor.get().toChromaColor() - lookAhead = config.lookAhead.get() + 1 - } - } - - @SubscribeEvent - fun onInventoryOpen(event: InventoryFullyOpenedEvent) { - showStartIcon = false - if (!isEnabled()) return - if (event.inventoryName != "Lift") return - if (LorenzUtils.skyBlockArea != "Gunpowder Mines") return - showStartIcon = true - - event.inventoryItems[30]?.let { - if (it.displayName != "§aObsidian Sanctuary") { - if (!show) { - start() - ChatUtils.chat("Automatically enabling Deep Caverns Parkour, helping you find the way to the bottom of Deep Caverns and the path to Rhys.") - } - } - } - } - - private fun start() { - show = true - parkourHelper?.reset() - if (parkourHelper == null) { - ChatUtils.clickableChat( - "DeepCavernsParkour missing in SkyHanni Repo! Try /shupdaterepo to fix it!", - "shupdaterepo", - prefixColor = "§c" - ) - } - } - - @SubscribeEvent - fun onInventoryClose(event: InventoryCloseEvent) { - showStartIcon = false - } - - @SubscribeEvent - fun replaceItem(event: ReplaceItemEvent) { - if (show) return - if (event.inventory is ContainerLocalMenu && showStartIcon && event.slotNumber == 40) { - event.replaceWith(startIcon) - } - } - - @SubscribeEvent(priority = EventPriority.HIGH) - fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) { - if (showStartIcon && event.slotId == 40) { - event.isCanceled = true - ChatUtils.chat("Manually enabled Deep Caverns Parkour.") - start() - } - } - - @SubscribeEvent - fun onRenderWorld(event: LorenzRenderWorldEvent) { - if (!isEnabled()) return - if (!show) return - - parkourHelper?.render(event) - } - - fun isEnabled() = IslandType.DEEP_CAVERNS.isInIsland() && config.enabled -} -- cgit