A Minecraft Java Edition Protocol library for Kotlin multiplatform that uses Kotlinx.serialization to Encode and Decode Minecraft packets as kotlin data classes.
Serialize:
val minecraftVersion = 578 // 1.15.2
val byteArray: ByteArray = MinecraftProtocol.dump(
Handshake.serializer(),
Handshake(
minecraftVersion,
"minecraftserver.com",
25565,
HandshakePacket.HandshakeNextState.STATUS
)
)
Deserialize:
val handshake: Handshake = MinecraftProtocol.load(
Handshake.serializer(),
byteArrayWithPacketData
)