diff options
author | Linnea Gräf <nea@nea.moe> | 2024-05-07 21:11:09 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-05-07 21:11:09 +0200 |
commit | 93e6e0ab16df0808ee7720202a32967eddcf5c10 (patch) | |
tree | 0939d44ec0c848f8712df8b03f30af1d34eabfa0 /src/main/kotlin/moe/nea/firmament/features/diana/AncestralSpadeSolver.kt | |
parent | 8f3cc34740fcfe1572d23c8f1c1db1a309217b84 (diff) | |
download | Firmament-93e6e0ab16df0808ee7720202a32967eddcf5c10.tar.gz Firmament-93e6e0ab16df0808ee7720202a32967eddcf5c10.tar.bz2 Firmament-93e6e0ab16df0808ee7720202a32967eddcf5c10.zip |
Fix up most of the remaining event handlers
[no changelog]
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/features/diana/AncestralSpadeSolver.kt')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/features/diana/AncestralSpadeSolver.kt | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/features/diana/AncestralSpadeSolver.kt b/src/main/kotlin/moe/nea/firmament/features/diana/AncestralSpadeSolver.kt index b9c83e6..e80ef92 100644 --- a/src/main/kotlin/moe/nea/firmament/features/diana/AncestralSpadeSolver.kt +++ b/src/main/kotlin/moe/nea/firmament/features/diana/AncestralSpadeSolver.kt @@ -10,17 +10,20 @@ import kotlin.time.Duration.Companion.seconds import net.minecraft.particle.ParticleTypes import net.minecraft.sound.SoundEvents import net.minecraft.util.math.Vec3d +import moe.nea.firmament.annotations.Subscribe import moe.nea.firmament.events.ParticleSpawnEvent import moe.nea.firmament.events.SoundReceiveEvent import moe.nea.firmament.events.WorldKeyboardEvent import moe.nea.firmament.events.WorldReadyEvent import moe.nea.firmament.events.WorldRenderLastEvent +import moe.nea.firmament.events.subscription.SubscriptionOwner +import moe.nea.firmament.features.FirmamentFeature import moe.nea.firmament.util.SBData import moe.nea.firmament.util.TimeMark import moe.nea.firmament.util.WarpUtil import moe.nea.firmament.util.render.RenderInWorldContext -object AncestralSpadeSolver { +object AncestralSpadeSolver : SubscriptionOwner { var lastDing = TimeMark.farPast() private set private val pitches = mutableListOf<Float>() @@ -33,6 +36,7 @@ object AncestralSpadeSolver { fun isEnabled() = DianaWaypoints.TConfig.ancestralSpadeSolver && SBData.skyblockLocation == "hub" + @Subscribe fun onKeyBind(event: WorldKeyboardEvent) { if (!isEnabled()) return if (!event.matches(DianaWaypoints.TConfig.ancestralSpadeTeleport)) return @@ -42,6 +46,7 @@ object AncestralSpadeSolver { lastTeleportAttempt = TimeMark.now() } + @Subscribe fun onParticleSpawn(event: ParticleSpawnEvent) { if (!isEnabled()) return if (event.particleEffect != ParticleTypes.DRIPPING_LAVA) return @@ -53,6 +58,7 @@ object AncestralSpadeSolver { } } + @Subscribe fun onPlaySound(event: SoundReceiveEvent) { if (!isEnabled()) return if (!SoundEvents.BLOCK_NOTE_BLOCK_HARP.matchesId(event.sound.value().id)) return @@ -92,6 +98,7 @@ object AncestralSpadeSolver { nextGuess = event.position.add(lastParticleDirection.multiply(soundDistanceEstimate)) } + @Subscribe fun onWorldRender(event: WorldRenderLastEvent) { if (!isEnabled()) return RenderInWorldContext.renderInWorld(event) { @@ -108,6 +115,7 @@ object AncestralSpadeSolver { } } + @Subscribe fun onSwapWorld(event: WorldReadyEvent) { nextGuess = null particlePositions.clear() @@ -115,4 +123,7 @@ object AncestralSpadeSolver { lastDing = TimeMark.farPast() } + override val delegateFeature: FirmamentFeature + get() = DianaWaypoints + } |