/// Returns a vector of all entities in all chunks
/// within the given view distance of another chunk.
Returns a vector of all entities in all chunks
within the given view distance of another chunk.
Returns a vector of all entities in all chunks within the given view distance of another chunk .
pub fn entites_within_view_distance(
        &self,
        chunk: ChunkPosition,
        view_distance: u8,
    ) -> HashSet<Entity> {
        let mut result = HashSet::new();
        // 1 is subtracted from the view distance because of some odd
        // client-side glitch (or maybe it's our fault?) where the last chunk within the view distance
        // is not loaded correctly.
        let view_distance = i32::from(view_distance) - 1;
        for x_offset in -view_distance..=view_distance {
            for z_offset in -view_distance..=view_distance {
                let chunk = ChunkPosition::new(chunk.x + x_offset, chunk.z + z_offset);
                result.extend(self.entities_in_chunk(chunk));
            }
        }
        result
    }
pub fn entites_within_view_distance ( & self , chunk : ChunkPosition , view_distance : u8 , ) -> HashSet < Entity > { let mut result = HashSet :: new ( ) ; // 1 is subtracted from the view distance because of some odd // client-side glitch (or maybe it's our fault?) where the last chunk within the view distance // is not loaded correctly. let view_distance = i32 :: from ( view_distance ) - 1 ; for x_offset in - view_distance ..= view_distance { for z_offset in - view_distance ..= view_distance { let chunk = ChunkPosition :: new ( chunk . x + x_offset , chunk . z + z_offset ) ; result . extend ( self . entities_in_chunk ( chunk ) ) ; } } result }
Returns a vector of all entities in all chunks
within the given view distance of another chunk.
Returns a vector of all entities in all chunks within the given view distance of another chunk .
&self
chunk
ChunkPosition
view_distance
u8