From 428056ff805839e04443dcff3badd021eb4abe01 Mon Sep 17 00:00:00 2001 From: nea Date: Fri, 9 Jun 2023 18:08:38 +0200 Subject: Add support for other mods using /locraw --- .../nea/firmament/events/ClientChatLineReceivedEvent.kt | 14 ++++++++++++++ .../kotlin/moe/nea/firmament/events/OutgoingPacketEvent.kt | 7 +++++++ .../nea/firmament/events/ServerChatLineReceivedEvent.kt | 6 +++--- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 src/main/kotlin/moe/nea/firmament/events/ClientChatLineReceivedEvent.kt create mode 100644 src/main/kotlin/moe/nea/firmament/events/OutgoingPacketEvent.kt (limited to 'src/main/kotlin/moe/nea/firmament/events') diff --git a/src/main/kotlin/moe/nea/firmament/events/ClientChatLineReceivedEvent.kt b/src/main/kotlin/moe/nea/firmament/events/ClientChatLineReceivedEvent.kt new file mode 100644 index 0000000..604422d --- /dev/null +++ b/src/main/kotlin/moe/nea/firmament/events/ClientChatLineReceivedEvent.kt @@ -0,0 +1,14 @@ +package moe.nea.firmament.events + +import net.minecraft.text.Text +import moe.nea.firmament.util.unformattedString + +/** + * Published just before a message is added to the chat gui. Cancelling only prevents rendering, not logging to the + * console. + */ +data class ClientChatLineReceivedEvent(val text: Text) : FirmamentEvent.Cancellable() { + val unformattedString = text.unformattedString + + companion object : FirmamentEventBus() +} diff --git a/src/main/kotlin/moe/nea/firmament/events/OutgoingPacketEvent.kt b/src/main/kotlin/moe/nea/firmament/events/OutgoingPacketEvent.kt new file mode 100644 index 0000000..4263d9d --- /dev/null +++ b/src/main/kotlin/moe/nea/firmament/events/OutgoingPacketEvent.kt @@ -0,0 +1,7 @@ +package moe.nea.firmament.events + +import net.minecraft.network.packet.Packet + +data class OutgoingPacketEvent(val packet: Packet<*>) : FirmamentEvent.Cancellable() { + companion object : FirmamentEventBus() +} diff --git a/src/main/kotlin/moe/nea/firmament/events/ServerChatLineReceivedEvent.kt b/src/main/kotlin/moe/nea/firmament/events/ServerChatLineReceivedEvent.kt index c7e950f..57879a1 100644 --- a/src/main/kotlin/moe/nea/firmament/events/ServerChatLineReceivedEvent.kt +++ b/src/main/kotlin/moe/nea/firmament/events/ServerChatLineReceivedEvent.kt @@ -23,9 +23,9 @@ import moe.nea.firmament.util.unformattedString /** * This event gets published whenever the client receives a chat message from the server. - */ + * This event is cancellable, but should not get cancelled. Use [ClientChatLineReceivedEvent] for that instead. */ data class ServerChatLineReceivedEvent(val text: Text) : FirmamentEvent.Cancellable() { - companion object : FirmamentEventBus() - val unformattedString = text.unformattedString + + companion object : FirmamentEventBus() } -- cgit