aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-12 01:18:51 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-12 01:18:51 +0100
commit98ef101e9bb436be74af9f5d2b1ee6bb9ebefa4a (patch)
tree94e90452933ca29b013b4e57f511ba97a2118714 /src/main/java
parent0f7b18fbcac2526fd55a2ff7965461eaad5606d6 (diff)
downloadskyhanni-98ef101e9bb436be74af9f5d2b1ee6bb9ebefa4a.tar.gz
skyhanni-98ef101e9bb436be74af9f5d2b1ee6bb9ebefa4a.tar.bz2
skyhanni-98ef101e9bb436be74af9f5d2b1ee6bb9ebefa4a.zip
Only showing the closest 25 start burrow locations.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt34
1 files changed, 34 insertions, 0 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 14422e6b4..d631147eb 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
@@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.events.BurrowDugEvent
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
@@ -17,6 +18,7 @@ import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy
+import at.hannibal2.skyhanni.utils.LorenzUtils.sorted
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
import at.hannibal2.skyhanni.utils.RenderUtils.drawColor
@@ -40,6 +42,7 @@ object GriffinBurrowHelper {
private var teleportedLocation: LorenzVec? = null
private var lastGuessTime = 0L
private var lastAnimationTime = 0L
+ private var burrowsTooFarAway = emptyList<LorenzVec>()
@SubscribeEvent
fun onSoopyGuessBurrow(event: SoopyGuessBurrowEvent) {
@@ -65,15 +68,41 @@ object GriffinBurrowHelper {
}
@SubscribeEvent
+ fun onTick(event: LorenzTickEvent) {
+ if (event.repeatSeconds(2)) {
+ val max = 25
+ if (particleBurrows.size > max) {
+ var index = 0
+ val list = particleBurrows.map { it.key to it.key.distanceToPlayer() }.sorted().map { it.first }
+ val newHiddenList = mutableListOf<LorenzVec>()
+ for (vec in list) {
+ index++
+ if (index > max) {
+ newHiddenList.add(vec)
+ }
+ }
+ burrowsTooFarAway = newHiddenList
+ }
+ } else {
+ burrowsTooFarAway = emptyList()
+ }
+ }
+
+ @SubscribeEvent
fun onBurrowDetect(event: BurrowDetectEvent) {
EntityMovementData.addToTrack(Minecraft.getMinecraft().thePlayer)
particleBurrows = particleBurrows.editCopy { this[event.burrowLocation] = event.type }
+ burrowUpdate()
if (config.burrowsNearbyDetection) {
checkRemoveGuess(true)
}
}
+ private fun burrowUpdate() {
+
+ }
+
private fun checkRemoveGuess(animation: Boolean) {
guessLocation?.let { guessRaw ->
val guess = findBlock(guessRaw)
@@ -90,6 +119,7 @@ object GriffinBurrowHelper {
fun onBurrowDug(event: BurrowDugEvent) {
val location = event.burrowLocation
particleBurrows = particleBurrows.editCopy { remove(location) }
+ burrowUpdate()
if (particleBurrows.isNotEmpty()) {
animationLocation = location
}
@@ -109,6 +139,7 @@ object GriffinBurrowHelper {
if (!DianaAPI.featuresEnabled()) return
if (event.message.startsWith("§c ☠ §r§7You were killed by §r")) {
particleBurrows = particleBurrows.editCopy { keys.removeIf { this[it] == BurrowType.MOB } }
+ burrowUpdate()
}
}
@@ -119,6 +150,7 @@ object GriffinBurrowHelper {
animationLocation = null
lastDug = null
particleBurrows = particleBurrows.editCopy { clear() }
+ burrowUpdate()
}
private fun findBlock(point: LorenzVec): LorenzVec {
@@ -181,6 +213,8 @@ object GriffinBurrowHelper {
if (config.burrowsNearbyDetection) {
for (burrow in particleBurrows) {
val location = burrow.key
+ if (location in burrowsTooFarAway && burrow.value == BurrowType.START) continue
+
val distance = location.distance(playerLocation)
val burrowType = burrow.value
event.drawColor(location, burrowType.color, distance > 10)