change: Got some tests failing for repeated inserts

This commit is contained in:
Nicholas Novak
2023-10-02 21:02:53 -07:00
parent e5547477fc
commit a280cb91f5
3 changed files with 87 additions and 4 deletions

View File

@@ -27,6 +27,10 @@ impl SimpleServer {
}
}
pub fn num_chunks(&self) -> usize {
self.chunks.len()
}
fn chunk_at_block_mut(&mut self, block_pos: &BlockPos) -> Option<&mut ChunkData> {
// Find what chunk the block is in
let chunk_pos = ChunkPos::from(block_pos);
@@ -72,6 +76,8 @@ impl StorageServer for SimpleServer {
let chunk = chunk.expect("Could not find chunk");
println!("Chunk for {:?} is at {:?}", world_position, chunk.pos);
// Find the section that the block is located in
let current_section = &mut chunk.sections[world_position.y / 16];
// Find the index that the block is at, and update its state