18 releases

0.1.17 Nov 14, 2024
0.1.16 Aug 22, 2024
0.1.15 Jul 15, 2024
0.1.8 May 24, 2024

#1183 in Network programming

Download history 11/week @ 2024-08-02 94/week @ 2024-08-16 43/week @ 2024-08-23 4/week @ 2024-08-30 56/week @ 2024-09-13 10/week @ 2024-09-20 43/week @ 2024-09-27 12/week @ 2024-10-04 1/week @ 2024-10-11 67/week @ 2024-11-08 46/week @ 2024-11-15

113 downloads per month

Custom license

42KB
948 lines

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.17" # 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

Dependencies

~700KB
~12K SLoC