diff options
| author | mat <git@matdoes.dev> | 2023-07-23 23:21:08 -0500 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2023-07-23 23:21:08 -0500 |
| commit | 22ea8c60fed17e48a591bcbb82808fed55509386 (patch) | |
| tree | a85be1738270f7fb2a133b20629f2db0464e58f2 /azalea-world/src | |
| parent | 15acf1347727b84472e6a8a1c7a4f51cd3163f01 (diff) | |
| download | azalea-drasl-22ea8c60fed17e48a591bcbb82808fed55509386.tar.xz | |
fix sometimes not receiving chunks
Diffstat (limited to 'azalea-world/src')
| -rwxr-xr-x | azalea-world/src/chunk_storage.rs | 6 | ||||
| -rw-r--r-- | azalea-world/src/lib.rs | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/azalea-world/src/chunk_storage.rs b/azalea-world/src/chunk_storage.rs index 3c8d3555..d831770c 100755 --- a/azalea-world/src/chunk_storage.rs +++ b/azalea-world/src/chunk_storage.rs @@ -53,6 +53,12 @@ pub struct Section { pub biomes: PalettedContainer, } +/// Get the actual stored view distance for the selected view distance. For some +/// reason Minecraft actually stores an extra 3 chunks. +pub fn calculate_chunk_storage_range(view_distance: u32) -> u32 { + u32::max(view_distance, 2) + 3 +} + impl Default for Section { fn default() -> Self { Section { diff --git a/azalea-world/src/lib.rs b/azalea-world/src/lib.rs index be2c46c1..9c1f5ff5 100644 --- a/azalea-world/src/lib.rs +++ b/azalea-world/src/lib.rs @@ -13,7 +13,9 @@ mod world; use std::backtrace::Backtrace; pub use bit_storage::BitStorage; -pub use chunk_storage::{Chunk, ChunkStorage, PartialChunkStorage, Section}; +pub use chunk_storage::{ + calculate_chunk_storage_range, Chunk, ChunkStorage, PartialChunkStorage, Section, +}; pub use container::*; use thiserror::Error; pub use world::*; |
