aboutsummaryrefslogtreecommitdiff
path: root/azalea-world/src
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-world/src')
-rwxr-xr-xazalea-world/src/chunk_storage.rs6
-rw-r--r--azalea-world/src/lib.rs4
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::*;