aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/apis/ingame
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-07-05 22:17:02 +0200
committerLinnea Gräf <nea@nea.moe>2024-07-05 22:17:02 +0200
commit3d792dbef7c7e0f186e29f2e3999f99c2c14f5d7 (patch)
treeb383c2c584a96b93c46d1dae3efcd3c6571e3d05 /src/main/kotlin/moe/nea/firmament/apis/ingame
parent5ee4b8d925eb12e068038a1fd2e1f35cdd8ef87e (diff)
downloadfirmament-3d792dbef7c7e0f186e29f2e3999f99c2c14f5d7.tar.gz
firmament-3d792dbef7c7e0f186e29f2e3999f99c2c14f5d7.tar.bz2
firmament-3d792dbef7c7e0f186e29f2e3999f99c2c14f5d7.zip
Port to 1.21
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/apis/ingame')
-rw-r--r--src/main/kotlin/moe/nea/firmament/apis/ingame/packets/PartyInfoRequest.kt9
1 files changed, 7 insertions, 2 deletions
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<T : FirmamentCustomPayload> {
val ID: CustomPayload.Id<T>
val CODEC: PacketCodec<PacketByteBuf, T>
+ fun id(name: String): CustomPayload.Id<T> {
+ return CustomPayload.Id<T>(Identifier.of(name))
+ }
+
fun intoType(): CustomPayload.Type<PacketByteBuf, T> {
return CustomPayload.Type(ID, CODEC)
}
@@ -26,7 +31,7 @@ interface FirmamentCustomPayloadMeta<T : FirmamentCustomPayload> {
data class PartyInfoRequest(val version: Int) : FirmamentCustomPayload {
companion object : FirmamentCustomPayloadMeta<PartyInfoRequest> {
- override val ID = CustomPayload.id<PartyInfoRequest>("hypixel:party_info")
+ override val ID = id("hypixel:party_info")
override val CODEC =
PacketCodecs.VAR_INT.cast<PacketByteBuf>()
.xmap(::PartyInfoRequest, PartyInfoRequest::version)
@@ -116,7 +121,7 @@ data class PartyInfoResponseV1(
data class PartyInfoResponse(val data: HypixelVersionedPacketData<PartyInfoResponseV>) : FirmamentCustomPayload {
companion object : FirmamentCustomPayloadMeta<PartyInfoResponse> {
- override val ID: CustomPayload.Id<PartyInfoResponse> = CustomPayload.id("hypixel:party_info")
+ override val ID = id("hypixel:party_info")
override val CODEC =
CodecUtils
.dispatchVersioned<PacketByteBuf, PartyInfoResponseV>(