Add pumpkin-world

also refactor player
This commit is contained in:
Snowiiii committed 2024-08-04 00:29:20 +02:00
1 parent 31aa333410
commit ae69bbc7f1
20 files changed
+342 -268

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
use std::{fs::File, path::Path};
use fastanvil::{complete, Chunk, Region};
pub mod chunk;
pub struct World {
pub region: Region<File>,
}
impl World {
pub fn load<P: AsRef<Path>>(path: P) -> Self {
let file = std::fs::File::open(path).unwrap();
let region = Region::from_stream(file).unwrap();
Self { region }
}
/* pub fn load_chunk(&mut self, x: usize, y: usize) -> Chunk {
let data = self.region.read_chunk(x, y).unwrap().unwrap();
let complete_chunk = complete::Chunk::from_bytes(&data).unwrap();
}
*/
}