1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00

improve DataComponentPatch::has and has_kind

This commit is contained in:
mat 2024-11-28 03:22:34 +00:00
parent c36201cc89
commit ae5c0ea8e5

View file

@ -217,11 +217,11 @@ impl DataComponentPatch {
/// # assert!(!is_edible);
/// ```
pub fn has<T: components::DataComponent>(&self) -> bool {
self.components.contains_key(&T::KIND)
self.has_kind(T::KIND)
}
pub fn has_kind(&self, kind: DataComponentKind) -> bool {
self.components.contains_key(&kind)
self.get_kind(kind).is_some()
}
}