aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/events/ServerConnectedEvent.kt
blob: 26897f2aece9a947c9beb41d1136875a101e3a9b (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.MinecraftClient
import net.minecraft.client.network.ClientPlayNetworkHandler
import net.minecraft.network.ClientConnection

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