Lightweight Minecraft protocol implementation in pure rust
Go to file
2025-04-28 14:07:46 +03:00
examples init commit 2025-04-28 14:07:46 +03:00
src init commit 2025-04-28 14:07:46 +03:00
.gitignore init commit 2025-04-28 14:07:46 +03:00
Cargo.lock init commit 2025-04-28 14:07:46 +03:00
Cargo.toml init commit 2025-04-28 14:07:46 +03:00
LICENSE init commit 2025-04-28 14:07:46 +03:00
README.md init commit 2025-04-28 14:07:46 +03:00

rust_mc_proto_tokio

Lightweight minecraft packets protocol support in pure rust
Has compression (MinecraftConnection::set_compression)
This crate can be used for a server on rust idk -_-

Setup

rust_mc_proto_tokio = "0.1.18" # stable version
rust_mc_proto_tokio = { git = "https://git.meex.lol/MeexReay/rust_mc_proto_tokio" } # unstable version

Features:

  • atomic_clone - Atomic clone of MinecraftConnection

How to use

Example of receiving motd:

use rust_mc_proto_tokio::{prelude::*, MCConnTcp, Packet, ProtocolError};

#[tokio::main]
async fn main() -> Result<(), ProtocolError> {
    let mut conn = MCConnTcp::connect("localhost:25565").await?; // connecting

    let mut packet = Packet::empty(0x00);
    packet.write_u16_varint(765).await?; // protocol_version
    packet.write_string("localhost").await?; // server_address
    packet.write_unsigned_short(25565).await?; // server_port
    packet.write_u8_varint(1).await?; // next_state
    conn.write_packet(&packet).await?;

    conn.write_packet(&Packet::empty(0x00)).await?; // status request packet

    Ok(println!("motd: {}", conn.read_packet().await?.read_string().await?)) // status response packet
}

More examples
Documentation

Contributing

If you would like to contribute to the project, feel free to fork the repository and submit a pull request.

License

This project is licensed under the WTFPL License