aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/events/PacketEvent.kt
blob: 71c1cfa73c9b0e9eb03432d8b4b3ec815faab16b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package at.hannibal2.skyhanni.events

import net.minecraft.network.Packet
import net.minecraftforge.fml.common.eventhandler.Cancelable

@Cancelable
/**
 * Note: This event is async and may not be executed on the main minecraft thread.
 */
abstract class PacketEvent : LorenzEvent() {
    abstract val direction: Direction
    abstract val packet: Packet<*>

    /**
     * Note: This event is async and may not be executed on the main minecraft thread.
     */
    data class ReceiveEvent(override val packet: Packet<*>) : PacketEvent() {
        override val direction = Direction.INBOUND
    }

    /**
     * Note: This event is async and may not be executed on the main minecraft thread.
     */
    data class SendEvent(override val packet: Packet<*>) : PacketEvent() {
        override val direction = Direction.OUTBOUND
    }

    enum class Direction {
        INBOUND, OUTBOUND
    }
}