bug fixes

This commit is contained in:
Piotrek
2021-05-06 15:49:21 +02:00
parent 45362afbf4
commit c16ad4f4a0
3 changed files with 12 additions and 4 deletions
+2 -2
View File
@@ -26,11 +26,11 @@ impl World {
let ch_pos = block_pos / chunk::SIZE;
let bl_pos = block_pos % chunk::SIZE;
// Create chunk if does not exist
if let None = self.chunks.get_mut(&ch_pos) {
if let None = self.chunks.get(&ch_pos) {
self.chunks.insert(block_pos.clone(), WorldChunk::new());
}
// Generate block for chunk
let chunk = self.chunks.get_mut(block_pos).unwrap();
let chunk = self.chunks.get_mut(&ch_pos).unwrap();
let block = chunk.get_block(&bl_pos);
WorldGen::generate(&bl_pos, block);
block