/// Loads the chunks around the spawn area and creates
/// a chunk hold on those chunks to prevent them from
/// being unloaded.
///
/// Note that these chunks are loaded asynchronously,
/// and this function will return before loading is complete.
Loads the chunks around the spawn area and creates
a chunk hold on those chunks to prevent them from
being unloaded.

Note that these chunks are loaded asynchronously,
and this function will return before loading is complete.
Loads the chunks around the spawn area and creates a chunk hold on those chunks to prevent them from being unloaded . Note that these chunks are loaded asynchronously and this function will return before loading is complete .
fn load_spawn_chunks(world: &mut World) {
    let view_distance = i32::from(world.fetch::<Arc<Config>>().server.view_distance);
    // Create an entity for the server and
    // add chunk holders using it.
    let server_entity = world.create_entity().build();
    let mut chunk_holders = world.fetch_mut::<ChunkHolders>();
    let chunk_worker_handle = world.fetch::<ChunkWorkerHandle>();
    let level = world.fetch::<LevelData>();
    let offset_x = level.spawn_x / 16;
    let offset_z = level.spawn_z / 16;
    for x in -view_distance..=view_distance {
        for z in -view_distance..=view_distance {
            let chunk = ChunkPosition::new(x + offset_x, z + offset_z);
            chunk_logic::load_chunk(&chunk_worker_handle, chunk);
            chunk_holders.insert_holder(chunk, server_entity);
        }
    }
}
fn load_spawn_chunks ( world : & mut World ) { let view_distance = i32 :: from ( world . fetch :: < Arc < Config > > ( ) . server . view_distance ) ; // Create an entity for the server and // add chunk holders using it. let server_entity = world . create_entity ( ) . build ( ) ; let mut chunk_holders = world . fetch_mut :: < ChunkHolders > ( ) ; let chunk_worker_handle = world . fetch :: < ChunkWorkerHandle > ( ) ; let level = world . fetch :: < LevelData > ( ) ; let offset_x = level . spawn_x / 16 ; let offset_z = level . spawn_z / 16 ; for x in - view_distance ..= view_distance { for z in - view_distance ..= view_distance { let chunk = ChunkPosition :: new ( x + offset_x , z + offset_z ) ; chunk_logic :: load_chunk ( & chunk_worker_handle , chunk ) ; chunk_holders . insert_holder ( chunk , server_entity ) ; } } }
Loads the chunks around the spawn area and creates
a chunk hold on those chunks to prevent them from
being unloaded.
Loads the chunks around the spawn area and creates a chunk hold on those chunks to prevent them from being unloaded .
world
&mut World