steel_registry/data_components/mod.rs
1//! Data components system for items and entities.
2//!
3//! Component values are type-erased through Steel's deterministic keyed
4//! downcasting system. Vanilla and plugin-defined values use the same storage
5//! path while retaining type-safe access through [`DataComponentType`].
6//!
7//! # Architecture
8//!
9//! - [`ComponentData`] - Type-erased component value storage
10//! - [`Component`] - Object-safe behavior for stored values
11//! - [`DataComponentType<T>`] - Compile-time type handle for accessing components
12//! - [`DataComponentMap`] - Storage for component values on items
13//! - [`DataComponentPatch`] - Diff representation for network/storage
14//! - [`DataComponentRegistry`] - Registry of component types with serialization
15//!
16//! # Example
17//! ```ignore
18//! use steel_registry::data_components::vanilla_components::DAMAGE;
19//!
20//! // Type-safe access (compile-time checked)
21//! let damage: Option<&i32> = components.get(DAMAGE);
22//! components.set(DAMAGE, Some(10));
23//!
24//! // Raw access for plugins
25//! let data = components.get_raw(&key)?;
26//! ```
27
28mod component_data;
29pub mod components;
30mod registry;
31pub mod vanilla_components;
32
33// Re-export core types
34pub use crate::item_predicate::{AdventureModePredicate, BlockPredicate, LockCode};
35pub use component_data::{Component, ComponentData};
36pub use components::{
37 ArmorTrim, BannerPatternLayer, BannerPatternLayers, BlocksAttacks, BundleContents,
38 ChargedProjectiles, Consumable, CustomData, CustomModelData, DeathProtection, DyedItemColor,
39 Enchantable, Equippable, EquippableAllowedEntities, InstrumentComponent,
40 InvalidEnchantableValue, ItemContainerContents, JukeboxPlayable, MapDecorationEntry,
41 MapDecorations, MapId, MapItemColor, OminousBottleAmplifier, PaintingVariantComponent,
42 PotDecorations, PotionContents, ProvidesBannerPatterns, ProvidesTrimMaterial, Recipes,
43 SulfurCubeContent, Tool, ToolRule, ToolRuleBlocks, UseRemainder,
44};
45pub use registry::{
46 ComponentEntry,
47 ComponentEntryRef,
48 ComponentPatchEntry,
49 DataComponentMap,
50 DataComponentPatch,
51 DataComponentRegistry,
52 DataComponentType,
53 NbtReader,
54 NbtWriter,
55 // Type aliases for reader/writer functions
56 NetworkReader,
57 NetworkWriter,
58 component_try_into,
59};