Skip to content

ismaileke/bedrock-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🦀 Bedrock Client

logo

latest release GitHub License GitHub Downloads GitHub Actions Workflow Status

⚙️ Demo

bedrock-client

🧩 Usage

📄Cargo.toml

[dependencies]
bedrock-client = { git = "https://github.com/ismaileke/bedrock-client.git", branch = "master" }
tokio = "1.47.1"

📄main.rs

use bedrock_client::client;

#[tokio::main]
async fn main() {
    let mut client = client::create(
        "127.0.0.1".to_string(),    // target address
        19132,                      // target port
        "1.21.130".to_string(),     // client version
        false,                      // raknet debug mode
        |code, url| {
            // If you turn on debug, the login code and url will already appear
            // in the console, but you can use this if you want to edit it yourself.
            println!("You can log in with the code {} at {}", code, url);
        }
    ).await.unwrap();

    client.set_packet_callback(|packet_name, packet| {
        println!("New packet received: {} Packet", packet_name);
        println!("Packet as JSON: {}", packet.as_json());
        downcast_bedrock_packet!(packet, Text, |txt: &Text| {
            println!("Text Packet Message: {:?}", txt.message);
            println!("Text Parameters: {:?}", txt.parameters);
        });
    });

    client.connect().expect("Target IP Connection Error");
}

Note

This project is mainly designed for Abyssal Eclipse, but you can get ideas and develop something from the code I wrote.

It is still in development. I can't develop the project because I don't have time. Access to the servers is generally successful.