Crates.io | sandstone |
lib.rs | sandstone |
version | 0.1.2 |
source | src |
created_at | 2024-06-02 15:56:45.794247 |
updated_at | 2024-06-24 01:57:21.363141 |
description | Networking library for Minecraft: Java Edition servers |
homepage | https://github.com/dec4234/sandstone |
repository | https://github.com/dec4234/sandstone |
max_upload_size | |
id | 1259301 |
size | 148,402 |
sandstone is a Minecraft: Java Edition networking library. It is not a server implementation, but rather a library that can be used to create your own server-sided software. The ultimate goal is to use this library in a future implementation of a Minecraft: Java Edition server in Rust.
This project will be a continuous work in progress, and may see months of no activity.
This library is provided as a structured baseline and as an open source software solution for anyone looking to create specialized Minecraft: Java Edition servers. It is built with convenient optimizations and abstractions in mind.
The library currently has a fully custom packet serializer and deserializer, as well as a client connection handler.
Here is a current example of handling the server list status.
#[tokio::main]
async fn main() {
SimpleLogger::new().init().unwrap();
debug!("Starting server");
let server = TcpListener::bind("127.0.0.1:25565").await.unwrap();
loop {
let (socket, _) = server.accept().await.unwrap();
let mut client = CraftClient::from_connection(socket).unwrap();
let mut response = StatusResponseSpec::new(ProtocolVerison::V1_20, "&a&lThis is a test description &bĀ§kttt");
response.set_player_info(1, 0, vec![PlayerSample::new_random("&6&lTest")]);
let image = image::open("src/server-icon.png").unwrap();
response.set_favicon_image(image);
DefaultHandshakeHandler::handle_handshake(&mut client).await.unwrap();
DefaultStatusHandler::handle_status(&mut client, StatusResponseBody::new(response), DefaultPingHandler).await.unwrap();
}
}
More examples can be found in the examples/ folder.
The actual TODO list is massive, but here are the current priorities for the project.
Please note that this project is under heavy development and functions might not be heavily optimized yet.
Please also note that encryption has not been rigorously tested for security, so please use online features with caution.
Some other projects were consulted for general design and handling for the minecraft protocol.
The following projects were significantly useful for understanding some quirks with the Minecraft protocol. It also guided me on early version of McSerializer and McDeserializer (instead of using serde).