Skip to content

A Minecraft Protocol library for Kotlin Multiplatform

License

Notifications You must be signed in to change notification settings

ktcraft/kt-mc-packet

 
 

Repository files navigation

kt-mc-packet

A Minecraft Java Edition Protocol library for Kotlin multiplatform that uses Kotlinx.serialization to Encode and Decode Minecraft packets as kotlin data classes.

Usage

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
)

Images

from src/jvmTest/kotlin/ServerStatusTest.kt

from src/jvmTest/kotlin/ServerLoginTest.kt

About

A Minecraft Protocol library for Kotlin Multiplatform

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 100.0%