From dbaf240da5cece65a09c9e04ec4baf81315cebad Mon Sep 17 00:00:00 2001 From: Alexander Medvedev Date: Wed, 30 Jul 2025 15:26:40 +0200 Subject: [PATCH] Remove spawn chunks these will be also soon gone in Vanilla --- pumpkin/src/lib.rs | 4 ---- pumpkin/src/server/mod.rs | 13 ------------- pumpkin/src/world/mod.rs | 9 ++++----- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/pumpkin/src/lib.rs b/pumpkin/src/lib.rs index 50af7aded..aecbbceea 100644 --- a/pumpkin/src/lib.rs +++ b/pumpkin/src/lib.rs @@ -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(); diff --git a/pumpkin/src/server/mod.rs b/pumpkin/src/server/mod.rs index 195dc6ee7..9c31d66b7 100644 --- a/pumpkin/src/server/mod.rs +++ b/pumpkin/src/server/mod.rs @@ -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]> { - (-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(&self, task: F) -> JoinHandle diff --git a/pumpkin/src/world/mod.rs b/pumpkin/src/world/mod.rs index e7721249d..343ad40e0 100644 --- a/pumpkin/src/world/mod.rs +++ b/pumpkin/src/world/mod.rs @@ -543,7 +543,6 @@ impl World { pub async fn tick(self: &Arc, 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(),