pub struct AdvancementProgress {
criteria: FxHashMap<Cow<'static, str>, CriterionProgress>,
requirements: AdvancementRequirement,
}Expand description
Represents the progress of a given advancement for a player.
Tracks whether the advancement has been fully completed. In the future, this will also track specific criteria progress.
Fields§
§criteria: FxHashMap<Cow<'static, str>, CriterionProgress>Indicates the different progress of all criteria currently only a boolean
requirements: AdvancementRequirementThe Requirement for the Advancement to be mark as complete
Implementations§
Source§impl AdvancementProgress
impl AdvancementProgress
Sourcepub fn new(
criteria: FxHashMap<Cow<'static, str>, CriterionProgress>,
) -> AdvancementProgress
pub fn new( criteria: FxHashMap<Cow<'static, str>, CriterionProgress>, ) -> AdvancementProgress
Creates a new AdvancementProgress with the given criteria.
need to call update to set the requirements for the advancement
Sourcepub const fn criteria(&self) -> &FxHashMap<Cow<'static, str>, CriterionProgress>
pub const fn criteria(&self) -> &FxHashMap<Cow<'static, str>, CriterionProgress>
Returns a reference to the criteria map.
Sourcefn is_criterion_done(&self, criterion: &str) -> bool
fn is_criterion_done(&self, criterion: &str) -> bool
Check if a criterion his mark has complete
Sourcepub fn has_progress(&self) -> bool
pub fn has_progress(&self) -> bool
Returns true if the advancement has any progress.
Sourcepub fn grant_progress(&mut self, name: &str) -> bool
pub fn grant_progress(&mut self, name: &str) -> bool
grant a specific criterion
Sourcepub fn revoke_progress(&mut self, name: &str) -> bool
pub fn revoke_progress(&mut self, name: &str) -> bool
revoke a specific criterion
Sourcepub fn update(&mut self, requirements: &AdvancementRequirement)
pub fn update(&mut self, requirements: &AdvancementRequirement)
update the progress to match a new AdvancementRequirement list
Sourcepub(crate) fn get_remaining_criteria(&self) -> impl Iterator<Item = &str>
pub(crate) fn get_remaining_criteria(&self) -> impl Iterator<Item = &str>
return the remaining criteria
Sourcepub(crate) fn get_completed_criteria(&self) -> impl Iterator<Item = &str>
pub(crate) fn get_completed_criteria(&self) -> impl Iterator<Item = &str>
get the completed criteria
Trait Implementations§
Source§impl Clone for AdvancementProgress
impl Clone for AdvancementProgress
Source§impl Debug for AdvancementProgress
impl Debug for AdvancementProgress
Source§impl Default for AdvancementProgress
impl Default for AdvancementProgress
Source§impl<'de> Deserialize<'de> for AdvancementProgress
impl<'de> Deserialize<'de> for AdvancementProgress
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AdvancementProgress
impl RefUnwindSafe for AdvancementProgress
impl Send for AdvancementProgress
impl Sync for AdvancementProgress
impl Unpin for AdvancementProgress
impl UnsafeUnpin for AdvancementProgress
impl UnwindSafe for AdvancementProgress
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreWraps this value in an
Arc<SyncMutex<>>