aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt
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/data/MinecraftData.kt
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/data/MinecraftData.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt
index bf9980084..02768fc3d 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt
@@ -1,11 +1,12 @@
package at.hannibal2.skyhanni.data
+import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.events.ItemInHandChangeEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
-import at.hannibal2.skyhanni.events.PacketEvent
import at.hannibal2.skyhanni.events.PlaySoundEvent
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
+import at.hannibal2.skyhanni.events.minecraft.packet.PacketReceivedEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.DelayedRun
import at.hannibal2.skyhanni.utils.InventoryUtils
@@ -23,10 +24,8 @@ import net.minecraftforge.fml.common.gameevent.TickEvent
@SkyHanniModule
object MinecraftData {
- @SubscribeEvent(receiveCanceled = true)
- fun onSoundPacket(event: PacketEvent.ReceiveEvent) {
- if (!LorenzUtils.inSkyBlock) return
-
+ @HandleEvent(receiveCancelled = true, onlyOnSkyblock = true)
+ fun onSoundPacket(event: PacketReceivedEvent) {
val packet = event.packet
if (packet !is S29PacketSoundEffect) return
@@ -46,10 +45,8 @@ object MinecraftData {
LorenzWorldChangeEvent().postAndCatch()
}
- @SubscribeEvent(receiveCanceled = true)
- fun onParticlePacketReceive(event: PacketEvent.ReceiveEvent) {
- if (!LorenzUtils.inSkyBlock) return
-
+ @HandleEvent(receiveCancelled = true, onlyOnSkyblock = true)
+ fun onParticlePacketReceive(event: PacketReceivedEvent) {
val packet = event.packet
if (packet !is S2APacketParticles) return