Skip to content

Latest commit

 

History

217 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.49.0"

📄main.rs

use bedrock_client::client;
use bedrock_client::protocol::bedrock::text::Text;
use bedrock_client::protocol::bedrock::packet::Packet;
use bedrock_client::protocol::bedrock::play_status::PlayStatus;
use bedrock_client::utils::color_format;

#[tokio::main]
async fn main() {
    // Check out my test file for detailed usage
    let mut client = client::create(
        "127.0.0.1".to_string(),    // target address
        19132,                      // target port
        "1.26.50".to_string(),      // client version
        false,                      // RakNet debug mode
        |code, url| {
            println!("Microsoft Auth Code: {} - URL: {}", code, url);
        }
    ).await.unwrap();

    println!("Client started! Entering game loop...");

    while let Some((packet_name, packet)) = client.next_event().await {
        println!("[Packet] Received Packet: {}", packet_name);
        match packet {
            BedrockPacket::PlayStatus(play_status) => {
                if play_status.status == 3 {
                    println!("Login Successful! Joined the game.");
                    let my_text = Text {
                        text_type: Text::TYPE_CHAT,
                        needs_translation: false,
                        source_name: Some("Steve".to_string()),
                        message: "Hello server!".to_string(),
                        parameters: None,
                        xbox_uid: "".to_string(),
                        platform_chat_id: "".to_string(),
                        filtered_message: None,
                    }.encode();

                    client.send_packet(my_text);
                }
            },
        };
    }
}

Note

It is still in development.

Releases

Packages

Used by

Contributors

Languages