summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/combat
diff options
context:
space:
mode:
authorBrady <thatgravyboat@gmail.com>2024-06-08 06:48:29 -0230
committerGitHub <noreply@github.com>2024-06-08 11:18:29 +0200
commitf9cafb766115d5342f7d7e1f8b9e3a56504f0273 (patch)
treecd325dbd48a4f8cde6f7e3c74e49cf0ebef99cad /src/main/java/at/hannibal2/skyhanni/features/combat
parentf677ce0fa1cab31feccab6eff2e5c35e2524d8a3 (diff)
downloadskyhanni-f9cafb766115d5342f7d7e1f8b9e3a56504f0273.tar.gz
skyhanni-f9cafb766115d5342f7d7e1f8b9e3a56504f0273.tar.bz2
skyhanni-f9cafb766115d5342f7d7e1f8b9e3a56504f0273.zip
Backend: Packet Events (#2025)
Co-authored-by: Cal <cwolfson58@gmail.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/combat')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/mobs/ArachneSpawnTimer.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt)11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/ArachneSpawnTimer.kt
index 528ae4401..2fee0577e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/ArachneSpawnTimer.kt
@@ -1,11 +1,12 @@
package at.hannibal2.skyhanni.features.combat.mobs
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
-import at.hannibal2.skyhanni.events.PacketEvent
+import at.hannibal2.skyhanni.events.minecraft.packet.PacketReceivedEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
@@ -19,13 +20,12 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import at.hannibal2.skyhanni.utils.toLorenzVec
import net.minecraft.network.play.server.S2APacketParticles
import net.minecraft.util.EnumParticleTypes
-import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.Duration.Companion.seconds
@SkyHanniModule
-object SpawnTimers {
+object ArachneSpawnTimer {
private val config get() = SkyHanniMod.feature.combat.mobs
@@ -80,9 +80,8 @@ object SpawnTimers {
}
}
- // All this to detect "quickspawn" vs regular arachne spawn
- @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true)
- fun onPacketReceive(event: PacketEvent.ReceiveEvent) {
+ @HandleEvent(onlyOnIsland = IslandType.SPIDER_DEN, priority = HandleEvent.LOW, receiveCancelled = true)
+ fun onPacketReceive(event: PacketReceivedEvent) {
if (!saveNextTickParticles) return
if (searchTime.passedSince() < 3.seconds) return