aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/events/ServerConnectedEvent.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-08-12 22:15:07 +0200
committerLinnea Gräf <nea@nea.moe>2024-08-12 22:15:07 +0200
commitb8a45b9a0438a12ba3c609f6e416d519829471be (patch)
treeaff190bb953d94f1187896b2c245644a29e6badf /src/main/kotlin/moe/nea/firmament/events/ServerConnectedEvent.kt
parent3c7e6b6177de6ef3cff8a46bb1726466a299cdde (diff)
downloadfirmament-b8a45b9a0438a12ba3c609f6e416d519829471be.tar.gz
firmament-b8a45b9a0438a12ba3c609f6e416d519829471be.tar.bz2
firmament-b8a45b9a0438a12ba3c609f6e416d519829471be.zip
Improve location and profile detection
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/events/ServerConnectedEvent.kt')
-rw-r--r--src/main/kotlin/moe/nea/firmament/events/ServerConnectedEvent.kt18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/events/ServerConnectedEvent.kt b/src/main/kotlin/moe/nea/firmament/events/ServerConnectedEvent.kt
new file mode 100644
index 0000000..26897f2
--- /dev/null
+++ b/src/main/kotlin/moe/nea/firmament/events/ServerConnectedEvent.kt
@@ -0,0 +1,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))
+ })
+ }
+ }
+}