blob: fef2697e7d87060b3ce9ab82c5311c21a9394030 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#![doc = include_str!("../README.md")]
pub mod base_component;
pub mod click_event;
mod component;
pub mod hover_event;
#[cfg(feature = "numbers")]
pub mod numbers;
pub mod style;
pub mod text_component;
pub mod translatable_component;
pub use component::{DEFAULT_STYLE, FormattedText};
#[cfg(feature = "simdnbt")]
use simdnbt::{DeserializeError, FromNbtTag};
// TODO: remove this after simdnbt refactor
#[cfg(feature = "simdnbt")]
pub(crate) fn get_in_compound<T: FromNbtTag>(
compound: &simdnbt::borrow::NbtCompound,
key: &str,
) -> Result<T, DeserializeError> {
let value = compound.get(key).ok_or(DeserializeError::MissingField)?;
T::from_nbt_tag(value).ok_or(DeserializeError::MissingField)
}
|