aboutsummaryrefslogtreecommitdiff
path: root/azalea-world/src
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-12-15 14:59:26 +0700
committermat <git@matdoes.dev>2025-12-15 14:59:26 +0700
commit0569ffd2d85585eb69de9068ab3f62e768bce4e7 (patch)
treee20d7faf8df7ede4eb3f52d3223b27782a964be0 /azalea-world/src
parent232f1a434406d77dc5ef1d19edcdf006e32491e8 (diff)
downloadazalea-drasl-0569ffd2d85585eb69de9068ab3f62e768bce4e7.tar.xz
write/update docs for several items
Diffstat (limited to 'azalea-world/src')
-rw-r--r--azalea-world/src/chunk_storage.rs9
-rw-r--r--azalea-world/src/world.rs4
2 files changed, 13 insertions, 0 deletions
diff --git a/azalea-world/src/chunk_storage.rs b/azalea-world/src/chunk_storage.rs
index 2e87fdf6..65dbbb7a 100644
--- a/azalea-world/src/chunk_storage.rs
+++ b/azalea-world/src/chunk_storage.rs
@@ -49,7 +49,16 @@ pub struct PartialChunkStorage {
/// pointers.
#[derive(Clone, Debug)]
pub struct ChunkStorage {
+ /// The height of the world.
+ ///
+ /// To get the maximum y position (exclusive), you have to combine this with
+ /// [`Self::min_y`].
pub height: u32,
+ /// The lowest y position in the world that can still have blocks placed on
+ /// it.
+ ///
+ /// This exists because in modern Minecraft versions, worlds can extend
+ /// below y=0.
pub min_y: i32,
pub map: IntMap<ChunkPos, Weak<RwLock<Chunk>>>,
}
diff --git a/azalea-world/src/world.rs b/azalea-world/src/world.rs
index e4260aee..c2ba6749 100644
--- a/azalea-world/src/world.rs
+++ b/azalea-world/src/world.rs
@@ -169,10 +169,14 @@ pub struct Instance {
}
impl Instance {
+ /// Get the block at the given position, or `None` if it's outside of the
+ /// world that we have loaded.
pub fn get_block_state(&self, pos: BlockPos) -> Option<BlockState> {
self.chunks.get_block_state(pos)
}
+ /// Similar to [`Self::get_block_state`], but returns data about the fluid
+ /// at the position, including for waterlogged blocks.
pub fn get_fluid_state(&self, pos: BlockPos) -> Option<FluidState> {
self.chunks.get_block_state(pos).map(FluidState::from)
}