From 84c631a88b15a0f3fca6613c297dcad2addb1457 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 27 Oct 2026 12:11:26 +0100 Subject: [PATCH] refactor: the villager Poi enum lives in poi_sections.rs World's POI sections are typed by mobs::villager_brain::Poi, which made world depend on mobs, one of the edges that keep the client lib in a single cycle. The enum moves to poi_sections.rs; villager_brain re-exports it and keeps its methods. No behaviour change. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/mobs/villager_brain.rs | 9 +-------- crates/horizon-client/src/poi_sections.rs | 9 +++++++++ crates/horizon-client/src/world.rs | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/crates/horizon-client/src/mobs/villager_brain.rs b/crates/horizon-client/src/mobs/villager_brain.rs index 2052eef4c..724829354 100644 --- a/crates/horizon-client/src/mobs/villager_brain.rs +++ b/crates/horizon-client/src/mobs/villager_brain.rs @@ -789,14 +789,7 @@ pub fn golem_detected(m: &mut Mob, now: i64) { // ---- Behaviours --------------------------------------------------------- -/// The POI types villagers use. -#[derive(Clone, Copy, Debug, PartialEq, Eq)] -pub enum Poi { - /// A job site, by profession index. - Job(u8), - Home, - Meeting, -} +pub use crate::poi_sections::Poi; impl Poi { fn max_tickets(self) -> usize { match self { diff --git a/crates/horizon-client/src/poi_sections.rs b/crates/horizon-client/src/poi_sections.rs index 79ff0441d..a806706a1 100644 --- a/crates/horizon-client/src/poi_sections.rs +++ b/crates/horizon-client/src/poi_sections.rs @@ -79,6 +79,15 @@ impl PoiSections { } } +/// The POI types villagers use. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Poi { + /// A job site, by profession index. + Job(u8), + Home, + Meeting, +} + #[cfg(test)] mod tests { use super::*; diff --git a/crates/horizon-client/src/world.rs b/crates/horizon-client/src/world.rs index 00ff04ac5..9eb8946df 100644 --- a/crates/horizon-client/src/world.rs +++ b/crates/horizon-client/src/world.rs @@ -92,7 +92,7 @@ pub struct World { /// (`ChunkHolder.sectionLightChanged`). pub light_log: Option>, /// The villager POIs of each section (`PoiManager`'s sections). - pub pois: crate::poi_sections::PoiSections, + pub pois: crate::poi_sections::PoiSections, /// Moving-piston states removed during the last tick; retained until the /// final block mesh is visible. pub moving_piston_fallback: Vec<([i32; 3], horizon_world::piston_shape::MovingPistonState)>,