aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/events/ServerConnectedEvent.kt
blob: c9bc5e45a4b8e257d5bf08781a9f5d7eccaca484 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package moe.nea.firmament.events

import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents
import net.minecraft.client.Minecraft
import net.minecraft.client.multiplayer.ClientPacketListener
import net.minecraft.network.Connection

data class ServerConnectedEvent(
    val connection: Connection
) : FirmamentEvent() {
    companion object : FirmamentEventBus<ServerConnectedEvent>() {
        init {
            ClientPlayConnectionEvents.INIT.register(ClientPlayConnectionEvents.Init { clientPlayNetworkHandler: ClientPacketListener, minecraftClient: Minecraft ->
                publishSync(ServerConnectedEvent(clientPlayNetworkHandler.connection))
            })
        }
    }
}