From 0c42c67396e2c77bd2dc5db78c1b3199f9f1a532 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 5 Feb 2024 08:13:05 +0100 Subject: [PATCH 01/11] Updated discord FAQ --- DISCORD_FAQ.md | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/DISCORD_FAQ.md b/DISCORD_FAQ.md index cc76c65be273..00d89bfd887f 100644 --- a/DISCORD_FAQ.md +++ b/DISCORD_FAQ.md @@ -28,8 +28,10 @@ _Frequently Asked Questions_ > Use [Patcher]() to have 1.12 hit boxes in 1.8.9. > **9: Why does my Item Tracker feature not track this item?** -> Check if the item goes directly into your sacks. If it does, enable the sack pickup chat message from Hypixel. -> You can use SkyHanni's own setting to still hide the message from chat. +> 1. Check if the item goes directly into your sacks. +> 2. If it does, enable the sack pickup chat message from Hypixel: +> 3. Go to `hypixel settings --> personal -> chat feedback` and enable `sack notifications` +> 4. If you want the [Sacks] messages to be hidden, do `/sh sacks hider` and enable that > **10: How do I remove SkyHanni GUI elements?** > 1. Type `/sh gui` @@ -38,10 +40,17 @@ _Frequently Asked Questions_ > 4. Search for that element with /sh name > 5. Disable this feature -> **11: How do I reset a tracker?** -> To reset a tracker, use the in-game command /shcommands . -> Execute the obtained command to reset the tracker - - -*This FAQ was last updated on January 7th, 2024. +> **11: How do I reset a SkyHanni tracker?** +> 1. Do you want to **view only the current session**? +> 2. Open the inventory (Press E) and hover over the display. +> 3. Then click on [session]. +> 1. Do you want to **remove one specific item** from the tracker? +> 2. Open the inventory (Press E) and hover over the display. +> 3. Then shift-click on an item in the list to remove it. +> 1. Do you want to reset the total stats of a tracker? +> 2. To reset a tracker, use the in-game command /shcommands . +> 3. Execute the obtained command to reset the tracker. + + +*This FAQ was last updated on February 5th, 2024. If you believe there's something that should be added to this list, please tell us, so we can add it.* From 62f4d8cd10210ea255860f37ffde62180d3400fe Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 5 Feb 2024 11:26:50 +0100 Subject: [PATCH 02/11] Added Deep Caverns Parkour. --- .../java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 + .../mining/DeepCavernsParkourConfig.java | 38 +++++ .../config/features/mining/MiningConfig.java | 5 + .../features/mining/DeepCavernsParkour.kt | 136 ++++++++++++++++++ .../hannibal2/skyhanni/utils/ParkourHelper.kt | 11 +- 5 files changed, 189 insertions(+), 3 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/config/features/mining/DeepCavernsParkourConfig.java create mode 100644 src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index d6e13743cc87..af6bf4d64512 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -223,6 +223,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.HighlightMiningCommissionMobs import at.hannibal2.skyhanni.features.mining.KingTalismanHelper import at.hannibal2.skyhanni.features.mining.crystalhollows.CrystalHollowsNamesInCore @@ -436,6 +437,7 @@ class SkyHanniMod { loadModule(AdvancedPlayerList) loadModule(ItemAddManager()) loadModule(BingoCardReader()) + loadModule(DeepCavernsParkour()) loadModule(GardenBestCropTime()) loadModule(TrackerManager) loadModule(UtilsPatterns) 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 new file mode 100644 index 000000000000..ab1ba6a4919a --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/mining/DeepCavernsParkourConfig.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.moulberry.moulconfig.annotations.ConfigEditorBoolean; +import io.github.moulberry.moulconfig.annotations.ConfigEditorColour; +import io.github.moulberry.moulconfig.annotations.ConfigEditorSlider; +import io.github.moulberry.moulconfig.annotations.ConfigOption; +import io.github.moulberry.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 = "Hilight 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 feeb465abaf5..462908f6e8cd 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 @@ -18,6 +18,11 @@ public class MiningConfig { @Accordion public KingTalismanConfig kingTalisman = new KingTalismanConfig(); + @Expose + @ConfigOption(name = "Deep Caverns Parkour", desc = "") + @Accordion + public DeepCavernsParkourConfig deepCavernsParkour = new DeepCavernsParkourConfig(); + @Expose @ConfigOption(name = "Highlight Commission Mobs", desc = "Highlight Mobs that are part of active commissions.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt new file mode 100644 index 000000000000..0c08c8b177ed --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt @@ -0,0 +1,136 @@ +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.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.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland +import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor +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.events.SlotClickEvent +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) { + LorenzUtils.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() + LorenzUtils.chat("Automatically enabling Deep Caverns Parkour, helping you find the way to the bottom of Deep Caverns and the path to Ryst.") + } + } + } + } + + private fun start() { + show = true + parkourHelper?.reset() + } + + @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 onStackClick(event: SlotClickEvent) { + if (showStartIcon && event.slotId == 40) { + event.isCanceled = true + LorenzUtils.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 +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt index e80aa7f628d4..c9ebdc5a6584 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt @@ -20,7 +20,9 @@ class ParkourHelper( val locations: List, private val shortCuts: List, val platformSize: Double = 1.0, - val detectionRange: Double = 1.0 + val detectionRange: Double = 1.0, + val depth: Boolean = true, + val onEndReach: () -> Unit = {} ) { private var current = -1 private var visible = false @@ -77,6 +79,9 @@ class ParkourHelper( } val inProgressVec = getInProgressPair().toSingletonListOrEmpty() + if (locations.size == current + 1) { + onEndReach() + } for ((prev, next) in locations.asSequence().withIndex().zipWithNext().drop(current) .take(lookAhead - 1) + inProgressVec) { event.draw3DLine_nea( @@ -98,7 +103,7 @@ class ParkourHelper( val aabb = axisAlignedBB(locations[shortCut.to]) event.drawFilledBoundingBox_nea(aabb, Color.RED, 1f) - if (outline) event.outlineTopFace(aabb, 2, Color.BLACK, true) + if (outline) event.outlineTopFace(aabb, 2, Color.BLACK, depth) } } @@ -113,7 +118,7 @@ class ParkourHelper( } else { val aabb = axisAlignedBB(location) event.drawFilledBoundingBox_nea(aabb, colorForIndex(index), 1f) - if (outline) event.outlineTopFace(aabb, 2, Color.BLACK, true) + if (outline) event.outlineTopFace(aabb, 2, Color.BLACK, depth) } if (SkyHanniMod.feature.dev.waypoint.showPlatformNumber && !isMovingPlatform) { event.drawString(location.offsetCenter().add(y = 1), "§a§l$index", seeThroughBlocks = true) From 3504ea84c69e38943f42ae006596f0b46cbf005e Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 5 Feb 2024 11:34:40 +0100 Subject: [PATCH 03/11] code cleanup --- .../features/garden/visitor/VisitorConfig.java | 1 - .../features/cosmetics/CosmeticFollowingLine.kt | 9 +++++---- .../garden/inventory/GardenDeskInSBMenu.kt | 14 +++++++++++--- .../skyhanni/features/mining/KingTalismanHelper.kt | 13 +++++++------ 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/VisitorConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/VisitorConfig.java index 654dcf511812..92ab5bb16d54 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/VisitorConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/VisitorConfig.java @@ -121,7 +121,6 @@ public String toString() { @FeatureToggle public boolean highlightVisitors = false; - @Expose @ConfigOption( name = "Block Interacting with Visitors", diff --git a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt index 022ec07b93b6..9e77ab6e4829 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt @@ -54,15 +54,15 @@ class CosmeticFollowingLine { val last7 = locations.keys.toList().takeLast(7) val last2 = locations.keys.toList().takeLast(2) - for ((a, b) in locations.keys.zipWithNext()) { + locations.keys.zipWithNext { a, b -> val locationSpot = locations[b]!! if (firstPerson && !locationSpot.onGround && b in last7) { // Do not render the line in the face, keep more distance while the line is in the air - continue + return } if (b in last2 && locationSpot.time.passedSince() < 400.milliseconds) { // Do not render the line directly next to the player, prevent laggy design - continue + return } event.draw3DLine(a, b, color, locationSpot.getWidth(), !config.behindBlocks) } @@ -81,7 +81,8 @@ class CosmeticFollowingLine { private fun renderClose(event: LorenzRenderWorldEvent, firstPerson: Boolean, color: Color) { if (firstPerson && latestLocations.any { !it.value.onGround }) return - for ((a, b) in latestLocations.keys.zipWithNext()) { + + latestLocations.keys.zipWithNext { a, b -> val locationSpot = latestLocations[b]!! event.draw3DLine(a, b, color, locationSpot.getWidth(), !config.behindBlocks) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt index bc20b44a3f93..6e0d8e40042e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt @@ -4,7 +4,8 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.NEUItems +import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName +import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import io.github.moulberry.notenoughupdates.events.ReplaceItemEvent import io.github.moulberry.notenoughupdates.events.SlotClickEvent import io.github.moulberry.notenoughupdates.util.Utils @@ -18,8 +19,15 @@ class GardenDeskInSBMenu { private var showItem = false private val item by lazy { - val neuItem = NEUItems.getItemStack("DOUBLE_PLANT") - Utils.createItemStack(neuItem.item, "§bDesk", "§7Click here to", "§7run §e/desk") + val neuItem = "DOUBLE_PLANT".asInternalName().getItemStack() + Utils.createItemStack( + neuItem.item, + "§bOpen Desk", + "§8(From SkyHanni)", + "", + "§7Click here to", + "§7run §e/desk" + ) } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt index 93e12cc6f2cb..36eaa7a24b92 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt @@ -23,6 +23,7 @@ import java.util.Collections class KingTalismanHelper { private val config get() = SkyHanniMod.feature.mining.kingTalisman + private val storage get() = ProfileStorageData.profileSpecific?.mining companion object { private var currentOffset: Int? = null @@ -63,14 +64,14 @@ class KingTalismanHelper { fun onTick(event: LorenzTickEvent) { if (!event.isMod(20)) return if (!isEnabled()) return - val profileSpecific = ProfileStorageData.profileSpecific ?: return + val storage = storage ?: return val nearby = isNearby() if (nearby && getCurrentOffset() == null) { checkOffset() } - val kingsTalkedTo = profileSpecific.mining.kingsTalkedTo + val kingsTalkedTo = storage.kingsTalkedTo if (getCurrentOffset() == null) { val allKings = kingsTalkedTo.size == kingCircles.size display = if (allKings) emptyList() else listOf("§cVisit the king to sync up.") @@ -103,10 +104,10 @@ class KingTalismanHelper { if (!isEnabled()) return if (getCurrentOffset() == null) return if (!isNearby()) return - val profileSpecific = ProfileStorageData.profileSpecific ?: return + val storage = storage ?: return val currentKing = getCurrentKing() - val kingsTalkedTo = profileSpecific.mining.kingsTalkedTo + val kingsTalkedTo = storage.kingsTalkedTo if (currentKing !in kingsTalkedTo) { LorenzUtils.debug("Found new king!") kingsTalkedTo.add(currentKing) @@ -154,8 +155,8 @@ class KingTalismanHelper { } private fun nextMissingText(): String { - val profileSpecific = ProfileStorageData.profileSpecific ?: error("profileSpecific is null") - val kingsTalkedTo = profileSpecific.mining.kingsTalkedTo + val storage = storage ?: error("profileSpecific is null") + val kingsTalkedTo = storage.kingsTalkedTo val (nextKing, until) = getKingTimes().filter { it.key !in kingsTalkedTo }.sorted().firstNotNullOf { it } val time = TimeUtils.formatDuration(until, maxUnits = 2) From 5bc87085703fd73ef4de653b0e16363de459ef80 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 5 Feb 2024 11:36:29 +0100 Subject: [PATCH 04/11] Fixed wrong package --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 +- .../skyhanni/features/event/diana/HighlightInquisitors.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index af6bf4d64512..72c7709e7443 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -113,10 +113,10 @@ import at.hannibal2.skyhanni.features.event.diana.DianaProfitTracker import at.hannibal2.skyhanni.features.event.diana.GriffinBurrowHelper import at.hannibal2.skyhanni.features.event.diana.GriffinBurrowParticleFinder import at.hannibal2.skyhanni.features.event.diana.GriffinPetWarning +import at.hannibal2.skyhanni.features.event.diana.HighlightInquisitors import at.hannibal2.skyhanni.features.event.diana.InquisitorWaypointShare import at.hannibal2.skyhanni.features.event.diana.MythologicalCreatureTracker import at.hannibal2.skyhanni.features.event.diana.SoopyGuessBurrow -import at.hannibal2.skyhanni.features.event.jerry.HighlightInquisitors import at.hannibal2.skyhanni.features.event.jerry.HighlightJerries import at.hannibal2.skyhanni.features.event.jerry.frozentreasure.FrozenTreasureTracker import at.hannibal2.skyhanni.features.event.lobby.waypoints.christmas.PresentWaypoints diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt index 45694c34136a..44f95cfcdcfe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt @@ -1,4 +1,4 @@ -package at.hannibal2.skyhanni.features.event.jerry +package at.hannibal2.skyhanni.features.event.diana import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.withAlpha From 426fb7ed6d266f14ff98c61c5346955b5b3fdc3b Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 5 Feb 2024 11:51:02 +0100 Subject: [PATCH 05/11] Show error message when DeepCavernsParkour repo is missing --- .../skyhanni/features/mining/DeepCavernsParkour.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt index 0c08c8b177ed..18bffb4a4b2a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt @@ -100,6 +100,13 @@ class DeepCavernsParkour { private fun start() { show = true parkourHelper?.reset() + if (parkourHelper == null) { + LorenzUtils.clickableChat( + "DeepCavernsParkour missing in SkyHanni Repo! Try /shupdaterepo to fix it!", + "shupdaterepo", + prefixColor = "§c" + ) + } } @SubscribeEvent From 95029eebcc73feac8842e953239cb71a0c1d1b48 Mon Sep 17 00:00:00 2001 From: martimavocado <39881008+martimavocado@users.noreply.github.com> Date: Mon, 5 Feb 2024 11:04:10 +0000 Subject: [PATCH 06/11] Bug Fix: Fix pets menu detection for /ff (#970) Fixing pets menu detection for /ff #970 --- .../features/garden/fortuneguide/CaptureFarmingGear.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt index dd457688ad74..f93192a3d10e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt @@ -49,6 +49,10 @@ class CaptureFarmingGear { "uniquevisitors.tierprogress", ".* §e(?.*)§6/(?.*)" ) + private val petMenuPattern by patternGroup.pattern( + "petsmenu", + "Pets(?: \\(\\d+/\\d+\\) )?" + ) companion object { private val strengthPattern = " Strength: §r§c❁(?.*)".toPattern() @@ -127,9 +131,12 @@ class CaptureFarmingGear { val farmingItems = farmingItems ?: return val outdatedItems = outdatedItems ?: return val items = event.inventoryItems + petMenuPattern.matchMatcher(event.inventoryName) { + pets(farmingItems, items, outdatedItems) + return + } when (event.inventoryName) { "Your Equipment and Stats" -> equipmentAndStats(items, farmingItems, outdatedItems) - "Pets" -> pets(farmingItems, items, outdatedItems) "Your Skills" -> skills(items, storage) "Community Shop" -> communityShop(items) "Configure Plots" -> configurePlots(items, storage) From 03ce43d928d18328e0cd731f161a7bfd794af3d3 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 5 Feb 2024 12:07:44 +0100 Subject: [PATCH 07/11] Moving pet menu check into PetAPI --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 ++ src/main/java/at/hannibal2/skyhanni/data/PetAPI.kt | 9 +++++++++ .../features/garden/fortuneguide/CaptureFarmingGear.kt | 7 ++----- .../skyhanni/features/misc/CurrentPetDisplay.kt | 3 +-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 72c7709e7443..42c4d70a01cb 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -31,6 +31,7 @@ import at.hannibal2.skyhanni.data.MinecraftData import at.hannibal2.skyhanni.data.OtherInventoryData import at.hannibal2.skyhanni.data.OwnInventoryData import at.hannibal2.skyhanni.data.PartyAPI +import at.hannibal2.skyhanni.data.PetAPI import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.data.PurseAPI import at.hannibal2.skyhanni.data.RenderData @@ -441,6 +442,7 @@ class SkyHanniMod { loadModule(GardenBestCropTime()) loadModule(TrackerManager) loadModule(UtilsPatterns) + loadModule(PetAPI) // APIs loadModule(BazaarApi()) diff --git a/src/main/java/at/hannibal2/skyhanni/data/PetAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/PetAPI.kt index d8061683b945..f422c0b12eb2 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/PetAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/PetAPI.kt @@ -1,6 +1,15 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.utils.StringUtils.matches +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern + object PetAPI { + private val petMenuPattern by RepoPattern.pattern( + "misc.pet.menu.title", + "Pets(?: \\(\\d+/\\d+\\) )?" + ) + + fun isPetMenu(inventoryTitle: String): Boolean = petMenuPattern.matches(inventoryTitle) // Contains color code + name and for older SkyHanni users maybe also the pet level var currentPet: String? diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt index f93192a3d10e..d8fd9f13d77e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.fortuneguide import at.hannibal2.skyhanni.config.Storage +import at.hannibal2.skyhanni.data.PetAPI import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.GardenToolChangeEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent @@ -49,10 +50,6 @@ class CaptureFarmingGear { "uniquevisitors.tierprogress", ".* §e(?.*)§6/(?.*)" ) - private val petMenuPattern by patternGroup.pattern( - "petsmenu", - "Pets(?: \\(\\d+/\\d+\\) )?" - ) companion object { private val strengthPattern = " Strength: §r§c❁(?.*)".toPattern() @@ -131,7 +128,7 @@ class CaptureFarmingGear { val farmingItems = farmingItems ?: return val outdatedItems = outdatedItems ?: return val items = event.inventoryItems - petMenuPattern.matchMatcher(event.inventoryName) { + if (PetAPI.isPetMenu(event.inventoryName)) { pets(farmingItems, items, outdatedItems) return } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt index d4cc01fbd449..ebff243f9ce7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt @@ -18,7 +18,6 @@ class CurrentPetDisplay { private val config get() = SkyHanniMod.feature.misc.pets // TODO USE SH-REPO - private val inventoryNamePattern = "Pets( \\(\\d+/\\d+\\) )?".toPattern() private val inventorySelectedPetPattern = "§7§7Selected pet: (?.*)".toPattern() private val chatSpawnPattern = "§aYou summoned your §r(?.*)§r§a!".toPattern() private val chatDespawnPattern = "§aYou despawned your §r.*§r§a!".toPattern() @@ -50,7 +49,7 @@ class CurrentPetDisplay { @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { - if (!inventoryNamePattern.matches(event.inventoryName)) return + if (!PetAPI.isPetMenu(event.inventoryName)) return val lore = event.inventoryItems[4]?.getLore() ?: return for (line in lore) { From 146c0be91b210895105319b3d6727aa5a184e547 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Mon, 5 Feb 2024 22:10:13 +1100 Subject: [PATCH 08/11] fix pattern (#979) Fixed powder mining start/end detection in Powder Tracker. #979 --- .../skyhanni/features/mining/powdertracker/PowderTracker.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt index 9a9c49ff27a1..a328d12ce1d6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt @@ -42,11 +42,11 @@ object PowderTracker { ) private val powderStartedPattern by patternGroup.pattern( "powder.started", - ".*§r§b§l2X POWDER ENDED!.*" + ".*§r§b§l2X POWDER STARTED!.*" ) private val powderEndedPattern by patternGroup.pattern( "powder.ended", - ".*§r§b§l2X POWDER STARTED!.*" + ".*§r§b§l2X POWDER ENDED!.*" ) private val powderBossBarPattern by patternGroup.pattern( "powder.bossbar", From efc0fc65f2fede6204fa1cd9d3918a2f5d37dd92 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Mon, 5 Feb 2024 22:12:09 +1100 Subject: [PATCH 09/11] check for in garden (#972) Fixing Anita and Jacob workaround working outside garden. #972 --- .../hannibal2/skyhanni/features/garden/visitor/NPCVisitorFix.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/NPCVisitorFix.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/NPCVisitorFix.kt index f4256010034c..5fe8f1dd0604 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/NPCVisitorFix.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/NPCVisitorFix.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.InventoryOpenEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.garden.visitor.VisitorOpenEvent +import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceTo @@ -29,6 +30,7 @@ object NPCVisitorFix { @SubscribeEvent fun onInventoryOpen(event: InventoryOpenEvent) { + if (!GardenAPI.inGarden()) return val name = staticVisitors.firstOrNull { event.inventoryName.contains(it) } ?: return val nearest = findNametags(name).firstOrNull { it.distanceToPlayer() < 3 } ?: return DelayedRun.runDelayed(200.milliseconds) { From 0f8ba9557a058909b071e1c817f3d94b4066f6f7 Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Mon, 5 Feb 2024 12:22:12 +0100 Subject: [PATCH 10/11] Fix: Click Keybinds (Minion Feature) (#971) Fixed Minion XP calculation not working when having differnt mouse settings. #971 --- .../hannibal2/skyhanni/data/ItemClickData.kt | 19 +++++++------ .../features/minion/MinionFeatures.kt | 28 +++++++++---------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt index f4621877a013..4aa796b54185 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemClickData.kt @@ -13,7 +13,6 @@ import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement import net.minecraft.network.play.client.C0APacketAnimation import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.InputEvent -import org.lwjgl.input.Mouse class ItemClickData { @@ -39,20 +38,24 @@ class ItemClickData { } @SubscribeEvent - fun onEntityClick(event: InputEvent.MouseInputEvent) { + fun onEntityClick(event: InputEvent) { if (!LorenzUtils.inSkyBlock) return val minecraft = Minecraft.getMinecraft() - val clickedEntity = minecraft.pointedEntity - if (minecraft.thePlayer == null) return - if (clickedEntity == null) return - val clickType = when (Mouse.getEventButton()) { - 0 -> ClickType.LEFT_CLICK - 1 -> ClickType.RIGHT_CLICK + val attackKey = minecraft.gameSettings.keyBindAttack + val useKey = minecraft.gameSettings.keyBindUseItem + + val clickType = when { + attackKey.isKeyDown -> ClickType.LEFT_CLICK + useKey.isKeyDown -> ClickType.RIGHT_CLICK else -> return } + val clickedEntity = minecraft.pointedEntity + if (minecraft.thePlayer == null) return + if (clickedEntity == null) return + EntityClickEvent(clickType, clickedEntity).postAndCatch() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt index 7cd0d7c9e332..3495a35f18b6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -3,8 +3,11 @@ package at.hannibal2.skyhanni.features.minion import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.Storage +import at.hannibal2.skyhanni.data.ClickType import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.ProfileStorageData +import at.hannibal2.skyhanni.events.BlockClickEvent +import at.hannibal2.skyhanni.events.EntityClickEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.InventoryUpdatedEvent @@ -50,11 +53,10 @@ import net.minecraftforge.client.event.RenderLivingEvent import net.minecraftforge.event.entity.player.PlayerInteractEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.gameevent.InputEvent -import org.lwjgl.input.Mouse import java.awt.Color class MinionFeatures { + private val config get() = SkyHanniMod.feature.minions private var lastClickedEntity: LorenzVec? = null private var newMinion: LorenzVec? = null @@ -86,21 +88,19 @@ class MinionFeatures { } @SubscribeEvent - fun onClick(event: InputEvent.MouseInputEvent) { + fun onEntityClick(event: EntityClickEvent) { if (!enableWithHub()) return + if (event.clickType != ClickType.RIGHT_CLICK) return - if (!Mouse.getEventButtonState()) return - if (Mouse.getEventButton() != 1) return + lastClickedEntity = event.clickedEntity?.getLorenzVec() ?: return + } - val minecraft = Minecraft.getMinecraft() - val entity = minecraft.pointedEntity - if (entity != null) { - lastClickedEntity = entity.getLorenzVec() - return - } - minecraft.thePlayer.rayTrace(16.0, 1.0f)?.let { - lastStorage = it.blockPos.toLorenzVec() - } + @SubscribeEvent + fun onBlockClick(event: BlockClickEvent) { + if (!enableWithHub()) return + if (event.clickType != ClickType.RIGHT_CLICK) return + + lastStorage = event.position } @SubscribeEvent From aae0c39df6c42333d13b4e86e96f7fa58025330d Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 5 Feb 2024 12:25:35 +0100 Subject: [PATCH 11/11] No more griffin burrow errors --- .../skyhanni/features/event/diana/GriffinBurrowHelper.kt | 2 +- .../features/event/diana/GriffinBurrowParticleFinder.kt | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt index 722bdcd12413..468dadc1836e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt @@ -275,7 +275,7 @@ object GriffinBurrowHelper { DelayedRun.runDelayed(1.seconds) { if (BurrowAPI.lastBurrowRelatedChatMessage.passedSince() > 2.seconds) { if (particleBurrows.containsKey(location)) { - LorenzUtils.error("Something unexected happened, deleted the burrow.") + // workaround particleBurrows = particleBurrows.editCopy { keys.remove(location) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt index f21b808b205c..c49f6c551d03 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt @@ -11,7 +11,6 @@ import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.features.event.diana.DianaAPI.isDianaSpade import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt import at.hannibal2.skyhanni.utils.DelayedRun -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.TimeLimitedSet @@ -169,7 +168,6 @@ class GriffinBurrowParticleFinder { if (location == fakeBurrow) { fakeBurrow = null // This exist to detect the unlucky timing when the user opens a burrow before it gets fully deteced - LorenzUtils.chat("§dYou found a rare burrow bug. SkyHanni can auto fix it, though.") tryDig(location, ignoreFound = true) return }