mirror of
https://github.com/mat-1/azalea.git
synced 2024-09-18 22:32:31 +00:00
start adding azalea-world
This commit is contained in:
parent
c2262a2123
commit
4d75415130
7 changed files with 63 additions and 1 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -164,6 +164,10 @@ dependencies = [
|
|||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "azalea-world"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
|
|
|
@ -10,6 +10,7 @@ members = [
|
|||
"azalea-nbt",
|
||||
"azalea-brigadier",
|
||||
"azalea-crypto",
|
||||
"azalea-world",
|
||||
]
|
||||
|
||||
[profile.release]
|
||||
|
|
|
@ -233,6 +233,7 @@ impl Client {
|
|||
}
|
||||
GamePacket::ClientboundLevelChunkWithLightPacket(p) => {
|
||||
println!("Got chunk with light packet {} {}", p.x, p.z);
|
||||
// p.chunk_data
|
||||
}
|
||||
GamePacket::ClientboundLightUpdatePacket(p) => {
|
||||
println!("Got light update packet {:?}", p);
|
||||
|
|
|
@ -30,5 +30,7 @@ pub struct BlockEntity {
|
|||
pub struct ChunkSection {}
|
||||
|
||||
impl ClientboundLevelChunkPacketData {
|
||||
pub fn read(world_height: u32) {}
|
||||
pub fn read(world_height: u32) {
|
||||
// let section_count
|
||||
}
|
||||
}
|
||||
|
|
8
azalea-world/Cargo.toml
Normal file
8
azalea-world/Cargo.toml
Normal file
|
@ -0,0 +1,8 @@
|
|||
[package]
|
||||
name = "azalea-world"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
3
azalea-world/README.md
Normal file
3
azalea-world/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Azalea World
|
||||
|
||||
The Minecraft world representation used in Azalea.
|
43
azalea-world/src/lib.rs
Normal file
43
azalea-world/src/lib.rs
Normal file
|
@ -0,0 +1,43 @@
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let result = 2 + 2;
|
||||
assert_eq!(result, 4);
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Chunk {
|
||||
sections: Vec<Section>,
|
||||
}
|
||||
|
||||
pub struct Section {
|
||||
states: PalettedContainer,
|
||||
biomes: PalettedContainer,
|
||||
}
|
||||
|
||||
pub struct PalettedContainer {
|
||||
bits_per_entry: u8,
|
||||
palette: Palette,
|
||||
/// Compacted list of indices pointing to entry IDs in the Palette.
|
||||
data: Vec<i64>,
|
||||
}
|
||||
|
||||
pub enum Palette {
|
||||
/// ID of the corresponding entry in its global palette
|
||||
SingleValue(u32),
|
||||
LinearPalette(Vec<u32>),
|
||||
HashmapPalette(Vec<u32>),
|
||||
GlobalPalette,
|
||||
}
|
||||
|
||||
impl Palette {
|
||||
fn choose_palette_for_states(bits_per_entry: u8) -> &'static Palette {
|
||||
match bits_per_entry {
|
||||
0 => &Palette::SingleValue,
|
||||
1..=4 => &Palette::LinearPalette,
|
||||
5..=8 => &Palette::HashmapPalette,
|
||||
_ => &Palette::GlobalPalette,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue