From b8a45b9a0438a12ba3c609f6e416d519829471be Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Mon, 12 Aug 2024 22:15:07 +0200 Subject: Improve location and profile detection --- .../firmament/events/FirmamentCustomPayloadEvent.kt | 10 ---------- .../moe/nea/firmament/events/ServerConnectedEvent.kt | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 10 deletions(-) delete mode 100644 src/main/kotlin/moe/nea/firmament/events/FirmamentCustomPayloadEvent.kt create mode 100644 src/main/kotlin/moe/nea/firmament/events/ServerConnectedEvent.kt (limited to 'src/main/kotlin/moe/nea/firmament/events') diff --git a/src/main/kotlin/moe/nea/firmament/events/FirmamentCustomPayloadEvent.kt b/src/main/kotlin/moe/nea/firmament/events/FirmamentCustomPayloadEvent.kt deleted file mode 100644 index 779ca51..0000000 --- a/src/main/kotlin/moe/nea/firmament/events/FirmamentCustomPayloadEvent.kt +++ /dev/null @@ -1,10 +0,0 @@ - -package moe.nea.firmament.events - -import moe.nea.firmament.apis.ingame.FirmamentCustomPayload - -data class FirmamentCustomPayloadEvent( - val payload: FirmamentCustomPayload -) : FirmamentEvent() { - companion object : FirmamentEventBus() -} 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() { + init { + ClientPlayConnectionEvents.INIT.register(ClientPlayConnectionEvents.Init { clientPlayNetworkHandler: ClientPlayNetworkHandler, minecraftClient: MinecraftClient -> + publishSync(ServerConnectedEvent(clientPlayNetworkHandler.connection)) + }) + } + } +} -- cgit