mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
more chunk and readme stuff
This commit is contained in:
parent
1e2ec61100
commit
8e42e1c5df
7 changed files with 16 additions and 12 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -99,6 +99,7 @@ dependencies = [
|
||||||
"azalea-core",
|
"azalea-core",
|
||||||
"azalea-crypto",
|
"azalea-crypto",
|
||||||
"azalea-protocol",
|
"azalea-protocol",
|
||||||
|
"azalea-world",
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
10
README.md
10
README.md
|
@ -1,20 +1,24 @@
|
||||||
# Azalea
|
# Azalea
|
||||||
|
|
||||||
A Rust crate for creating Minecraft bots.
|
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://cdn.matdoes.dev/images/flowering_azalea.webp" alt="Azalea" height="200">
|
<img src="https://cdn.matdoes.dev/images/flowering_azalea.webp" alt="Azalea" height="200">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
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.
|
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
|
## Goals
|
||||||
|
|
||||||
- Do everything a vanilla client can do
|
- Do everything a vanilla client can do
|
||||||
- Be easy to use
|
- Be easy to use
|
||||||
- Bypass most/all anticheats
|
- Bypass most/all anticheats
|
||||||
- Support the latest Minecraft version
|
- Support the latest Minecraft version
|
||||||
- Be fast
|
- Be fast and memory efficient
|
||||||
|
|
||||||
## Example code
|
## Example code
|
||||||
|
|
||||||
|
|
|
@ -10,4 +10,5 @@ azalea-auth = {path = "../azalea-auth"}
|
||||||
azalea-core = {path = "../azalea-core"}
|
azalea-core = {path = "../azalea-core"}
|
||||||
azalea-crypto = {path = "../azalea-crypto"}
|
azalea-crypto = {path = "../azalea-crypto"}
|
||||||
azalea-protocol = {path = "../azalea-protocol"}
|
azalea-protocol = {path = "../azalea-protocol"}
|
||||||
|
azalea-world = {path = "../azalea-world"}
|
||||||
tokio = {version = "1.18.0", features = ["sync"]}
|
tokio = {version = "1.18.0", features = ["sync"]}
|
||||||
|
|
|
@ -13,6 +13,7 @@ use azalea_protocol::{
|
||||||
},
|
},
|
||||||
resolver, ServerAddress,
|
resolver, ServerAddress,
|
||||||
};
|
};
|
||||||
|
use azalea_world::Chunk;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tokio::sync::mpsc::{self, UnboundedReceiver, UnboundedSender};
|
use tokio::sync::mpsc::{self, UnboundedReceiver, UnboundedSender};
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
|
@ -233,7 +234,7 @@ impl Client {
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundLevelChunkWithLightPacket(p) => {
|
GamePacket::ClientboundLevelChunkWithLightPacket(p) => {
|
||||||
println!("Got chunk with light packet {} {}", p.x, p.z);
|
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) => {
|
GamePacket::ClientboundLightUpdatePacket(p) => {
|
||||||
println!("Got light update packet {:?}", p);
|
println!("Got light update packet {:?}", p);
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
//! Utilities for reading and writing for the Minecraft protocol
|
//! 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 read;
|
||||||
mod write;
|
mod write;
|
||||||
|
|
||||||
|
|
|
@ -27,4 +27,3 @@ pub struct BlockEntity {
|
||||||
data: azalea_nbt::Tag,
|
data: azalea_nbt::Tag,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ChunkSection {}
|
|
||||||
|
|
|
@ -12,12 +12,16 @@ mod tests {
|
||||||
|
|
||||||
const SECTION_HEIGHT: u32 = 16;
|
const SECTION_HEIGHT: u32 = 16;
|
||||||
|
|
||||||
|
pub struct World {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
pub struct Chunk {
|
pub struct Chunk {
|
||||||
pub sections: Vec<Section>,
|
pub sections: Vec<Section>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Chunk {
|
impl Chunk {
|
||||||
fn read_with_world_height(buf: &mut impl Read, world_height: u32) -> Result<Self, String> {
|
pub fn read_with_world_height(buf: &mut impl Read, world_height: u32) -> Result<Self, String> {
|
||||||
let section_count = world_height / SECTION_HEIGHT;
|
let section_count = world_height / SECTION_HEIGHT;
|
||||||
let mut sections = Vec::with_capacity(section_count as usize);
|
let mut sections = Vec::with_capacity(section_count as usize);
|
||||||
for _ in 0..section_count {
|
for _ in 0..section_count {
|
||||||
|
|
Loading…
Add table
Reference in a new issue