From 3d792dbef7c7e0f186e29f2e3999f99c2c14f5d7 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Fri, 5 Jul 2024 22:17:02 +0200 Subject: Port to 1.21 --- .../moe/nea/firmament/apis/ingame/packets/PartyInfoRequest.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/main/kotlin/moe/nea/firmament/apis/ingame') diff --git a/src/main/kotlin/moe/nea/firmament/apis/ingame/packets/PartyInfoRequest.kt b/src/main/kotlin/moe/nea/firmament/apis/ingame/packets/PartyInfoRequest.kt index 2b3d234..4f34e8d 100644 --- a/src/main/kotlin/moe/nea/firmament/apis/ingame/packets/PartyInfoRequest.kt +++ b/src/main/kotlin/moe/nea/firmament/apis/ingame/packets/PartyInfoRequest.kt @@ -12,6 +12,7 @@ import net.minecraft.network.PacketByteBuf import net.minecraft.network.codec.PacketCodec import net.minecraft.network.codec.PacketCodecs import net.minecraft.network.packet.CustomPayload +import net.minecraft.util.Identifier import net.minecraft.util.Uuids import moe.nea.firmament.apis.ingame.FirmamentCustomPayload @@ -19,6 +20,10 @@ interface FirmamentCustomPayloadMeta { val ID: CustomPayload.Id val CODEC: PacketCodec + fun id(name: String): CustomPayload.Id { + return CustomPayload.Id(Identifier.of(name)) + } + fun intoType(): CustomPayload.Type { return CustomPayload.Type(ID, CODEC) } @@ -26,7 +31,7 @@ interface FirmamentCustomPayloadMeta { data class PartyInfoRequest(val version: Int) : FirmamentCustomPayload { companion object : FirmamentCustomPayloadMeta { - override val ID = CustomPayload.id("hypixel:party_info") + override val ID = id("hypixel:party_info") override val CODEC = PacketCodecs.VAR_INT.cast() .xmap(::PartyInfoRequest, PartyInfoRequest::version) @@ -116,7 +121,7 @@ data class PartyInfoResponseV1( data class PartyInfoResponse(val data: HypixelVersionedPacketData) : FirmamentCustomPayload { companion object : FirmamentCustomPayloadMeta { - override val ID: CustomPayload.Id = CustomPayload.id("hypixel:party_info") + override val ID = id("hypixel:party_info") override val CODEC = CodecUtils .dispatchVersioned( -- cgit