diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-17 03:34:12 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-17 03:34:12 +0100 |
commit | 8b7b52ab9a7395dbcf29f642b6492b4cceb25f73 (patch) | |
tree | a15aac238e307c70511409118dc9e21b3eb51134 | |
parent | ad0c264c347367bfd02437e25d2835e3cd0d3737 (diff) | |
download | skyhanni-8b7b52ab9a7395dbcf29f642b6492b4cceb25f73.tar.gz skyhanni-8b7b52ab9a7395dbcf29f642b6492b4cceb25f73.tar.bz2 skyhanni-8b7b52ab9a7395dbcf29f642b6492b4cceb25f73.zip |
Removed Diana "Smooth Transition" and replaced it with "Line to Next".
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/event/diana/DianaConfig.java | 4 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/events/BurrowGuessEvent.kt (renamed from src/main/java/at/hannibal2/skyhanni/events/SoopyGuessBurrowEvent.kt) | 2 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt | 172 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt | 5 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt | 4 |
5 files changed, 73 insertions, 114 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/diana/DianaConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/event/diana/DianaConfig.java index 9db30db0c..2de341b4c 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/event/diana/DianaConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/diana/DianaConfig.java @@ -29,9 +29,9 @@ public class DianaConfig { public boolean burrowsNearbyDetection = false; @Expose - @ConfigOption(name = "Smooth Transition", desc = "Show the way from one burrow to another smoothly.") + @ConfigOption(name = "Line To Next", desc = "Show a line to the closest burrow or guess location.") @ConfigEditorBoolean - public boolean burrowSmoothTransition = false; + public boolean lineToNext = true; @Expose @ConfigOption(name = "Nearest Warp", desc = "Warps to the nearest warp point on the hub, if closer to the next burrow.") diff --git a/src/main/java/at/hannibal2/skyhanni/events/SoopyGuessBurrowEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/BurrowGuessEvent.kt index c4b4683c5..844e43eef 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/SoopyGuessBurrowEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/BurrowGuessEvent.kt @@ -2,4 +2,4 @@ package at.hannibal2.skyhanni.events import at.hannibal2.skyhanni.utils.LorenzVec -class SoopyGuessBurrowEvent(val guessLocation: LorenzVec) : LorenzEvent()
\ No newline at end of file +class BurrowGuessEvent(val guessLocation: LorenzVec) : LorenzEvent() 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 a305c7d5e..06007c80c 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 @@ -5,11 +5,12 @@ import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.EntityMovementData import at.hannibal2.skyhanni.events.BurrowDetectEvent import at.hannibal2.skyhanni.events.BurrowDugEvent +import at.hannibal2.skyhanni.events.BurrowGuessEvent import at.hannibal2.skyhanni.events.EntityMoveEvent 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.events.SoopyGuessBurrowEvent import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.LocationUtils @@ -22,6 +23,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.RenderUtils.drawColor import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.RenderUtils.drawString +import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation import at.hannibal2.skyhanni.utils.TimeUtils import net.minecraft.client.Minecraft import net.minecraft.init.Blocks @@ -32,55 +34,59 @@ import kotlin.time.Duration.Companion.seconds object GriffinBurrowHelper { private val config get() = SkyHanniMod.feature.event.diana - private var guessLocation: LorenzVec? = null private var targetLocation: LorenzVec? = null + private var guessLocation: LorenzVec? = null private var particleBurrows = mapOf<LorenzVec, BurrowType>() - var animationLocation: LorenzVec? = null - private var lastDug: LorenzVec? = null - private var teleportedLocation: LorenzVec? = null + private var lastGuessTime = 0L - private var lastAnimationTime = 0L @SubscribeEvent - fun onSoopyGuessBurrow(event: SoopyGuessBurrowEvent) { - EntityMovementData.addToTrack(Minecraft.getMinecraft().thePlayer) - if (System.currentTimeMillis() > lastGuessTime + 1_000) { - animationLocation = LocationUtils.playerLocation().add(-0.5, -1.0, -0.5) - } - lastGuessTime = System.currentTimeMillis() + fun onTick(event: LorenzTickEvent) { + if (!isEnabled()) return + if (!event.repeatSeconds(1)) return - guessLocation = event.guessLocation - setTargetLocation(event.guessLocation) + update() } - fun setTargetLocation(location: LorenzVec) { - targetLocation = location + private fun update() { + if (config.burrowsNearbyDetection) { + checkRemoveGuess() + } - if (config.burrowNearestWarp) { - BurrowWarpHelper.shouldUseWarps(findBlock(location)) + val locations = particleBurrows.keys.toMutableList() + guessLocation?.let { + locations.add(findBlock(it)) } - if (config.burrowsNearbyDetection) { - checkRemoveGuess(false) + locations.addAll(InquisitorWaypointShare.waypoints.values.map { it.location }) + targetLocation = locations.minByOrNull { it.distanceToPlayer() } + + if (config.burrowNearestWarp) { + targetLocation?.let { + BurrowWarpHelper.shouldUseWarps(it) + } } } @SubscribeEvent + fun onBurrowGuess(event: BurrowGuessEvent) { + EntityMovementData.addToTrack(Minecraft.getMinecraft().thePlayer) + lastGuessTime = System.currentTimeMillis() + + guessLocation = event.guessLocation + update() + } + + @SubscribeEvent fun onBurrowDetect(event: BurrowDetectEvent) { EntityMovementData.addToTrack(Minecraft.getMinecraft().thePlayer) particleBurrows = particleBurrows.editCopy { this[event.burrowLocation] = event.type } - - if (config.burrowsNearbyDetection) { - checkRemoveGuess(true) - } + update() } - private fun checkRemoveGuess(animation: Boolean) { + private fun checkRemoveGuess() { guessLocation?.let { guessRaw -> val guess = findBlock(guessRaw) if (particleBurrows.any { guess.distance(it.key) < 40 }) { - if (animation) { - animationLocation = guess - } guessLocation = null } } @@ -90,17 +96,14 @@ object GriffinBurrowHelper { fun onBurrowDug(event: BurrowDugEvent) { val location = event.burrowLocation particleBurrows = particleBurrows.editCopy { remove(location) } - if (particleBurrows.isNotEmpty()) { - animationLocation = location - } - lastDug = location + update() } @SubscribeEvent fun onPlayerMove(event: EntityMoveEvent) { if (!isEnabled()) return if (event.distance > 10 && event.entity == Minecraft.getMinecraft().thePlayer) { - teleportedLocation = event.newLocation + update() } } @@ -111,20 +114,14 @@ object GriffinBurrowHelper { particleBurrows = particleBurrows.editCopy { keys.removeIf { this[it] == BurrowType.MOB } } } if (event.message == "§6Poof! §r§eYou have cleared your griffin burrows!") { - reset() + guessLocation = null + particleBurrows = emptyMap() } } @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { - reset() - } - - private fun reset() { guessLocation = null - targetLocation = null - animationLocation = null - lastDug = null particleBurrows = emptyMap() } @@ -181,6 +178,25 @@ object GriffinBurrowHelper { } } + if (config.lineToNext) { + val player = event.exactPlayerEyeLocation() + + var color: LorenzColor? + val renderLocation = if (BurrowWarpHelper.currentWarp != null) { + color = LorenzColor.AQUA + player.add(y = -5) + } else { + color = LorenzColor.WHITE + targetLocation?.add(0.5, 0.5, 0.5) ?: return + } + + val lineWidth = if (targetLocation in particleBurrows) { + color = particleBurrows[targetLocation]!!.color + 3 + } else 2 + event.draw3DLine(player, renderLocation, color.toColor(), lineWidth, false) + } + if (InquisitorWaypointShare.waypoints.isNotEmpty() && config.inquisitorSharing.focusInquisitor) { return } @@ -200,7 +216,8 @@ object GriffinBurrowHelper { val guessLocation = findBlock(it) val distance = guessLocation.distance(playerLocation) event.drawColor(guessLocation, LorenzColor.WHITE, distance > 10) - event.drawDynamicText(guessLocation.add(y = 1), "Guess", 1.5) + val color = if (BurrowWarpHelper.currentWarp == null) "§f" else "§b" + event.drawDynamicText(guessLocation.add(y = 1), "${color}Guess", 1.5) if (distance > 5) { val formattedDistance = LorenzUtils.formatInteger(distance.toInt()) event.drawDynamicText(guessLocation.add(y = 1), "§e${formattedDistance}m", 1.7, yOff = 10f) @@ -215,70 +232,17 @@ object GriffinBurrowHelper { } private fun sendTip(event: LorenzRenderWorldEvent) { - teleportedLocation?.let { - teleportedLocation = null - - if (BurrowWarpHelper.currentWarp != null) { - BurrowWarpHelper.currentWarp = null - if (config.burrowNearestWarp) { - animationLocation = it - return - } - } - } - if (config.burrowNearestWarp) { - BurrowWarpHelper.currentWarp?.let { warp -> - animationLocation?.let { - event.drawColor(it.add(y = 1), LorenzColor.AQUA) - if (it.distanceToPlayer() < 10) { - event.drawString(it.add(0.5, 1.5, 0.5), "§bWarp to " + warp.displayName, true) - if (config.keyBindWarp != Keyboard.KEY_NONE) { - val keyname = KeyboardManager.getKeyName(config.keyBindWarp) - event.drawString(it.add(0.5, 1.2, 0.5), "§ePress $keyname", true) - } - } - return - } - } - } - if (config.burrowSmoothTransition) { - animationLocation?.let { - event.drawColor(it, LorenzColor.WHITE) - animationLocation = moveAnimation(it, event) - } - } - } + if (!config.burrowNearestWarp) return + val warp = BurrowWarpHelper.currentWarp ?: return - private fun moveAnimation(animation: LorenzVec, event: LorenzRenderWorldEvent): LorenzVec? { - val list = mutableListOf<LorenzVec>() - if (config.burrowsNearbyDetection) { - list.addAll(particleBurrows.keys) - } - targetLocation?.let { - val loc = findBlock(it) - if (loc.y > 200) { - list.add(LorenzVec(loc.x, LocationUtils.playerLocation().y, loc.z)) - } else { - list.add(loc) - } - } - val target = list.minByOrNull { it.distance(animation) } ?: return null - val distance = target.distance(animation) - if (distance < 0.20) return null - - var vector = target.subtract(animation) - - event.draw3DLine(animation.add(0.5, 0.5, 0.5), target.add(0.5, 0.5, 0.5), LorenzColor.WHITE.toColor(), 2, true) - - return if (System.currentTimeMillis() > lastAnimationTime + 25) { - lastAnimationTime = System.currentTimeMillis() - vector = vector.multiply(1 / vector.length()) - vector = vector.multiply(0.18) - animation.add(vector) - } else { - animation - } + val location = event.exactPlayerEyeLocation().add(y = -5) + val text = "§bWarp to " + warp.displayName + val keybindSuffix = if (config.keyBindWarp != Keyboard.KEY_NONE) { + val keyname = KeyboardManager.getKeyName(config.keyBindWarp) + " §7(§ePress $keyname§7)" + } else "" + event.drawString(location, text + keybindSuffix, true) } private fun isEnabled() = DianaAPI.isDoingDiana() diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt index d7cbba03f..f8469f83f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt @@ -10,7 +10,6 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.KeyboardManager -import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy @@ -243,10 +242,6 @@ object InquisitorWaypointShare { } val inquis = SharedInquisitor(name, displayName, location, SimpleTimeMark.now()) waypoints = waypoints.editCopy { this[name] = inquis } - if (config.focusInquisitor) { - GriffinBurrowHelper.setTargetLocation(location.add(y = 1)) - GriffinBurrowHelper.animationLocation = LocationUtils.playerLocation() - } event.isCanceled = true } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt index f14aa59b9..2fa31408d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt @@ -1,10 +1,10 @@ package at.hannibal2.skyhanni.features.event.diana import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.BurrowGuessEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PlaySoundEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent -import at.hannibal2.skyhanni.events.SoopyGuessBurrowEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.toLorenzVec @@ -243,7 +243,7 @@ class SoopyGuessBurrow { } else { LorenzVec(floor(p2.x), 255.0, floor(p2.z)) } - SoopyGuessBurrowEvent(finalLocation).postAndCatch() + BurrowGuessEvent(finalLocation).postAndCatch() } } } |