Remove spawn chunks

these will be also soon gone in Vanilla
This commit is contained in:
Alexander Medvedev 2025-07-30 15:26:40 +02:00
parent d8d6676008
commit dbaf240da5
3 changed files with 4 additions and 22 deletions

View File

@ -171,10 +171,6 @@ impl PumpkinServer {
pub async fn new() -> Self {
let server = Server::new().await;
for world in &*server.worlds.read().await {
world.level.read_spawn_chunks(&Server::spawn_chunks()).await;
}
let rcon = advanced_config().networking.rcon.clone();
let mut ticker = Ticker::new();

View File

@ -20,7 +20,6 @@ use pumpkin_protocol::java::client::play::CChangeDifficulty;
use pumpkin_protocol::{ClientPacket, java::client::config::CPluginMessage};
use pumpkin_registry::{Registry, VanillaDimensionType};
use pumpkin_util::Difficulty;
use pumpkin_util::math::vector2::Vector2;
use pumpkin_util::text::TextComponent;
use pumpkin_world::dimension::Dimension;
use pumpkin_world::lock::LevelLocker;
@ -222,18 +221,6 @@ impl Server {
server
}
const SPAWN_CHUNK_RADIUS: i32 = 1;
#[must_use]
pub fn spawn_chunks() -> Box<[Vector2<i32>]> {
(-Self::SPAWN_CHUNK_RADIUS..=Self::SPAWN_CHUNK_RADIUS)
.flat_map(|x| {
(-Self::SPAWN_CHUNK_RADIUS..=Self::SPAWN_CHUNK_RADIUS)
.map(move |z| Vector2::new(x, z))
})
.collect()
}
/// Spawns a task associated with this server. All tasks spawned with this method are awaited
/// when the server stops. This means tasks should complete in a reasonable (no looping) amount of time.
pub fn spawn_task<F>(&self, task: F) -> JoinHandle<F::Output>

View File

@ -543,7 +543,6 @@ impl World {
pub async fn tick(self: &Arc<Self>, server: &Server) {
let start = tokio::time::Instant::now();
self.flush_block_updates().await;
// tick block entities
self.flush_synced_block_events().await;
@ -572,13 +571,13 @@ impl World {
}
let chunk_start = tokio::time::Instant::now();
log::debug!("Ticking chunks");
log::trace!("Ticking chunks");
self.tick_chunks().await;
let elapsed = chunk_start.elapsed();
let players_to_tick: Vec<_> = self.players.read().await.values().cloned().collect();
log::debug!("Ticking players");
log::trace!("Ticking players");
// player ticks
for player in players_to_tick {
player.tick(server).await;
@ -586,7 +585,7 @@ impl World {
let entities_to_tick: Vec<_> = self.entities.read().await.values().cloned().collect();
log::debug!("Ticking entities");
log::trace!("Ticking entities");
// Entity ticks
for entity in entities_to_tick {
entity.tick(entity.clone(), server).await;
@ -606,7 +605,7 @@ impl World {
}
}
log::debug!(
log::trace!(
"Ticking world took {:?}, loaded chunks: {}, chunk tick took {:?}",
start.elapsed(),
self.level.loaded_chunk_count(),