diff --git a/crates/horizon-client/src/game/world_loading.rs b/crates/horizon-client/src/game/world_loading.rs index 998788960..0cea31fd0 100644 --- a/crates/horizon-client/src/game/world_loading.rs +++ b/crates/horizon-client/src/game/world_loading.rs @@ -246,6 +246,9 @@ pub(super) fn make_streaming( let inner = Arc::new(VanillaTerrain::for_world(&options.resources.join("worldgen"), pack.assets.registry, res.biomes(), seed, dim.id(), structures).map_err(|e| { format!("{e}\nPrepare the worldgen bundle with the launcher, or: horizon-prepare --prepare") })?); + if dim == Dim::Overworld && structures { + inner.search_rings_behind(); + } locator = Some(inner.clone()); Streaming::new( Arc::new(Persistent { diff --git a/crates/horizon-client/src/vanillagen.rs b/crates/horizon-client/src/vanillagen.rs index a17bb22d3..046de6551 100644 --- a/crates/horizon-client/src/vanillagen.rs +++ b/crates/horizon-client/src/vanillagen.rs @@ -279,6 +279,26 @@ impl VanillaTerrain { let worker = worker.get_or_insert_with(|| self.generator.worker()); worker.ring_positions(set) } + /// Searches the concentric rings on a thread of their own, behind the + /// server and render threads, as vanilla's background executor does: + /// the first chunks don't wait for them, and an eye of ender thrown + /// later finds them ready. A chunk or a query that needs them first + /// shares the remaining searches with this thread. + pub fn search_rings_behind(self: &Arc) { + let terrain = Arc::clone(self); + let spawned = std::thread::Builder::new() + .name("Ring search".into()) + .spawn(move || { + horizon_threads::behind_server(); + let _ = terrain + .generator + .worker() + .ring_positions("minecraft:strongholds"); + }); + if let Err(e) = spawned { + log::warn!("ring search thread: {e}"); + } + } } /// The worldgen bundle at `dir`, loaded once and shared by every generator /// and by live feature placement (sapling growth, bone meal).