diff --git a/crates/horizon-client/src/mobs.rs b/crates/horizon-client/src/mobs.rs index 76f622d9c..a61ea2a11 100644 --- a/crates/horizon-client/src/mobs.rs +++ b/crates/horizon-client/src/mobs.rs @@ -2277,7 +2277,7 @@ mod sensor_scan_tests { use horizon_core::geometry::Vec3; use serde_json::json; - fn kind() -> Arc { + pub(super) fn kind() -> Arc { Arc::new(MobType { id: "minecraft:cow".into(), species: Species::Cow, @@ -2481,56 +2481,9 @@ mod sensor_scan_tests { } #[cfg(test)] mod push_tests { + use super::sensor_scan_tests::kind; use super::*; use horizon_core::geometry::Vec3; - use serde_json::json; - - fn kind() -> Arc { - Arc::new(MobType { - id: "minecraft:cow".into(), - species: Species::Cow, - width: 0.9, - height: 1.4, - eye_height: 1.3, - category: "creature".into(), - max_health: 10.0, - speed: 0.2, - flying_speed: 0.4, - attack_damage: 0.0, - attack_knockback: 0.0, - follow_range: 16.0, - step_height: 0.6, - armor: 0.0, - armor_toughness: 0.0, - knockback_resistance: 0.0, - jump_strength: 0.42, - attributes: Arc::default(), - gravity: 0.08, - safe_fall_distance: 3.0, - fall_damage_multiplier: 1.0, - water_efficiency: 0.0, - water_slowdown: 0.8, - air_speed: 0.02, - baby_scale: 0.5, - head_rot_speed: 10.0, - max_head_x_rot: 40.0, - max_head_y_rot: 75.0, - ambient_interval: 120, - flags: Flags { - animal: true, - ..Default::default() - }, - model: Arc::new(Part::parse("root", &json!({}))), - layers: HashMap::new(), - texture: String::new(), - brain: Brain::Passive, - anim: Anim::Rabbit, - sounds: [""; 3], - step_sound: None, - food: Arc::default(), - tempt: Arc::default(), - }) - } /// The pending pushes as one list, scanned for each mob, as before. fn take_old(events: &mut Vec, from: usize, pending: &mut Vec<(u32, Vec3)>) { diff --git a/crates/horizon-world/src/datafix/chunk_flatten.rs b/crates/horizon-world/src/datafix/chunk_flatten.rs index e3c116d93..671fc9f73 100644 --- a/crates/horizon-world/src/datafix/chunk_flatten.rs +++ b/crates/horizon-world/src/datafix/chunk_flatten.rs @@ -266,8 +266,8 @@ fn is_virtual(block: usize) -> bool { VIRTUAL.contains(&block) } -/// `getSideMask`. -fn side_mask(west: bool, east: bool, north: bool, south: bool) -> i32 { +/// `getSideMask` (LeavesFix has the same copy). +pub(super) fn side_mask(west: bool, east: bool, north: bool, south: bool) -> i32 { let mut s = 0; if north { if east { diff --git a/crates/horizon-world/src/datafix/chunk_leaves.rs b/crates/horizon-world/src/datafix/chunk_leaves.rs index 9cd2fd3d9..07d59cbdf 100644 --- a/crates/horizon-world/src/datafix/chunk_leaves.rs +++ b/crates/horizon-world/src/datafix/chunk_leaves.rs @@ -6,6 +6,7 @@ //! emulated here (`IntOpenHashSet` and the key order of an `Int2ObjectOpenHashMap`). use std::collections::{HashMap, HashSet}; +use super::chunk_flatten::side_mask; use super::dynamic::{as_int, as_long_stream, as_str, ceillog2, set}; use crate::nbt::Tag; @@ -355,32 +356,6 @@ fn get_index(x: i32, y: i32, z: i32) -> i32 { y << 8 | z << 4 | x } -fn side_mask(west: bool, east: bool, north: bool, south: bool) -> i32 { - let mut s = 0; - if north { - if east { - s |= 2; - } else if west { - s |= 128; - } else { - s |= 1; - } - } else if south { - if west { - s |= 32; - } else if east { - s |= 8; - } else { - s |= 16; - } - } else if east { - s |= 4; - } else if west { - s |= 64; - } - s -} - /// `LeavesFix` over a chunk (`{Level: ...}`). pub(super) fn leaves_fix(chunk: &mut Tag) { let Some(level) = chunk.get_mut("Level") else {