Skip to main content

steel_registry/data_component_predicate/
mod.rs

1//! Registry-dispatched partial data-component predicates.
2
3use std::fmt::{self, Debug, Formatter};
4use std::io::{Cursor, Error, Result, Write};
5
6use rustc_hash::{FxHashMap, FxHashSet};
7use simdnbt::ToNbtTag as _;
8use simdnbt::owned::{NbtCompound, NbtList, NbtTag};
9use steel_utils::codec::VarInt;
10use steel_utils::hash::{ComponentHasher, HashComponent, HashEntry};
11use steel_utils::nbt::NbtNumeric;
12use steel_utils::serial::{ReadFrom, WriteTo};
13use steel_utils::{Downcast as _, DowncastType, DowncastTypeKey, ErasedType, Identifier};
14use text_components::TextComponent;
15
16use crate::attribute::{Attribute, AttributeModifierOperation};
17use crate::data_components::{ComponentData, ComponentEntryRef, DataComponentMap};
18use crate::enchantment::Enchantment;
19use crate::equipment::EquipmentSlotGroup;
20use crate::item_predicate::{
21    DoubleBounds, IntBounds, ItemPredicate, NbtPredicate, decode_optional, hash_entries,
22    push_hash_entry, read_len, read_network_nbt, write_len,
23};
24use crate::jukebox_song::JukeboxSong;
25use crate::potion::Potion;
26use crate::trim_material::TrimMaterial;
27use crate::trim_pattern::TrimPattern;
28use crate::villager_type::VillagerType;
29use crate::{REGISTRY, RegistryEntry, RegistryExt, RegistryHolderSet};
30
31macro_rules! impl_predicate_downcast_type {
32    ($type:ty, $key:literal) => {
33        // SAFETY: This Steel-owned key uniquely identifies the concrete
34        // predicate implementation within the process.
35        unsafe impl DowncastType for $type {
36            const TYPE_KEY: DowncastTypeKey = DowncastTypeKey::new($key);
37        }
38    };
39}
40
41/// Generic collection predicate shared by container, firework, book, and attribute checks.
42mod attributes;
43mod basic;
44mod books;
45mod collections;
46mod core;
47mod fireworks;
48mod registry_predicates;
49mod vanilla;
50
51pub use attributes::*;
52pub use basic::*;
53pub use books::*;
54pub use collections::*;
55pub use core::*;
56pub use fireworks::*;
57pub use registry_predicates::*;
58pub use vanilla::*;
59
60#[cfg(test)]
61mod tests;