Struct Difficulty
#[non_exhaustive]pub struct Difficulty {
pub base: u8,
pub effective: f32,
}Expand description
The local difficulty at a spawn (DifficultyInstance): what finalize_spawn reads and
may change before the mob is finalized.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.base: u8Difficulty.getId: 0 peaceful, 1 easy, 2 normal, 3 hard. A larger value is taken as 3.
effective: f32DifficultyInstance.getEffectiveDifficulty: the base scaled by world age, the chunk’s
inhabited time and the moon.
Implementations§
§impl Difficulty
impl Difficulty
pub fn new(base: u8, effective: f32) -> Difficulty
pub fn new(base: u8, effective: f32) -> Difficulty
A difficulty of base and effective.
pub fn special_multiplier(&self) -> f32
pub fn special_multiplier(&self) -> f32
DifficultyInstance.getSpecialMultiplier: 0 below an effective difficulty of 2, 1
above 4, and rising in a straight line between them. Mobs read it for their chance to
pick up loot, a zombie’s reinforcements and a skeleton’s enchanted bow.
Trait Implementations§
§impl Clone for Difficulty
impl Clone for Difficulty
§fn clone(&self) -> Difficulty
fn clone(&self) -> Difficulty
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for Difficulty
§impl Debug for Difficulty
impl Debug for Difficulty
§impl PartialEq for Difficulty
impl PartialEq for Difficulty
impl StructuralPartialEq for Difficulty
Auto Trait Implementations§
impl Freeze for Difficulty
impl RefUnwindSafe for Difficulty
impl Send for Difficulty
impl Sync for Difficulty
impl Unpin for Difficulty
impl UnsafeUnpin for Difficulty
impl UnwindSafe for Difficulty
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more