diff --git a/crates/horizon-client/src/health.rs b/crates/horizon-client/src/health.rs index 31e4e8104..2cee71a31 100644 --- a/crates/horizon-client/src/health.rs +++ b/crates/horizon-client/src/health.rs @@ -25,29 +25,7 @@ use std::{fs, io, path::Path}; pub(crate) type Attributes = LiveAttributes i32>>; pub(crate) type State = HurtState; -#[derive(Clone, Copy, Debug)] -pub struct HealthRules { - pub difficulty: Difficulty, - pub natural_regeneration: bool, - /// The `drowning_damage`, `fall_damage`, `fire_damage` and - /// `freeze_damage` rules `Player.isInvulnerableTo` reads. - pub drowning_damage: bool, - pub fall_damage: bool, - pub fire_damage: bool, - pub freeze_damage: bool, -} -impl Default for HealthRules { - fn default() -> Self { - Self { - difficulty: Difficulty::Normal, - natural_regeneration: true, - drowning_damage: true, - fall_damage: true, - fire_damage: true, - freeze_damage: true, - } - } -} +pub use crate::world::HealthRules; pub struct HealthResources { pub damage: Catalog, pub ids: PlayerFloatIds, diff --git a/crates/horizon-client/src/world.rs b/crates/horizon-client/src/world.rs index 00ff04ac5..9fe83bba2 100644 --- a/crates/horizon-client/src/world.rs +++ b/crates/horizon-client/src/world.rs @@ -53,7 +53,7 @@ pub struct World { pub chunks: crate::chunk_map::ChunkMap, pub random: LegacyRandom, pub revision: u64, - pub health_rules: crate::health::HealthRules, + pub health_rules: HealthRules, pub air: BlockStateId, /// Sections whose geometry changed and need remeshing. pub dirty_sections: DirtySections, @@ -170,7 +170,7 @@ impl World { chunks: Default::default(), random: LegacyRandom::new(seed), revision: 0, - health_rules: crate::health::HealthRules::default(), + health_rules: HealthRules::default(), air, fast_lava: false, dirty_sections: Default::default(), @@ -377,6 +377,32 @@ impl World { } } +/// The game rules and difficulty a player's health reads (`Player.isInvulnerableTo`, +/// natural regeneration), kept with the world they belong to. +#[derive(Clone, Copy, Debug)] +pub struct HealthRules { + pub difficulty: horizon_world::food::Difficulty, + pub natural_regeneration: bool, + /// The `drowning_damage`, `fall_damage`, `fire_damage` and + /// `freeze_damage` rules `Player.isInvulnerableTo` reads. + pub drowning_damage: bool, + pub fall_damage: bool, + pub fire_damage: bool, + pub freeze_damage: bool, +} +impl Default for HealthRules { + fn default() -> Self { + Self { + difficulty: horizon_world::food::Difficulty::Normal, + natural_regeneration: true, + drowning_damage: true, + fall_damage: true, + fire_damage: true, + freeze_damage: true, + } + } +} + #[cfg(test)] mod tests { use super::World;