Lightweight Minecraft protocol implementation in pure rust
Go to file
2024-11-12 01:05:25 +03:00
.github/workflows Create rust.yml 2024-05-12 19:38:49 +03:00
examples i love rustmcproto 2024-11-12 00:34:56 +03:00
src bloaaaat hating 2024-11-12 00:12:05 +03:00
.gitignore you dont need to see this 2024-05-12 00:12:24 +03:00
Cargo.toml is alive state 2024-11-10 03:31:21 +03:00
LICENSE init commit?? 2024-05-12 00:11:25 +03:00
README.md readme update 2024-11-12 01:05:25 +03:00

rust_mc_proto

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 = "0.1.16" # stable version
rust_mc_proto = { git = "https://github.com/MeexReay/rust_mc_proto" } # unstable version

Features:

  • atomic_clone - Atomic clone of MinecraftConnection

How to use

Example of receiving motd:

use rust_mc_proto::{DataBufferReader, DataBufferWriter, MCConnTcp, Packet, ProtocolError};

fn main() -> Result<(), ProtocolError> {
    let mut conn = MCConnTcp::connect("mc.hypixel.net:25565")?; // connecting

    conn.write_packet(&Packet::build(0x00, |packet| {
        packet.write_u16_varint(765)?; // protocol_version
        packet.write_string("mc.hypixel.net")?; // server_address
        packet.write_unsigned_short(25565)?; // server_port
        packet.write_u8_varint(1) // next_state
    })?)?; // handshake packet

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

    Ok(println!("motd: {}", conn.read_packet()?.read_string()?)) // 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