diff --git a/Cargo.lock b/Cargo.lock index b0fe3c05..3633a1af 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -99,6 +99,7 @@ dependencies = [ "azalea-core", "azalea-crypto", "azalea-protocol", + "azalea-world", "tokio", ] diff --git a/README.md b/README.md index 909ae47e..4c90ba42 100755 --- a/README.md +++ b/README.md @@ -1,20 +1,24 @@ # Azalea -A Rust crate for creating Minecraft bots. -

Azalea

+A Rust crate for creating Minecraft bots. + I named this Azalea because it sounds like a cool word and this is a cool library. This project was heavily inspired by PrismarineJS. +## Why + +I wanted a fun excuse to do something cool with Rust, and I also felt like I could do better than [Mineflayer](https://github.com/prismarinejs/mineflayer) in some areas. + ## Goals - Do everything a vanilla client can do - Be easy to use - Bypass most/all anticheats - Support the latest Minecraft version -- Be fast +- Be fast and memory efficient ## Example code diff --git a/azalea-client/Cargo.toml b/azalea-client/Cargo.toml index 55caadeb..1156f8de 100755 --- a/azalea-client/Cargo.toml +++ b/azalea-client/Cargo.toml @@ -10,4 +10,5 @@ azalea-auth = {path = "../azalea-auth"} azalea-core = {path = "../azalea-core"} azalea-crypto = {path = "../azalea-crypto"} azalea-protocol = {path = "../azalea-protocol"} +azalea-world = {path = "../azalea-world"} tokio = {version = "1.18.0", features = ["sync"]} diff --git a/azalea-client/src/connect.rs b/azalea-client/src/connect.rs index b628051a..be268eee 100755 --- a/azalea-client/src/connect.rs +++ b/azalea-client/src/connect.rs @@ -13,6 +13,7 @@ use azalea_protocol::{ }, resolver, ServerAddress, }; +use azalea_world::Chunk; use std::sync::Arc; use tokio::sync::mpsc::{self, UnboundedReceiver, UnboundedSender}; use tokio::sync::Mutex; @@ -233,7 +234,7 @@ impl Client { } GamePacket::ClientboundLevelChunkWithLightPacket(p) => { println!("Got chunk with light packet {} {}", p.x, p.z); - // p.chunk_data + // let chunk = Chunk::read_with_world_height(&mut p.chunk_data); } GamePacket::ClientboundLightUpdatePacket(p) => { println!("Got light update packet {:?}", p); diff --git a/azalea-protocol/src/mc_buf/mod.rs b/azalea-protocol/src/mc_buf/mod.rs index 74d69441..a82334fb 100755 --- a/azalea-protocol/src/mc_buf/mod.rs +++ b/azalea-protocol/src/mc_buf/mod.rs @@ -1,11 +1,5 @@ //! Utilities for reading and writing for the Minecraft protocol -// TODO: have a separate azalea-protocol-definitions crate to house everything in mc_buf -// We need to do this to prevent cyclic dependencies. -// For example with azalea-protocol depending on azalea-world, -// it could be changed to azalea-protocol depending on azalea-world -// and azalea-world depending on azalea-protocol-definitions. - mod read; mod write; diff --git a/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs b/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs index 0ab581ec..6810ceb2 100644 --- a/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs @@ -27,4 +27,3 @@ pub struct BlockEntity { data: azalea_nbt::Tag, } -pub struct ChunkSection {} diff --git a/azalea-world/src/lib.rs b/azalea-world/src/lib.rs index e6b90ad5..8e60a6d6 100644 --- a/azalea-world/src/lib.rs +++ b/azalea-world/src/lib.rs @@ -12,12 +12,16 @@ mod tests { const SECTION_HEIGHT: u32 = 16; +pub struct World { + +} + pub struct Chunk { pub sections: Vec
, } impl Chunk { - fn read_with_world_height(buf: &mut impl Read, world_height: u32) -> Result { + pub fn read_with_world_height(buf: &mut impl Read, world_height: u32) -> Result { let section_count = world_height / SECTION_HEIGHT; let mut sections = Vec::with_capacity(section_count as usize); for _ in 0..section_count {