📄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, // 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.set_block_callback(|block_coord, block_data| {
println!("-----------------------------");
println!("Block coord: {:?}", block_coord);
println!("Block name: {:?}", block_data.get_string("name"));
});
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.

