Add all packets handler

This commit is contained in:
2026-09-07 10:07:10 +08:00
parent d7300451f8
commit c0f9679090
25 files changed
+202 -105

No files matched your search

+9 -23
View File
@@ -4,27 +4,13 @@
* **Auth Join Request** (`AuthenticationProvider`): Sends the HTTP POST request to Mojang's session server
(`https://sessionserver.mojang.com/session/minecraft/join`).
[Use libmc-protocol-encrypt](https://repo.rtast.cn/packages/-/cn.rtast.libmc:protocol-encrypt)
```kotlin
val client = createMinecraftClient(
host = "127.0.0.1",
username = "Player",
accessToken = accessToken
) {
// 1. AES-128-CFB8 Cipher Implementation
cipherFactory = { sharedKey -> JvmAesCipher(sharedKey) }
// 2. SHA-1 Hasher Implementation
sha1Hasher = Sha1Hasher { serverId, secretKey, publicKey ->
/* your SHA-1 implementation */
}
// 3. RSA-1024 Encryptor Implementation
rsaEncryptor = RSA1024Encryptor { publicKey, data ->
/* your RSA encryption implementation */
}
// 4. Mojang Auth HTTP Join Provider
authProvider = AuthenticationProvider { accessToken, uuid, serverIdHash ->
/* send HTTP POST to session server using your preferred HTTP client (Ktor, OkHttp, etc.) */
}
}
fun main() {
val client = createMinecraftClient(
// other parameter
crypto = DefaultProtocolContext
)
}
```