diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-05-08 13:01:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-08 13:01:14 +0200 |
commit | 773b199b6d28154a74a129b12a3a3f9d8b769765 (patch) | |
tree | 13f696e7d587d4e240772f32991da3d38ec894e4 /src/main/java/at/hannibal2 | |
parent | f9ce2fa19a1178fd9f2e2728d09ac5acd299d69f (diff) | |
download | skyhanni-773b199b6d28154a74a129b12a3a3f9d8b769765.tar.gz skyhanni-773b199b6d28154a74a129b12a3a3f9d8b769765.tar.bz2 skyhanni-773b199b6d28154a74a129b12a3a3f9d8b769765.zip |
Improvement + Fix: More Hoppity Waypoint options (#1739)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java | 15 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt | 61 |
2 files changed, 54 insertions, 22 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java index 49923ddd5..8e1c98fd7 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java @@ -17,6 +17,21 @@ public class HoppityEggsConfig { public boolean waypoints = true; @Expose + @ConfigOption( + name = "Show Waypoints Immediately", + desc = "Show a raw estimate waypoint immedialtey after clicking. " + + "§cThis might cause issues with other paricle sources." + ) + @ConfigEditorBoolean + public boolean waypointsImmediately = false; + + @Expose + @ConfigOption(name = "Show Line", desc = "Show a line to the waypoint.") + @ConfigEditorBoolean + @FeatureToggle + public boolean showLine = false; + + @Expose @ConfigOption(name = "Show All Waypoints", desc = "Show all possible egg waypoints for the current lobby. §e" + "Only works when you don't have an Egglocator in your inventory.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt index 9d11d8b62..c57ec2b33 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt @@ -1,7 +1,9 @@ package at.hannibal2.skyhanni.features.event.hoppity +import at.hannibal2.skyhanni.data.ClickType import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.DebugDataCollectEvent +import at.hannibal2.skyhanni.events.ItemClickEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent @@ -36,6 +38,7 @@ object HoppityEggLocator { private var lastParticlePosition: LorenzVec? = null private var lastParticlePositionForever: LorenzVec? = null private var lastChange = SimpleTimeMark.farPast() + private var lastClick = SimpleTimeMark.farPast() private val validParticleLocations = mutableListOf<LorenzVec>() private var drawLocations = false @@ -76,18 +79,23 @@ object HoppityEggLocator { if (!isEnabled()) return val eyeLocation = event.exactPlayerEyeLocation() - lastParticlePositionForever?.let { - if (lastChange.passedSince() < 300.milliseconds) { - if (eyeLocation.distance(it) > 2) { - event.drawWaypointFilled( - it, - LorenzColor.GREEN.toColor(), - seeThroughBlocks = true, - ) - event.drawDynamicText(it.add(y = 1), "§aGuess", 1.5) - } - if (!drawLocations) { - event.draw3DLine(eyeLocation, it.add(0.5, 0.5, 0.5), LorenzColor.GREEN.toColor(), 2, false) + + if (config.waypointsImmediately && lastClick.passedSince() < 5.seconds) { + lastParticlePositionForever?.let { + if (lastChange.passedSince() < 300.milliseconds) { + if (eyeLocation.distance(it) > 2) { + event.drawWaypointFilled( + it, + LorenzColor.GREEN.toColor(), + seeThroughBlocks = true, + ) + event.drawDynamicText(it.add(y = 1), "§aGuess", 1.5) + } + if (!drawLocations) { + if (config.showLine) { + event.draw3DLine(eyeLocation, it.add(0.5, 0.5, 0.5), LorenzColor.GREEN.toColor(), 2, false) + } + } } } } @@ -100,20 +108,19 @@ object HoppityEggLocator { seeThroughBlocks = true, ) event.drawDynamicText(eggLocation.add(y = 1), eggLabel, 1.5) - event.draw3DLine(eyeLocation, eggLocation.add(0.5, 0.5, 0.5), LorenzColor.GREEN.toColor(), 2, false) + if (config.showLine) { + event.draw3DLine(eyeLocation, eggLocation.add(0.5, 0.5, 0.5), LorenzColor.GREEN.toColor(), 2, false) + } } return } - val sharedEggLocation = sharedEggLocation - if (sharedEggLocation != null && config.sharedWaypoints) { - event.drawWaypointFilled( - sharedEggLocation, - LorenzColor.GREEN.toColor(), - seeThroughBlocks = true, - ) - event.drawDynamicText(sharedEggLocation.add(y = 1), "§aShared Egg", 1.5) - return + sharedEggLocation?.let { + if (config.sharedWaypoints) { + event.drawWaypointFilled(it, LorenzColor.GREEN.toColor(), seeThroughBlocks = true,) + event.drawDynamicText(it.add(y = 1), "§aShared Egg", 1.5) + return + } } if (!config.showAllWaypoints) return @@ -169,6 +176,16 @@ object HoppityEggLocator { lastParticlePosition = null } + @SubscribeEvent + fun onItemClick(event: ItemClickEvent) { + if (!isEnabled()) return + val item = event.itemInHand ?: return + + if (event.clickType == ClickType.RIGHT_CLICK && item.isLocatorItem) { + lastClick = SimpleTimeMark.now() + } + } + private fun calculateEggPosition() { if (lastGuessMade.passedSince() < 1.seconds) return lastGuessMade = SimpleTimeMark.now() |