minecraft.Dial().
Overview
A Minecraft client connects to remote servers, spawns in the world, and can read/write packets to interact with the game. The client uses Microsoft authentication to connect to servers.Basic Client Example
Create a Dialer with Authentication
The The
minecraft.Dialer requires a TokenSource for authentication:auth.TokenSource handles Microsoft account authentication automatically.Spawn in the World
After connecting, spawn the client in the world:This is a blocking operation that waits for the spawn sequence to complete.
Complete Example
Here’s a complete working client:Authentication
Using Token Source
The defaultauth.TokenSource handles authentication automatically:
Using Custom Tokens
You can also use custom OAuth2 tokens:Connection Options
Theminecraft.Dialer supports several configuration options:
Error Handling
Connection Errors
Spawn Errors
Disconnection
Next Steps
- Learn about creating a server
- Build a proxy to intercept packets
- Explore the packet protocol