aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-01-21 00:40:01 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-01-21 00:40:01 +0100
commitc6c120c4b71e3badbc4d7b2c6600c98807aa87b8 (patch)
tree693b8ce0d1f02ad4c704f3313abe2172c43fab45
parentad850e4c2d3b0599da7da9449b87a92ad7e1c9d7 (diff)
downloadskyhanni-c6c120c4b71e3badbc4d7b2c6600c98807aa87b8.tar.gz
skyhanni-c6c120c4b71e3badbc4d7b2c6600c98807aa87b8.tar.bz2
skyhanni-c6c120c4b71e3badbc4d7b2c6600c98807aa87b8.zip
made the burrow fix more consistent
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt23
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt17
2 files changed, 31 insertions, 9 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 e55fb5e9d..23bd9c86d 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
@@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.data.EntityMovementData
import at.hannibal2.skyhanni.data.IslandType
+import at.hannibal2.skyhanni.events.BlockClickEvent
import at.hannibal2.skyhanni.events.BurrowDetectEvent
import at.hannibal2.skyhanni.events.BurrowDugEvent
import at.hannibal2.skyhanni.events.BurrowGuessEvent
@@ -13,7 +14,9 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
+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.KeyboardManager
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
@@ -257,6 +260,26 @@ object GriffinBurrowHelper {
event.move(2, "diana", "event.diana")
}
+ @SubscribeEvent
+ fun onBlockClick(event: BlockClickEvent) {
+ if (!isEnabled()) return
+
+ val location = event.position
+ if (event.itemInHand?.isDianaSpade != true || location.getBlockAt() !== Blocks.grass) return
+
+ if (particleBurrows.containsKey(location)) {
+ DelayedRun.runDelayed(1.seconds) {
+ if (BurrowAPI.lastBurrowRelatedChatMessage.passedSince() > 2.seconds) {
+ if (particleBurrows.containsKey(location)) {
+ LorenzUtils.error("Something unexected happened, deleted the burrow.")
+ particleBurrows = particleBurrows.editCopy { keys.remove(location) }
+ }
+ }
+ }
+
+ }
+ }
+
private fun showWarpSuggestions() {
if (!config.burrowNearestWarp) return
val warp = BurrowWarpHelper.currentWarp ?: return
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 b243f64c7..bbe17408f 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
@@ -163,24 +163,23 @@ class GriffinBurrowParticleFinder {
if (!isEnabled()) return
if (!config.burrowsSoopyGuess) return
- val pos = event.position
- if (event.itemInHand?.isDianaSpade != true || pos.getBlockAt() !== Blocks.grass) return
+ val location = event.position
+ if (event.itemInHand?.isDianaSpade != true || location.getBlockAt() !== Blocks.grass) return
- if (pos == fakeBurrow) {
+ 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(pos, ignoreFound = true)
+ tryDig(location, ignoreFound = true)
return
}
- if (burrows.containsKey(pos)) {
- lastDugParticleBurrow = pos
+ if (burrows.containsKey(location)) {
+ lastDugParticleBurrow = location
DelayedRun.runDelayed(1.seconds) {
- if (BurrowAPI.lastBurrowRelatedChatMessage.passedSince() > 1.seconds) {
- burrows.remove(pos)
- LorenzUtils.error("Something unexected happened, deleted the burrow.")
+ if (BurrowAPI.lastBurrowRelatedChatMessage.passedSince() > 2.seconds) {
+ burrows.remove(location)
}
}